}
static void
-test_verify_file_data (const gchar *dir, gchar *file_name,
- const gchar *expected_file_content)
+test_verify_file_data (const gchar * dir, gchar * file_name,
+ const gchar * expected_file_content)
{
GError *err = NULL;
gchar *res_file_content = NULL;
fail_unless (res_file_content != NULL);
fail_unless (strncmp (res_file_content, expected_file_content,
- strlen (expected_file_content)) == 0);
+ strlen (expected_file_content)) == 0);
g_free (res_file_content);
g_unlink (path);
g_free (path);
num_bytes = strlen (data);
buffer = gst_buffer_new ();
gst_buffer_insert_memory (buffer, 0,
- gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+ gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
data, num_bytes, 0, num_bytes, data, NULL));
fail_unless (gst_pad_push (srcpad, buffer) == GST_FLOW_OK);
num_bytes = strlen (data);
buffer = gst_buffer_new ();
gst_buffer_insert_memory (buffer, 0,
- gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
+ gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
data, num_bytes, 0, num_bytes, data, NULL));
fail_unless (gst_pad_push (srcpad, buffer) == GST_FLOW_ERROR);
static gboolean
sebras_gst_pad_set_caps (GstPad * pad, GstCaps * caps)
{
- GstEvent *event;
- gboolean res = TRUE;
-
- GST_WARNING ("sebraz: a %p %p", pad, caps);
- g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- GST_WARNING ("sebraz: b");
- g_return_val_if_fail (caps != NULL && gst_caps_is_fixed (caps), FALSE);
- GST_WARNING ("sebraz: c");
-
- GST_WARNING ("sebraz: d");
- event = gst_event_new_caps (caps);
- GST_WARNING ("sebraz: e");
-
- if (GST_PAD_IS_SRC (pad)) {
- GST_WARNING ("sebraz: f1");
- res = gst_pad_push_event (pad, event);
- } else {
- GST_WARNING ("sebraz: f2");
- res = gst_pad_send_event (pad, event);
- }
-
- GST_WARNING ("sebraz: g");
-
- return res;
+ GstEvent *event;
+ gboolean res = TRUE;
+
+ GST_WARNING ("sebraz: a %p %p", pad, caps);
+ g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
+ GST_WARNING ("sebraz: b");
+ g_return_val_if_fail (caps != NULL && gst_caps_is_fixed (caps), FALSE);
+ GST_WARNING ("sebraz: c");
+
+ GST_WARNING ("sebraz: d");
+ res = gst_pad_set_caps (pad, caps);
+ GST_WARNING ("sebraz: e");
+
+ return res;
}
GST_START_TEST (test_properties)
{
GstElement *sink;
GstCaps *caps;
- const gchar *location= "file:///tmp/";
+ const gchar *location = "file:///tmp/";
const gchar *file_contents = "line 1\r\n";
gchar *file_name = g_strdup_printf ("curlfilesink_%d", g_random_int ());
gchar *res_location = NULL;
g_object_get (sink,
"location", &res_location,
- "file-name", &res_file_name,
- "create-dirs", &res_create_dirs,
- NULL);
+ "file-name", &res_file_name, "create-dirs", &res_create_dirs, NULL);
GST_WARNING ("sebras: d");
fail_unless (strncmp (res_location, "mylocation", strlen ("mylocation"))
g_object_get (sink,
"location", &res_location,
- "file-name", &res_file_name,
- "create-dirs", &res_create_dirs,
- NULL);
+ "file-name", &res_file_name, "create-dirs", &res_create_dirs, NULL);
GST_WARNING ("sebras: j");
fail_unless (strncmp (res_location, location, strlen (location))
g_free (file_name);
g_free (path);
}
+
GST_END_TEST;
GST_START_TEST (test_one_file)
{
GstElement *sink;
GstCaps *caps;
- const gchar *location= "file:///tmp/";
+ const gchar *location = "file:///tmp/";
gchar *file_name = g_strdup_printf ("curlfilesink_%d", g_random_int ());
const gchar *file_content = "line 1\r\n";
gchar *res_location = NULL;
g_object_set (G_OBJECT (sink), "file-name", file_name, NULL);
g_object_get (sink,
- "location", &res_location,
- "file-name", &res_file_name,
- NULL);
+ "location", &res_location, "file-name", &res_file_name, NULL);
fail_unless (strncmp (res_location, location, strlen (location))
== 0);
/* verify file content */
test_verify_file_data ("/tmp", file_name, file_content);
}
+
GST_END_TEST;
GST_START_TEST (test_one_big_file)
{
GstElement *sink;
GstCaps *caps;
- const gchar *location= "file:///tmp/";
+ const gchar *location = "file:///tmp/";
gchar *file_name = g_strdup_printf ("curlfilesink_%d", g_random_int ());
const gchar *file_line1 = "line 1\r\n";
const gchar *file_line2 = "line 2\r\n";
const gchar *file_line3 = "line 3\r\n";
- const gchar *expected_file_content = "line 1\r\n" \
- "line 2\r\n" \
- "line 3\r\n";
+ const gchar *expected_file_content = "line 1\r\n" "line 2\r\n" "line 3\r\n";
gchar *res_location = NULL;
gchar *res_file_name = NULL;
g_object_set (G_OBJECT (sink), "file-name", file_name, NULL);
g_object_get (sink,
- "location", &res_location,
- "file-name", &res_file_name,
- NULL);
+ "location", &res_location, "file-name", &res_file_name, NULL);
fail_unless (strncmp (res_location, location, strlen (location))
== 0);
/* verify file content */
test_verify_file_data ("/tmp", file_name, expected_file_content);
}
+
GST_END_TEST;
GST_START_TEST (test_two_files)
{
GstElement *sink;
GstCaps *caps;
- const gchar *location= "file:///tmp/";
+ const gchar *location = "file:///tmp/";
gchar *file_name1 = g_strdup_printf ("curlfilesink_%d", g_random_int ());
gchar *file_name2 = g_strdup_printf ("curlfilesink_%d", g_random_int ());
const gchar *file_content1 = "file content 1\r\n";
g_object_set (G_OBJECT (sink), "file-name", file_name1, NULL);
g_object_get (sink,
- "location", &res_location,
- "file-name", &res_file_name,
- NULL);
+ "location", &res_location, "file-name", &res_file_name, NULL);
fail_unless (strncmp (res_location, location, strlen (location))
== 0);
test_verify_file_data ("/tmp", file_name1, file_content1);
test_verify_file_data ("/tmp", file_name2, file_content2);
}
+
GST_END_TEST;
GST_START_TEST (test_create_dirs)
g_free (sub_dir);
g_free (tmp_dir);
}
+
GST_END_TEST;
GST_START_TEST (test_missing_path)
{
GstElement *sink;
GstCaps *caps;
- const gchar *location= "file:///missing/path/";
+ const gchar *location = "file:///missing/path/";
gchar *file_name = g_strdup_printf ("curlfilesink_%d", g_random_int ());
const gchar *file_content = "line 1\r\n";
gchar *res_location = NULL;
g_object_set (G_OBJECT (sink), "file-name", file_name, NULL);
g_object_get (sink,
- "location", &res_location,
- "file-name", &res_file_name,
- NULL);
+ "location", &res_location, "file-name", &res_file_name, NULL);
fail_unless (strncmp (res_location, location, strlen (location))
== 0);
gst_caps_unref (caps);
cleanup_curlfilesink (sink);
}
+
GST_END_TEST;
static Suite *