Commit 36d069fe authored by Thiago Santos's avatar Thiago Santos

tests: cmmlenc: Port to 0.11

parent 011c3f4d
...@@ -133,13 +133,12 @@ static GstBuffer * ...@@ -133,13 +133,12 @@ static GstBuffer *
buffer_new (const gchar * buffer_data, guint size) buffer_new (const gchar * buffer_data, guint size)
{ {
GstBuffer *buffer; GstBuffer *buffer;
GstCaps *caps; guint8 *data;
buffer = gst_buffer_new_and_alloc (size); data = g_malloc (size);
memcpy (GST_BUFFER_DATA (buffer), buffer_data, size); memcpy (data, buffer_data, size);
caps = gst_caps_from_string (SRC_CAPS);
gst_buffer_set_caps (buffer, caps); buffer = gst_buffer_new_wrapped (data, size);
gst_caps_unref (caps);
return buffer; return buffer;
} }
...@@ -202,6 +201,8 @@ check_output_buffer_is_equal (const gchar * name, ...@@ -202,6 +201,8 @@ check_output_buffer_is_equal (const gchar * name,
const gchar * data, gint refcount) const gchar * data, gint refcount)
{ {
GstBuffer *buffer; GstBuffer *buffer;
gpointer buf_data;
gsize size;
if (current_buf == NULL) if (current_buf == NULL)
current_buf = buffers; current_buf = buffers;
...@@ -210,11 +211,13 @@ check_output_buffer_is_equal (const gchar * name, ...@@ -210,11 +211,13 @@ check_output_buffer_is_equal (const gchar * name,
fail_unless (current_buf != NULL); fail_unless (current_buf != NULL);
buffer = GST_BUFFER (current_buf->data); buffer = GST_BUFFER (current_buf->data);
buf_data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
ASSERT_OBJECT_REFCOUNT (buffer, name, refcount); ASSERT_OBJECT_REFCOUNT (buffer, name, refcount);
fail_unless (memcmp (GST_BUFFER_DATA (buffer), data, fail_unless (memcmp (buf_data, data, size) == 0,
GST_BUFFER_SIZE (buffer)) == 0, "'%s' (%s) is not equal to (%s)", name, buf_data, data);
"'%s' (%s) is not equal to (%s)", name, GST_BUFFER_DATA (buffer), data);
gst_buffer_unmap (buffer, buf_data, size);
} }
static GstFlowReturn static GstFlowReturn
...@@ -229,9 +232,21 @@ push_data (const gchar * name, const gchar * data, gint size) ...@@ -229,9 +232,21 @@ push_data (const gchar * name, const gchar * data, gint size)
return res; return res;
} }
static void
push_caps (void)
{
GstCaps *caps;
caps = gst_caps_from_string (SRC_CAPS);
fail_unless (gst_pad_set_caps (srcpad, caps));
gst_caps_unref (caps);
}
static void static void
check_headers (void) check_headers (void)
{ {
push_caps ();
/* push the cmml start tag */ /* push the cmml start tag */
flow = push_data ("preamble", PREAMBLE, strlen (PREAMBLE)); flow = push_data ("preamble", PREAMBLE, strlen (PREAMBLE));
fail_unless_equals_flow_return (flow, GST_FLOW_OK); fail_unless_equals_flow_return (flow, GST_FLOW_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment