mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
check: Update parser mini-lib to 0.11 API
This commit is contained in:
parent
859312e5a4
commit
a2341918c4
2 changed files with 14 additions and 21 deletions
|
@ -190,7 +190,7 @@ noinst_LTLIBRARIES = libparser.la
|
||||||
libparser_la_SOURCES = elements/parser.c elements/parser.h
|
libparser_la_SOURCES = elements/parser.c elements/parser.h
|
||||||
libparser_la_CFLAGS = \
|
libparser_la_CFLAGS = \
|
||||||
-I$(top_srcdir)/tests/check \
|
-I$(top_srcdir)/tests/check \
|
||||||
$(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS)
|
$(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) -DGST_USE_UNSTABLE_API
|
||||||
|
|
||||||
elements_aacparse_LDADD = libparser.la $(LDADD)
|
elements_aacparse_LDADD = libparser.la $(LDADD)
|
||||||
|
|
||||||
|
|
|
@ -66,16 +66,21 @@ buffer_new (const unsigned char *buffer_data, guint size)
|
||||||
|
|
||||||
buffer = gst_buffer_new_and_alloc (size);
|
buffer = gst_buffer_new_and_alloc (size);
|
||||||
if (buffer_data) {
|
if (buffer_data) {
|
||||||
memcpy (GST_BUFFER_DATA (buffer), buffer_data, size);
|
gst_buffer_fill (buffer, 0, buffer_data, size);
|
||||||
} else {
|
} else {
|
||||||
guint i;
|
guint i;
|
||||||
|
guint8 *data;
|
||||||
|
gsize wantsize = size;
|
||||||
|
|
||||||
|
data = gst_buffer_map (buffer, &wantsize, NULL, GST_MAP_WRITE);
|
||||||
/* Create a recognizable pattern (loop 0x00 -> 0xff) in the data block */
|
/* Create a recognizable pattern (loop 0x00 -> 0xff) in the data block */
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < wantsize; i++) {
|
||||||
GST_BUFFER_DATA (buffer)[i] = i % 0x100;
|
data[i] = i % 0x100;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buffer, data, wantsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (srcpad));
|
/* gst_buffer_set_caps (buffer, GST_PAD_CAPS (srcpad)); */
|
||||||
GST_BUFFER_OFFSET (buffer) = dataoffset;
|
GST_BUFFER_OFFSET (buffer) = dataoffset;
|
||||||
dataoffset += size;
|
dataoffset += size;
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -88,7 +93,7 @@ static void
|
||||||
buffer_count_size (void *buffer, void *user_data)
|
buffer_count_size (void *buffer, void *user_data)
|
||||||
{
|
{
|
||||||
guint *sum = (guint *) user_data;
|
guint *sum = (guint *) user_data;
|
||||||
*sum += GST_BUFFER_SIZE (buffer);
|
*sum += gst_buffer_get_size (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -115,8 +120,8 @@ buffer_verify_data (void *buffer, void *user_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size);
|
fail_unless (gst_buffer_get_size (buffer) == vdata->data_to_verify_size);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), vdata->data_to_verify,
|
fail_unless (gst_buffer_memcmp (buffer, 0, vdata->data_to_verify,
|
||||||
vdata->data_to_verify_size) == 0);
|
vdata->data_to_verify_size) == 0);
|
||||||
|
|
||||||
if (vdata->buffers_before_offset_skip) {
|
if (vdata->buffers_before_offset_skip) {
|
||||||
|
@ -131,14 +136,8 @@ buffer_verify_data (void *buffer, void *user_data)
|
||||||
fail_unless (GST_BUFFER_OFFSET (buffer) == offset_counter);
|
fail_unless (GST_BUFFER_OFFSET (buffer) == offset_counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vdata->caps) {
|
|
||||||
GST_LOG ("%" GST_PTR_FORMAT " = %" GST_PTR_FORMAT " ?",
|
|
||||||
GST_BUFFER_CAPS (buffer), vdata->caps);
|
|
||||||
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), vdata->caps));
|
|
||||||
}
|
|
||||||
|
|
||||||
ts_counter += GST_BUFFER_DURATION (buffer);
|
ts_counter += GST_BUFFER_DURATION (buffer);
|
||||||
offset_counter += GST_BUFFER_SIZE (buffer);
|
offset_counter += gst_buffer_get_size (buffer);
|
||||||
buffer_counter++;
|
buffer_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,14 +246,8 @@ gst_parser_test_run (GstParserTest * test, GstCaps ** out_caps)
|
||||||
if (!k)
|
if (!k)
|
||||||
buffer = buffer_new (test->series[j].data, test->series[j].size);
|
buffer = buffer_new (test->series[j].data, test->series[j].size);
|
||||||
else {
|
else {
|
||||||
GstCaps *caps = gst_buffer_get_caps (buffer);
|
|
||||||
|
|
||||||
buffer = gst_buffer_join (buffer,
|
buffer = gst_buffer_join (buffer,
|
||||||
buffer_new (test->series[j].data, test->series[j].size));
|
buffer_new (test->series[j].data, test->series[j].size));
|
||||||
if (caps) {
|
|
||||||
gst_buffer_set_caps (buffer, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail_unless_equals_int (gst_pad_push (srcpad, buffer), GST_FLOW_OK);
|
fail_unless_equals_int (gst_pad_push (srcpad, buffer), GST_FLOW_OK);
|
||||||
|
|
Loading…
Reference in a new issue