mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
tests: fix more unit tests
This commit is contained in:
parent
492a9a72fb
commit
3de090c1f0
17 changed files with 324 additions and 275 deletions
|
@ -264,6 +264,13 @@ libs_vc1parser_LDADD = \
|
|||
$(GST_PLUGINS_BAD_LIBS) -lgstcodecparsers-@GST_MAJORMINOR@ \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
|
||||
|
||||
elements_faad_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
|
||||
elements_faad_LDADD = \
|
||||
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) \
|
||||
-lgstaudio-@GST_MAJORMINOR@
|
||||
|
||||
elements_faac_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
|
||||
|
|
|
@ -217,7 +217,7 @@ GST_START_TEST (test_assrender_basic_##format) \
|
|||
gst_app_src_set_caps (GST_APP_SRC (appsrc), text_caps); \
|
||||
g_object_set (appsrc, "format", GST_FORMAT_TIME, NULL); \
|
||||
pad = gst_element_get_static_pad (appsrc, "src"); \
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, src_buffer_probe_cb, \
|
||||
probe_id = gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, src_buffer_probe_cb, \
|
||||
gst_object_ref (blocked_pad), (GDestroyNotify) gst_object_unref); \
|
||||
gst_object_unref (blocked_pad); \
|
||||
gst_object_unref (pad); \
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
static GstPad *mysrcpad, *mysinkpad;
|
||||
|
||||
#define AUDIO_CAPS_STRING "audio/x-raw, " \
|
||||
"format = (string) " GST_AUDIO_NE (S16) \
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "\
|
||||
"layout = (string) interleaved, " \
|
||||
"rate = (int) 48000, " \
|
||||
"channels = (int) 2, " \
|
||||
|
|
|
@ -23,19 +23,18 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
/* For ease of programming we use globals to keep refs for our floating
|
||||
* src and sink pads we create; otherwise we always have to do get_pad,
|
||||
* get_peer, and then remove references in every test function */
|
||||
static GstPad *mysrcpad, *mysinkpad;
|
||||
|
||||
#define AUDIO_CAPS_STRING "audio/x-raw-int, " \
|
||||
#define AUDIO_CAPS_STRING "audio/x-raw, " \
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", " \
|
||||
"rate = (int) 48000, " \
|
||||
"channels = (int) 2, " \
|
||||
"width = (int) 16, " \
|
||||
"depth = (int) 16, " \
|
||||
"signed = (boolean) true, " \
|
||||
"endianness = (int) BYTE_ORDER "
|
||||
"channel-mask = (bitmask) 3"
|
||||
|
||||
#define AAC_CAPS_STRING "audio/mpeg, " \
|
||||
"mpegversion = (int) 4, " \
|
||||
|
|
|
@ -97,19 +97,22 @@ verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
|||
gint i = vdata->buffer_counter;
|
||||
|
||||
fail_unless (i <= 1);
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == ctx_headers[i].size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[i].data,
|
||||
GST_BUFFER_SIZE (buffer)) == 0);
|
||||
fail_unless (gst_buffer_get_size (buffer) == ctx_headers[i].size);
|
||||
fail_unless (gst_buffer_memcmp (buffer, 0, ctx_headers[i].data,
|
||||
gst_buffer_get_size (buffer)) == 0);
|
||||
} else {
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) > 4);
|
||||
GstMapInfo map;
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
fail_unless (map.size > 4);
|
||||
/* only need to check avc output case */
|
||||
if (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x01)
|
||||
if (GST_READ_UINT32_BE (map.data) == 0x01)
|
||||
return FALSE;
|
||||
/* header is merged in initial frame */
|
||||
if (vdata->buffer_counter == 0) {
|
||||
guint8 *data = GST_BUFFER_DATA (buffer);
|
||||
guint8 *data = map.data;
|
||||
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size +
|
||||
fail_unless (map.size == vdata->data_to_verify_size +
|
||||
ctx_headers[0].size + ctx_headers[1].size);
|
||||
fail_unless (GST_READ_UINT32_BE (data) == ctx_headers[0].size - 4);
|
||||
fail_unless (memcmp (data + 4, ctx_headers[0].data + 4,
|
||||
|
@ -123,12 +126,12 @@ verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
|||
fail_unless (memcmp (data + 4, vdata->data_to_verify + 4,
|
||||
vdata->data_to_verify_size - 4) == 0);
|
||||
} else {
|
||||
fail_unless (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) ==
|
||||
GST_BUFFER_SIZE (buffer) - 4);
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4,
|
||||
vdata->data_to_verify + 4, GST_BUFFER_SIZE (buffer) - 4) == 0);
|
||||
fail_unless (GST_READ_UINT32_BE (map.data) == map.size - 4);
|
||||
fail_unless (map.size == vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (map.data + 4, vdata->data_to_verify + 4,
|
||||
map.size - 4) == 0);
|
||||
}
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -209,9 +212,9 @@ GST_START_TEST (test_parse_detect_stream)
|
|||
fail_unless (val != NULL);
|
||||
buf = gst_value_get_buffer (val);
|
||||
fail_unless (buf != NULL);
|
||||
fail_unless (GST_BUFFER_SIZE (buf) == sizeof (h264_codec_data));
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buf), h264_codec_data,
|
||||
GST_BUFFER_SIZE (buf)) == 0);
|
||||
fail_unless (gst_buffer_get_size (buf) == sizeof (h264_codec_data));
|
||||
fail_unless (gst_buffer_memcmp (buf, 0, h264_codec_data,
|
||||
gst_buffer_get_size (buf)) == 0);
|
||||
}
|
||||
|
||||
gst_caps_unref (caps);
|
||||
|
@ -240,8 +243,12 @@ h264parse_suite (void)
|
|||
static gboolean
|
||||
verify_buffer_packetized (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
||||
{
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) > 4);
|
||||
fail_unless (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x01);
|
||||
GstMapInfo map;
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
|
||||
fail_unless (map.size > 4);
|
||||
fail_unless (GST_READ_UINT32_BE (map.data) == 0x01);
|
||||
if (vdata->discard) {
|
||||
/* check separate header NALs */
|
||||
guint8 *data;
|
||||
|
@ -255,14 +262,14 @@ verify_buffer_packetized (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
|||
size = sizeof (h264_pps);
|
||||
}
|
||||
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4, data + 4,
|
||||
size - 4) == 0);
|
||||
fail_unless (map.size == size);
|
||||
fail_unless (memcmp (map.data + 4, data + 4, size - 4) == 0);
|
||||
} else {
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4,
|
||||
vdata->data_to_verify + 4, GST_BUFFER_SIZE (buffer) - 4) == 0);
|
||||
fail_unless (map.size == vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (map.data + 4,
|
||||
vdata->data_to_verify + 4, map.size - 4) == 0);
|
||||
}
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -282,9 +289,9 @@ GST_START_TEST (test_parse_packetized)
|
|||
|
||||
/* some caps messing */
|
||||
caps = gst_caps_from_string (SRC_CAPS_TMPL);
|
||||
cdata = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (cdata) = h264_codec_data;
|
||||
GST_BUFFER_SIZE (cdata) = sizeof (h264_codec_data);
|
||||
cdata =
|
||||
gst_buffer_new_wrapped_full (h264_codec_data, NULL, 0,
|
||||
sizeof (h264_codec_data));
|
||||
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, cdata, NULL);
|
||||
gst_buffer_unref (cdata);
|
||||
desc = gst_caps_to_string (caps);
|
||||
|
|
|
@ -64,7 +64,7 @@ test_taglib_id3mux_create_tags (guint32 mask)
|
|||
{
|
||||
GstTagList *tags;
|
||||
|
||||
tags = gst_tag_list_new ();
|
||||
tags = gst_tag_list_new_empty ();
|
||||
|
||||
if (mask & (1 << 0)) {
|
||||
gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
|
||||
|
@ -131,6 +131,7 @@ utf_string_in_buf (GstBuffer * buf, const gchar * s, int v2version)
|
|||
{
|
||||
gint i, len;
|
||||
gchar *free_str = NULL;
|
||||
GstMapInfo map;
|
||||
|
||||
if (v2version == 3) {
|
||||
free_str = g_convert (s, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL);
|
||||
|
@ -138,12 +139,15 @@ utf_string_in_buf (GstBuffer * buf, const gchar * s, int v2version)
|
|||
}
|
||||
|
||||
len = strlen (s);
|
||||
for (i = 0; i < (GST_BUFFER_SIZE (buf) - len); ++i) {
|
||||
if (memcmp (GST_BUFFER_DATA (buf) + i, s, len) == 0) {
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
for (i = 0; i < (map.size - len); ++i) {
|
||||
if (memcmp (map.data + i, s, len) == 0) {
|
||||
gst_buffer_unmap (buf, &map);
|
||||
g_free (free_str);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
g_free (free_str);
|
||||
return FALSE;
|
||||
|
@ -273,92 +277,79 @@ static void
|
|||
fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad,
|
||||
guint64 * p_offset)
|
||||
{
|
||||
fail_unless (GST_BUFFER_SIZE (buf) == MP3_FRAME_SIZE);
|
||||
fail_unless (gst_buffer_get_size (buf) == MP3_FRAME_SIZE);
|
||||
|
||||
GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT,
|
||||
*p_offset);
|
||||
|
||||
memcpy (GST_BUFFER_DATA (buf), mp3_dummyhdr, sizeof (mp3_dummyhdr));
|
||||
gst_buffer_fill (buf, 0, mp3_dummyhdr, sizeof (mp3_dummyhdr));
|
||||
|
||||
#if 0
|
||||
/* can't use gst_buffer_set_caps() here because the metadata isn't writable
|
||||
* because of the extra refcounts taken by the signal emission mechanism;
|
||||
* we know it's fine to use GST_BUFFER_CAPS() here though */
|
||||
GST_BUFFER_CAPS (buf) = gst_caps_new_simple ("audio/mpeg", "mpegversion",
|
||||
G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
|
||||
#endif
|
||||
|
||||
GST_BUFFER_OFFSET (buf) = *p_offset;
|
||||
*p_offset += GST_BUFFER_SIZE (buf);
|
||||
*p_offset += gst_buffer_get_size (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
|
||||
GstBuffer ** p_buf)
|
||||
{
|
||||
GstMapInfo map;
|
||||
gint64 off;
|
||||
guint size;
|
||||
|
||||
off = GST_BUFFER_OFFSET (buf);
|
||||
size = GST_BUFFER_SIZE (buf);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
size = map.size;
|
||||
|
||||
GST_LOG ("got buffer, size=%u, offset=%" G_GINT64_FORMAT, size, off);
|
||||
|
||||
fail_unless (GST_BUFFER_OFFSET_IS_VALID (buf));
|
||||
|
||||
if (*p_buf == NULL || (off + size) > GST_BUFFER_SIZE (*p_buf)) {
|
||||
if (*p_buf == NULL || (off + size) > gst_buffer_get_size (*p_buf)) {
|
||||
GstBuffer *newbuf;
|
||||
|
||||
/* not very elegant, but who cares */
|
||||
newbuf = gst_buffer_new_and_alloc (off + size);
|
||||
if (*p_buf) {
|
||||
memcpy (GST_BUFFER_DATA (newbuf), GST_BUFFER_DATA (*p_buf),
|
||||
GST_BUFFER_SIZE (*p_buf));
|
||||
GstMapInfo pmap;
|
||||
|
||||
gst_buffer_map (*p_buf, &pmap, GST_MAP_READ);
|
||||
gst_buffer_fill (newbuf, 0, pmap.data, pmap.size);
|
||||
gst_buffer_unmap (*p_buf, &pmap);
|
||||
}
|
||||
memcpy (GST_BUFFER_DATA (newbuf) + off, GST_BUFFER_DATA (buf), size);
|
||||
gst_buffer_fill (newbuf, off, map.data, size);
|
||||
|
||||
if (*p_buf)
|
||||
gst_buffer_unref (*p_buf);
|
||||
*p_buf = newbuf;
|
||||
} else {
|
||||
memcpy (GST_BUFFER_DATA (*p_buf) + off, GST_BUFFER_DATA (buf), size);
|
||||
gst_buffer_fill (*p_buf, off, map.data, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
demux_pad_added (GstElement * id3demux, GstPad * srcpad, GstBuffer ** p_outbuf)
|
||||
{
|
||||
GstElement *fakesink, *pipeline;
|
||||
|
||||
GST_LOG ("id3demux added source pad with caps %" GST_PTR_FORMAT,
|
||||
GST_PAD_CAPS (srcpad));
|
||||
|
||||
pipeline = id3demux;
|
||||
while (GST_OBJECT_PARENT (pipeline) != NULL)
|
||||
pipeline = (GstElement *) GST_OBJECT_PARENT (pipeline);
|
||||
|
||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
||||
g_assert (fakesink != NULL);
|
||||
|
||||
/* set up sink */
|
||||
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
|
||||
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), p_outbuf);
|
||||
|
||||
gst_bin_add (GST_BIN (pipeline), fakesink);
|
||||
gst_element_set_state (fakesink, GST_STATE_PLAYING);
|
||||
|
||||
fail_unless (gst_element_link (id3demux, fakesink));
|
||||
gst_buffer_unmap (buf, &map);
|
||||
}
|
||||
|
||||
static void
|
||||
test_taglib_id3mux_check_output_buffer (GstBuffer * buf)
|
||||
{
|
||||
guint8 *data = GST_BUFFER_DATA (buf);
|
||||
guint size = GST_BUFFER_SIZE (buf);
|
||||
GstMapInfo map;
|
||||
guint off;
|
||||
|
||||
g_assert (size % MP3_FRAME_SIZE == 0);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
|
||||
for (off = 0; off < size; off += MP3_FRAME_SIZE) {
|
||||
fail_unless (memcmp (data + off, mp3_dummyhdr, sizeof (mp3_dummyhdr)) == 0);
|
||||
g_assert (map.size % MP3_FRAME_SIZE == 0);
|
||||
|
||||
for (off = 0; off < map.size; off += MP3_FRAME_SIZE) {
|
||||
fail_unless (memcmp (map.data + off, mp3_dummyhdr,
|
||||
sizeof (mp3_dummyhdr)) == 0);
|
||||
}
|
||||
gst_buffer_unmap (buf, &map);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -374,7 +365,7 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask, int v2version)
|
|||
{
|
||||
GstMessage *msg;
|
||||
GstTagList *tags_read = NULL;
|
||||
GstElement *pipeline, *id3mux, *id3demux, *fakesrc, *identity;
|
||||
GstElement *pipeline, *id3mux, *id3demux, *fakesrc, *identity, *fakesink;
|
||||
GstBus *bus;
|
||||
guint64 offset;
|
||||
GstBuffer *outbuf = NULL;
|
||||
|
@ -397,19 +388,24 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask, int v2version)
|
|||
id3demux = gst_element_factory_make ("id3demux", "id3demux");
|
||||
g_assert (id3demux != NULL);
|
||||
|
||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
||||
g_assert (fakesink != NULL);
|
||||
|
||||
/* set up sink */
|
||||
outbuf = NULL;
|
||||
g_signal_connect (id3demux, "pad-added",
|
||||
G_CALLBACK (demux_pad_added), &outbuf);
|
||||
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
|
||||
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), &outbuf);
|
||||
|
||||
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), id3mux);
|
||||
gst_bin_add (GST_BIN (pipeline), identity);
|
||||
gst_bin_add (GST_BIN (pipeline), id3demux);
|
||||
gst_bin_add (GST_BIN (pipeline), fakesink);
|
||||
|
||||
gst_tag_setter_merge_tags (GST_TAG_SETTER (id3mux), tags,
|
||||
GST_TAG_MERGE_APPEND);
|
||||
|
||||
gst_element_link_many (fakesrc, id3mux, identity, id3demux, NULL);
|
||||
gst_element_link_many (fakesrc, id3mux, identity, id3demux, fakesink, NULL);
|
||||
|
||||
/* set up source */
|
||||
g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE,
|
||||
|
@ -547,7 +543,7 @@ id3mux_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
if (gst_default_registry_check_feature_version ("id3demux",
|
||||
if (gst_registry_check_feature_version (gst_registry_get (), "id3demux",
|
||||
GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) {
|
||||
tcase_add_test (tc_chain, test_id3mux_v2_3);
|
||||
tcase_add_test (tc_chain, test_id3mux_v2_4);
|
||||
|
|
|
@ -887,6 +887,7 @@ check_content (ExifContent * content, void *user_data)
|
|||
}
|
||||
break;
|
||||
case EXIF_TYPE_UNDEFINED:{
|
||||
GstMapInfo map;
|
||||
GstBuffer *buf;
|
||||
gint i;
|
||||
|
||||
|
@ -895,10 +896,12 @@ check_content (ExifContent * content, void *user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
fail_unless (entry->size, GST_BUFFER_SIZE (buf));
|
||||
for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
|
||||
fail_unless (GST_BUFFER_DATA (buf)[i] == (guint8) entry->data[i]);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
fail_unless (entry->size, map.size);
|
||||
for (i = 0; i < map.size; i++) {
|
||||
fail_unless (map.data[i] == (guint8) entry->data[i]);
|
||||
}
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
test_data->result = TRUE;
|
||||
gst_buffer_unref (buf);
|
||||
|
@ -972,7 +975,7 @@ generate_jif_file_with_tags (const gchar * tags, const gchar * filepath)
|
|||
{
|
||||
GstTagList *taglist;
|
||||
|
||||
taglist = gst_structure_from_string (tags, NULL);
|
||||
taglist = gst_tag_list_new_from_string (tags);
|
||||
generate_jif_file_with_tags_from_taglist (taglist, filepath);
|
||||
|
||||
gst_tag_list_free (taglist);
|
||||
|
@ -1004,7 +1007,7 @@ libexif_check_tags (const gchar * tags, const gchar * filepath)
|
|||
{
|
||||
GstTagList *taglist;
|
||||
|
||||
taglist = gst_structure_from_string (tags, NULL);
|
||||
taglist = gst_tag_list_new_from_string (tags);
|
||||
fail_unless (taglist != NULL);
|
||||
|
||||
libexif_check_tags_from_taglist (taglist, filepath);
|
||||
|
@ -1019,6 +1022,7 @@ GST_START_TEST (test_jifmux_tags)
|
|||
GstTagList *taglist;
|
||||
GstDateTime *datetime;
|
||||
GstBuffer *buffer;
|
||||
GstMapInfo map;
|
||||
gint i;
|
||||
|
||||
gst_tag_register_musicbrainz_tags ();
|
||||
|
@ -1029,10 +1033,13 @@ GST_START_TEST (test_jifmux_tags)
|
|||
|
||||
datetime = gst_date_time_new_local_time (2000, 10, 5, 8, 45, 13);
|
||||
buffer = gst_buffer_new_and_alloc (100);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
for (i = 0; i < 100; i++) {
|
||||
GST_BUFFER_DATA (buffer)[i] = i;
|
||||
map.data[i] = i;
|
||||
}
|
||||
taglist = gst_tag_list_new_full (GST_TAG_ARTIST, "some artist",
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
taglist = gst_tag_list_new (GST_TAG_ARTIST, "some artist",
|
||||
GST_TAG_COPYRIGHT, "My copyright notice",
|
||||
GST_TAG_DEVICE_MANUFACTURER, "MyFavoriteBrand",
|
||||
GST_TAG_DEVICE_MODEL, "123v42.1",
|
||||
|
@ -1209,7 +1216,7 @@ GST_START_TEST (test_jifmux_tags)
|
|||
GST_END_TEST;
|
||||
|
||||
#define HAVE_ELEMENT(name) \
|
||||
gst_default_registry_check_feature_version (name,\
|
||||
gst_registry_check_feature_version (gst_registry_get (), name,\
|
||||
GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)
|
||||
|
||||
static Suite *
|
||||
|
|
|
@ -154,16 +154,10 @@ static GList *
|
|||
_make_buffers_in (GList * buffer_in, guint8 * test_data, gsize test_data_size)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
GstCaps *caps;
|
||||
gsize i;
|
||||
|
||||
for (i = 0; i < test_data_size; i++) {
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_set_data (buffer, test_data + i, 1);
|
||||
caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE,
|
||||
NULL);
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
buffer = gst_buffer_new_wrapped_full (test_data + i, NULL, 0, 1);
|
||||
buffer_in = g_list_append (buffer_in, buffer);
|
||||
}
|
||||
return buffer_in;
|
||||
|
@ -176,17 +170,10 @@ static GList *
|
|||
_make_buffers_out (GList * buffer_out, guint8 * test_data, gsize test_data_size)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
GstCaps *caps;
|
||||
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_set_data (buffer, test_data, test_data_size);
|
||||
|
||||
caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
buffer = gst_buffer_new_wrapped_full (test_data, NULL, 0, test_data_size);
|
||||
buffer_out = g_list_append (buffer_out, buffer);
|
||||
|
||||
return buffer_out;
|
||||
}
|
||||
|
||||
|
@ -196,6 +183,12 @@ _make_buffers_out (GList * buffer_out, guint8 * test_data, gsize test_data_size)
|
|||
GST_START_TEST (test_parse_single_byte)
|
||||
{
|
||||
GList *buffer_in = NULL, *buffer_out = NULL;
|
||||
GstCaps *caps_in, *caps_out;
|
||||
|
||||
caps_in = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE,
|
||||
NULL);
|
||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
|
||||
|
||||
/* Push the data byte by byte, injecting some garbage. */
|
||||
buffer_in = make_buffers_in (buffer_in, test_data_garbage);
|
||||
|
@ -210,8 +203,11 @@ GST_START_TEST (test_parse_single_byte)
|
|||
buffer_out = make_buffers_out (buffer_out, test_data_normal_frame);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_entropy);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_extra_ff);
|
||||
gst_check_element_push_buffer_list ("jpegparse", buffer_in, buffer_out,
|
||||
GST_FLOW_OK);
|
||||
gst_check_element_push_buffer_list ("jpegparse", buffer_in, caps_in,
|
||||
buffer_out, caps_out, GST_FLOW_OK);
|
||||
|
||||
gst_caps_unref (caps_in);
|
||||
gst_caps_unref (caps_out);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -224,7 +220,7 @@ GST_START_TEST (test_parse_all_in_one_buf)
|
|||
GstBuffer *buffer = NULL;
|
||||
gsize total_size = 0;
|
||||
gsize offset = 0;
|
||||
GstCaps *caps;
|
||||
GstCaps *caps_in, *caps_out;
|
||||
|
||||
/* Push the data in a single buffer, injecting some garbage. */
|
||||
total_size += sizeof (test_data_garbage);
|
||||
|
@ -235,41 +231,44 @@ GST_START_TEST (test_parse_all_in_one_buf)
|
|||
total_size += sizeof (test_data_entropy);
|
||||
total_size += sizeof (test_data_extra_ff);
|
||||
buffer = gst_buffer_new_and_alloc (total_size);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_garbage,
|
||||
gst_buffer_fill (buffer, offset, test_data_garbage,
|
||||
sizeof (test_data_garbage));
|
||||
offset += sizeof (test_data_garbage);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_short_frame,
|
||||
gst_buffer_fill (buffer, offset, test_data_short_frame,
|
||||
sizeof (test_data_short_frame));
|
||||
offset += sizeof (test_data_short_frame);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_garbage,
|
||||
gst_buffer_fill (buffer, offset, test_data_garbage,
|
||||
sizeof (test_data_garbage));
|
||||
offset += sizeof (test_data_garbage);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_normal_frame,
|
||||
gst_buffer_fill (buffer, offset, test_data_normal_frame,
|
||||
sizeof (test_data_normal_frame));
|
||||
offset += sizeof (test_data_normal_frame);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_ff,
|
||||
sizeof (test_data_ff));
|
||||
gst_buffer_fill (buffer, offset, test_data_ff, sizeof (test_data_ff));
|
||||
offset += sizeof (test_data_ff);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_entropy,
|
||||
gst_buffer_fill (buffer, offset, test_data_entropy,
|
||||
sizeof (test_data_entropy));
|
||||
offset += sizeof (test_data_entropy);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_extra_ff,
|
||||
gst_buffer_fill (buffer, offset, test_data_extra_ff,
|
||||
sizeof (test_data_extra_ff));
|
||||
offset += sizeof (test_data_extra_ff);
|
||||
|
||||
caps = gst_caps_new_simple ("image/jpeg", "parsed",
|
||||
caps_in = gst_caps_new_simple ("image/jpeg", "parsed",
|
||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
GST_LOG ("Pushing single buffer of %u bytes.", (guint) total_size);
|
||||
buffer_in = g_list_append (buffer_in, buffer);
|
||||
|
||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_short_frame);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_normal_frame);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_entropy);
|
||||
buffer_out = make_buffers_out (buffer_out, test_data_extra_ff);
|
||||
gst_check_element_push_buffer_list ("jpegparse", buffer_in, buffer_out,
|
||||
GST_FLOW_OK);
|
||||
|
||||
gst_check_element_push_buffer_list ("jpegparse", buffer_in, caps_in,
|
||||
buffer_out, caps_out, GST_FLOW_OK);
|
||||
|
||||
gst_caps_unref (caps_in);
|
||||
gst_caps_unref (caps_out);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -279,7 +278,6 @@ make_my_input_buffer (guint8 * test_data_header, gsize test_data_size)
|
|||
{
|
||||
GstBuffer *buffer;
|
||||
gsize total_size = 0, offset = 0;
|
||||
GstCaps *caps;
|
||||
|
||||
total_size += sizeof (test_data_soi);
|
||||
total_size += test_data_size;
|
||||
|
@ -288,41 +286,28 @@ make_my_input_buffer (guint8 * test_data_header, gsize test_data_size)
|
|||
|
||||
buffer = gst_buffer_new_and_alloc (total_size);
|
||||
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_soi,
|
||||
sizeof (test_data_soi));
|
||||
gst_buffer_fill (buffer, offset, test_data_soi, sizeof (test_data_soi));
|
||||
offset += sizeof (test_data_soi);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_header, test_data_size);
|
||||
gst_buffer_fill (buffer, offset, test_data_header, test_data_size);
|
||||
offset += test_data_size;
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_sof0,
|
||||
sizeof (test_data_sof0));
|
||||
gst_buffer_fill (buffer, offset, test_data_sof0, sizeof (test_data_sof0));
|
||||
offset += sizeof (test_data_sof0);
|
||||
memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_eoi,
|
||||
sizeof (test_data_eoi));
|
||||
gst_buffer_fill (buffer, offset, test_data_eoi, sizeof (test_data_eoi));
|
||||
offset += sizeof (test_data_eoi);
|
||||
|
||||
caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE,
|
||||
NULL);
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline GstBuffer *
|
||||
make_my_output_buffer (const GstBuffer * buffer_in)
|
||||
make_my_output_buffer (GstBuffer * buffer_in)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
GstCaps *caps;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new ();
|
||||
caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, "format", GST_TYPE_FOURCC,
|
||||
GST_MAKE_FOURCC ('I', '4', '2', '0'), "interlaced", G_TYPE_BOOLEAN, FALSE,
|
||||
"width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
|
||||
gst_buffer_set_data (buffer, GST_BUFFER_DATA (buffer_in),
|
||||
GST_BUFFER_SIZE (buffer_in));
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
gst_buffer_map (buffer_in, &map, GST_MAP_READ);
|
||||
gst_buffer_fill (buffer, 0, map.data, map.size);
|
||||
gst_buffer_unmap (buffer_in, &map);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -331,12 +316,25 @@ make_my_output_buffer (const GstBuffer * buffer_in)
|
|||
GST_START_TEST (test_parse_app1_exif)
|
||||
{
|
||||
GstBuffer *buffer_in, *buffer_out;
|
||||
GstCaps *caps_in, *caps_out;
|
||||
|
||||
caps_in = gst_caps_new_simple ("image/jpeg", "parsed",
|
||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
|
||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
|
||||
"I420", "interlaced", G_TYPE_BOOLEAN, FALSE,
|
||||
"width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
|
||||
|
||||
buffer_in = make_my_input_buffer (test_data_app1_exif,
|
||||
sizeof (test_data_app1_exif));
|
||||
buffer_out = make_my_output_buffer (buffer_in);
|
||||
|
||||
gst_check_element_push_buffer ("jpegparse", buffer_in, buffer_out);
|
||||
gst_check_element_push_buffer ("jpegparse", buffer_in, caps_in, buffer_out,
|
||||
caps_out);
|
||||
|
||||
gst_caps_unref (caps_in);
|
||||
gst_caps_unref (caps_out);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -344,12 +342,25 @@ GST_END_TEST;
|
|||
GST_START_TEST (test_parse_comment)
|
||||
{
|
||||
GstBuffer *buffer_in, *buffer_out;
|
||||
GstCaps *caps_in, *caps_out;
|
||||
|
||||
caps_in = gst_caps_new_simple ("image/jpeg", "parsed",
|
||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
|
||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||
"framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
|
||||
"I420", "interlaced", G_TYPE_BOOLEAN, FALSE,
|
||||
"width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
|
||||
|
||||
buffer_in = make_my_input_buffer (test_data_comment,
|
||||
sizeof (test_data_comment));
|
||||
buffer_out = make_my_output_buffer (buffer_in);
|
||||
|
||||
gst_check_element_push_buffer ("jpegparse", buffer_in, buffer_out);
|
||||
gst_check_element_push_buffer ("jpegparse", buffer_in, caps_in, buffer_out,
|
||||
caps_out);
|
||||
|
||||
gst_caps_unref (caps_in);
|
||||
gst_caps_unref (caps_out);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
* get_peer, and then remove references in every test function */
|
||||
static GstPad *mysrcpad, *mysinkpad;
|
||||
|
||||
#define VIDEO_CAPS_STRING "video/x-raw-yuv, " \
|
||||
#define VIDEO_CAPS_STRING "video/x-raw, " \
|
||||
"format = (string) I420, " \
|
||||
"width = (int) 384, " \
|
||||
"height = (int) 288, " \
|
||||
"framerate = (fraction) 25/1"
|
||||
|
|
|
@ -62,17 +62,22 @@ static guint8 mpeg4_iframe[] = {
|
|||
static gboolean
|
||||
verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
||||
{
|
||||
GstMapInfo map;
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
|
||||
/* header is merged in initial frame */
|
||||
if (vdata->buffer_counter == 0) {
|
||||
/* the whole sequence header is included */
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) ==
|
||||
ctx_headers[0].size + vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data,
|
||||
fail_unless (map.size == ctx_headers[0].size + vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (map.data, ctx_headers[0].data,
|
||||
ctx_headers[0].size) == 0);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + ctx_headers[0].size,
|
||||
fail_unless (memcmp (map.data + ctx_headers[0].size,
|
||||
vdata->data_to_verify, vdata->data_to_verify_size) == 0);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
return TRUE;
|
||||
}
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -112,6 +117,7 @@ GST_START_TEST (test_parse_detect_stream)
|
|||
GstStructure *s;
|
||||
GstBuffer *buf;
|
||||
const GValue *val;
|
||||
GstMapInfo map;
|
||||
|
||||
caps = gst_parser_test_get_output_caps (mpeg4_iframe, sizeof (mpeg4_iframe),
|
||||
NULL);
|
||||
|
@ -133,9 +139,10 @@ GST_START_TEST (test_parse_detect_stream)
|
|||
buf = gst_value_get_buffer (val);
|
||||
fail_unless (buf != NULL);
|
||||
/* codec-data == config header - GOP */
|
||||
fail_unless (GST_BUFFER_SIZE (buf) == sizeof (mpeg4_config) - 7);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buf), mpeg4_config,
|
||||
GST_BUFFER_SIZE (buf)) == 0);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
fail_unless (map.size == sizeof (mpeg4_config) - 7);
|
||||
fail_unless (memcmp (map.data, mpeg4_config, map.size) == 0);
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef struct _ThreadData
|
|||
} ThreadData;
|
||||
|
||||
static gboolean
|
||||
src_event (GstPad * pad, GstEvent * event)
|
||||
src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||
{
|
||||
TestData *data = (TestData *) gst_pad_get_element_private (pad);
|
||||
|
||||
|
@ -72,7 +72,7 @@ src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
sink_event (GstPad * pad, GstEvent * event)
|
||||
sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||
{
|
||||
TestData *data = (TestData *) gst_pad_get_element_private (pad);
|
||||
|
||||
|
@ -111,7 +111,7 @@ link_sinks (GstElement * mpegtsmux,
|
|||
mux_sink3 = gst_element_get_request_pad (mpegtsmux, "sink_3");
|
||||
fail_unless (gst_pad_link (*src3, mux_sink3) == GST_PAD_LINK_OK);
|
||||
|
||||
caps = gst_caps_new_simple ("video/x-h264", NULL);
|
||||
caps = gst_caps_new_empty_simple ("video/x-h264");
|
||||
gst_pad_set_caps (mux_sink1, caps);
|
||||
gst_pad_set_caps (mux_sink2, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
@ -185,7 +185,7 @@ GST_START_TEST (test_force_key_unit_event_downstream)
|
|||
|
||||
/* hack: make sure collectpads builds collect->data */
|
||||
gst_pad_push_event (src1, gst_event_new_flush_start ());
|
||||
gst_pad_push_event (src1, gst_event_new_flush_stop ());
|
||||
gst_pad_push_event (src1, gst_event_new_flush_stop (FALSE));
|
||||
|
||||
/* send a force-key-unit event with running_time=2s */
|
||||
timestamp = stream_time = running_time = 2 * GST_SECOND;
|
||||
|
@ -250,7 +250,7 @@ GST_START_TEST (test_force_key_unit_event_upstream)
|
|||
|
||||
/* hack: make sure collectpads builds collect->data */
|
||||
gst_pad_push_event (src1, gst_event_new_flush_start ());
|
||||
gst_pad_push_event (src1, gst_event_new_flush_stop ());
|
||||
gst_pad_push_event (src1, gst_event_new_flush_stop (FALSE));
|
||||
|
||||
/* send an upstream force-key-unit event with running_time=2s */
|
||||
timestamp = stream_time = running_time = 2 * GST_SECOND;
|
||||
|
|
|
@ -71,36 +71,40 @@ static guint8 mpeg2_iframe[] = {
|
|||
static gboolean
|
||||
verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer)
|
||||
{
|
||||
GstMapInfo map;
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
|
||||
/* check initial header special case, otherwise delegate to default */
|
||||
if (vdata->discard) {
|
||||
/* header is separate */
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == ctx_headers[0].size - 8);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data,
|
||||
GST_BUFFER_SIZE (buffer)) == 0);
|
||||
fail_unless (map.size == ctx_headers[0].size - 8);
|
||||
fail_unless (memcmp (map.data, ctx_headers[0].data, map.size) == 0);
|
||||
} else {
|
||||
/* header is merged in initial frame */
|
||||
if (vdata->buffer_counter == 0) {
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) > 4);
|
||||
if (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x1b3) {
|
||||
fail_unless (map.size > 4);
|
||||
if (GST_READ_UINT32_BE (map.data) == 0x1b3) {
|
||||
/* the whole sequence header is included */
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) ==
|
||||
fail_unless (map.size ==
|
||||
ctx_headers[0].size + vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data,
|
||||
fail_unless (memcmp (map.data, ctx_headers[0].data,
|
||||
ctx_headers[0].size) == 0);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + ctx_headers[0].size,
|
||||
fail_unless (memcmp (map.data + ctx_headers[0].size,
|
||||
vdata->data_to_verify, vdata->data_to_verify_size) == 0);
|
||||
} else {
|
||||
/* sequence was separate, only gop here */
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) ==
|
||||
8 + vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer),
|
||||
fail_unless (map.size == 8 + vdata->data_to_verify_size);
|
||||
fail_unless (memcmp (map.data,
|
||||
ctx_headers[0].data + ctx_headers[0].size - 8, 8) == 0);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 8,
|
||||
fail_unless (memcmp (map.data + 8,
|
||||
vdata->data_to_verify, vdata->data_to_verify_size) == 0);
|
||||
}
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -158,6 +162,7 @@ mpeg_video_parse_check_caps (guint version, guint8 * seq, gint size)
|
|||
GstStructure *s;
|
||||
GstBuffer *buf;
|
||||
const GValue *val;
|
||||
GstMapInfo map;
|
||||
|
||||
ctx_headers[0].data = seq;
|
||||
ctx_headers[0].size = size;
|
||||
|
@ -182,10 +187,11 @@ mpeg_video_parse_check_caps (guint version, guint8 * seq, gint size)
|
|||
fail_unless (val != NULL);
|
||||
buf = gst_value_get_buffer (val);
|
||||
fail_unless (buf != NULL);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
/* codec-data = header - GOP */
|
||||
assert_equals_int (GST_BUFFER_SIZE (buf), size - 8);
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buf), seq + 4,
|
||||
GST_BUFFER_SIZE (buf)) == 0);
|
||||
assert_equals_int (map.size, size - 8);
|
||||
fail_unless (memcmp (map.data, seq + 4, map.size) == 0);
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
|
|
@ -172,13 +172,13 @@ gst_multifdsink_create_streamheader (const gchar * data1,
|
|||
fail_if (hbuf2 == NULL);
|
||||
fail_if (caps == NULL);
|
||||
|
||||
/* create caps with streamheader, set the caps, and push the IN_CAPS
|
||||
/* create caps with streamheader, set the caps, and push the HEADER
|
||||
* buffers */
|
||||
*hbuf1 = gst_buffer_new_and_alloc (size1);
|
||||
GST_BUFFER_FLAG_SET (*hbuf1, GST_BUFFER_FLAG_IN_CAPS);
|
||||
GST_BUFFER_FLAG_SET (*hbuf1, GST_BUFFER_FLAG_HEADER);
|
||||
gst_buffer_fill (*hbuf1, 0, data1, size1);
|
||||
*hbuf2 = gst_buffer_new_and_alloc (size2);
|
||||
GST_BUFFER_FLAG_SET (*hbuf2, GST_BUFFER_FLAG_IN_CAPS);
|
||||
GST_BUFFER_FLAG_SET (*hbuf2, GST_BUFFER_FLAG_HEADER);
|
||||
gst_buffer_fill (*hbuf2, 0, data2, size2);
|
||||
|
||||
g_value_init (&array, GST_TYPE_ARRAY);
|
||||
|
@ -218,7 +218,7 @@ gst_multifdsink_create_streamheader (const gchar * data1,
|
|||
/* this test:
|
||||
* - adds a first client
|
||||
* - sets streamheader caps on the pad
|
||||
* - pushes the IN_CAPS buffers
|
||||
* - pushes the HEADER buffers
|
||||
* - pushes a buffer
|
||||
* - verifies that the client received all the data correctly, and did not
|
||||
* get multiple copies of the streamheader
|
||||
|
@ -243,7 +243,7 @@ GST_START_TEST (test_streamheader)
|
|||
/* add the first client */
|
||||
g_signal_emit_by_name (sink, "add", pfd1[1]);
|
||||
|
||||
/* create caps with streamheader, set the caps, and push the IN_CAPS
|
||||
/* create caps with streamheader, set the caps, and push the HEADER
|
||||
* buffers */
|
||||
gst_multifdsink_create_streamheader ("babe", "deadbeef", &hbuf1, &hbuf2,
|
||||
&caps);
|
||||
|
@ -257,7 +257,7 @@ GST_START_TEST (test_streamheader)
|
|||
//FIXME:
|
||||
//fail_if_can_read ("first client", pfd1[0]);
|
||||
|
||||
/* push a non-IN_CAPS buffer, this should trigger the client receiving the
|
||||
/* push a non-HEADER buffer, this should trigger the client receiving the
|
||||
* first three buffers */
|
||||
buf = gst_buffer_new_and_alloc (4);
|
||||
gst_buffer_fill (buf, 0, "f00d", 4);
|
||||
|
@ -308,7 +308,7 @@ GST_END_TEST;
|
|||
|
||||
/* this tests changing of streamheaders
|
||||
* - set streamheader caps on the pad
|
||||
* - pushes the IN_CAPS buffers
|
||||
* - pushes the HEADER buffers
|
||||
* - pushes a buffer
|
||||
* - add a first client
|
||||
* - verifies that this first client receives the first streamheader caps,
|
||||
|
@ -330,7 +330,7 @@ GST_START_TEST (test_change_streamheader)
|
|||
|
||||
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
|
||||
|
||||
/* create caps with streamheader, set the caps, and push the IN_CAPS
|
||||
/* create caps with streamheader, set the caps, and push the HEADER
|
||||
* buffers */
|
||||
gst_multifdsink_create_streamheader ("first", "header", &hbuf1, &hbuf2,
|
||||
&caps);
|
||||
|
@ -459,14 +459,14 @@ GST_START_TEST (test_burst_client_bytes)
|
|||
|
||||
/* push buffers in, 9 * 16 bytes = 144 bytes */
|
||||
for (i = 0; i < 9; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -484,14 +484,14 @@ GST_START_TEST (test_burst_client_bytes)
|
|||
|
||||
/* push last buffer to make client fds ready for reading */
|
||||
for (i = 9; i < 10; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
|
|||
|
||||
/* push buffers in, 9 * 16 bytes = 144 bytes */
|
||||
for (i = 0; i < 9; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
|
@ -582,9 +582,9 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
|
|||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -602,15 +602,15 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
|
|||
|
||||
/* push last buffer to make client fds ready for reading */
|
||||
for (i = 9; i < 10; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
|
|||
|
||||
/* push buffers in, 9 * 16 bytes = 144 bytes */
|
||||
for (i = 0; i < 9; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
|
@ -698,9 +698,9 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
|
|||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -718,15 +718,15 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
|
|||
|
||||
/* push last buffer to make client fds ready for reading */
|
||||
for (i = 9; i < 10; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
|
||||
}
|
||||
|
@ -806,14 +806,14 @@ GST_START_TEST (test_client_next_keyframe)
|
|||
|
||||
/* push buffers in: keyframe, then non-keyframe */
|
||||
for (i = 0; i < 2; i++) {
|
||||
gchar *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
/* copy some id */
|
||||
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
|
||||
g_snprintf (data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, data, 16);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
g_snprintf ((gchar *) map.data, 16, "deadbee%08x", i);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
if (i > 0)
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
|
|
|
@ -48,46 +48,59 @@ _pad_added (GstElement * element, GstPad * pad, gpointer user_data)
|
|||
g_free (name);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||
static void
|
||||
_sink_check_caps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
GstCaps *caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||
GstCaps *tcaps = gst_caps_new_simple ("audio/x-raw",
|
||||
"rate", G_TYPE_INT, 11025,
|
||||
"channels", G_TYPE_INT, 1,
|
||||
"signed", G_TYPE_BOOLEAN, FALSE,
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
|
||||
"depth", G_TYPE_INT, 8,
|
||||
"width", G_TYPE_INT, 8,
|
||||
"format", G_TYPE_STRING, "U8",
|
||||
"layout", G_TYPE_STRING, "interleaved",
|
||||
NULL);
|
||||
|
||||
fail_unless (GST_BUFFER_CAPS (buffer) != NULL);
|
||||
fail_unless (gst_caps_is_always_compatible (GST_BUFFER_CAPS (buffer), caps));
|
||||
fail_unless (gst_caps_is_always_compatible (caps, tcaps));
|
||||
gst_caps_unref (tcaps);
|
||||
}
|
||||
|
||||
fail_unless_equals_int (GST_BUFFER_SIZE (buffer), sizeof (mxf_essence));
|
||||
fail_unless (memcmp (GST_BUFFER_DATA (buffer), mxf_essence,
|
||||
static GstFlowReturn
|
||||
_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
fail_unless_equals_int (gst_buffer_get_size (buffer), sizeof (mxf_essence));
|
||||
fail_unless (gst_buffer_memcmp (buffer, 0, mxf_essence,
|
||||
sizeof (mxf_essence)) == 0);
|
||||
|
||||
fail_unless (GST_BUFFER_TIMESTAMP (buffer) == 0);
|
||||
fail_unless (GST_BUFFER_DURATION (buffer) == 200 * GST_MSECOND);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
have_data = TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_sink_event (GstPad * pad, GstEvent * event)
|
||||
_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||
{
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
if (loop) {
|
||||
while (!g_main_loop_is_running (loop));
|
||||
}
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (loop) {
|
||||
while (!g_main_loop_is_running (loop));
|
||||
}
|
||||
|
||||
have_eos = TRUE;
|
||||
if (loop)
|
||||
g_main_loop_quit (loop);
|
||||
have_eos = TRUE;
|
||||
if (loop)
|
||||
g_main_loop_quit (loop);
|
||||
break;
|
||||
case GST_EVENT_CAPS:
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
gst_event_parse_caps (event, &caps);
|
||||
_sink_check_caps (pad, caps);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gst_event_unref (event);
|
||||
|
@ -115,26 +128,20 @@ _create_src_pad_push (void)
|
|||
}
|
||||
|
||||
static GstFlowReturn
|
||||
_src_getrange (GstPad * pad, guint64 offset, guint length, GstBuffer ** buffer)
|
||||
_src_getrange (GstPad * pad, GstObject * parent, guint64 offset, guint length,
|
||||
GstBuffer ** buffer)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
if (offset + length > sizeof (mxf_file))
|
||||
return GST_FLOW_UNEXPECTED;
|
||||
return GST_FLOW_EOS;
|
||||
|
||||
caps = gst_caps_new_simple ("application/mxf", NULL);
|
||||
|
||||
*buffer = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (*buffer) = (guint8 *) (mxf_file + offset);
|
||||
GST_BUFFER_SIZE (*buffer) = length;
|
||||
gst_buffer_set_caps (*buffer, caps);
|
||||
gst_caps_unref (caps);
|
||||
*buffer = gst_buffer_new_wrapped_full ((guint8 *) (mxf_file + offset), NULL,
|
||||
0, length);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_src_query (GstPad * pad, GstQuery * query)
|
||||
_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
GstFormat fmt;
|
||||
|
||||
|
@ -221,9 +228,9 @@ GST_START_TEST (test_push)
|
|||
sinkpad = gst_element_get_static_pad (mxfdemux, "sink");
|
||||
fail_unless (sinkpad != NULL);
|
||||
|
||||
buffer = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (buffer) = (guint8 *) mxf_file;
|
||||
GST_BUFFER_SIZE (buffer) = sizeof (mxf_file);
|
||||
buffer =
|
||||
gst_buffer_new_wrapped_full ((guint8 *) mxf_file, NULL, 0,
|
||||
sizeof (mxf_file));
|
||||
GST_BUFFER_OFFSET (buffer) = 0;
|
||||
|
||||
mysinkpad = _create_sink_pad ();
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) I420, "
|
||||
GST_STATIC_CAPS ("video/x-raw, "
|
||||
"format = (string) I420, "
|
||||
"width = (int) [1, MAX], "
|
||||
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
|
||||
|
||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) I420, "
|
||||
GST_STATIC_CAPS ("video/x-raw, "
|
||||
"format = (string) I420, "
|
||||
"width = (int) [1, MAX], "
|
||||
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
|
||||
|
||||
|
@ -122,18 +122,18 @@ GST_START_TEST (test_decode_simple)
|
|||
GstBuffer *buffer;
|
||||
gint i;
|
||||
GList *l;
|
||||
GstSegment seg;
|
||||
|
||||
bin =
|
||||
setup_vp8dec
|
||||
("video/x-raw-yuv,format=(fourcc)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
|
||||
("video/x-raw,format=(string)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
|
||||
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_new_segment (FALSE,
|
||||
1.0, GST_FORMAT_TIME, 0, gst_util_uint64_scale (20, GST_SECOND,
|
||||
25), 0)));
|
||||
gst_segment_init (&seg, GST_FORMAT_TIME);
|
||||
seg.stop = gst_util_uint64_scale (20, GST_SECOND, 25);
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg)));
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (320 * 240 + 2 * 160 * 120);
|
||||
memset (GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer));
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (srcpad));
|
||||
gst_buffer_memset (buffer, 0, 0, -1);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
GST_BUFFER_TIMESTAMP (buffer) = gst_util_uint64_scale (i, GST_SECOND, 25);
|
||||
|
@ -155,8 +155,6 @@ GST_START_TEST (test_decode_simple)
|
|||
gst_util_uint64_scale (i, GST_SECOND, 25));
|
||||
fail_unless_equals_uint64 (GST_BUFFER_DURATION (buffer),
|
||||
gst_util_uint64_scale (1, GST_SECOND, 25));
|
||||
fail_unless (gst_caps_can_intersect (GST_BUFFER_CAPS (buffer),
|
||||
GST_PAD_CAPS (srcpad)));
|
||||
}
|
||||
|
||||
cleanup_vp8dec (bin);
|
||||
|
|
|
@ -30,8 +30,8 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) I420, "
|
||||
GST_STATIC_CAPS ("video/x-raw, "
|
||||
"format = (string) I420, "
|
||||
"width = (int) [1, MAX], "
|
||||
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
|
||||
|
||||
|
@ -97,20 +97,20 @@ GST_START_TEST (test_encode_simple)
|
|||
gint i;
|
||||
GList *l;
|
||||
GstCaps *outcaps;
|
||||
GstSegment seg;
|
||||
|
||||
vp8enc =
|
||||
setup_vp8enc
|
||||
("video/x-raw-yuv,format=(fourcc)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
|
||||
("video/x-raw,format=(string)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
|
||||
|
||||
g_object_set (vp8enc, "max-latency", 5, NULL);
|
||||
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_new_segment (FALSE,
|
||||
1.0, GST_FORMAT_TIME, 0, gst_util_uint64_scale (20, GST_SECOND,
|
||||
25), 0)));
|
||||
gst_segment_init (&seg, GST_FORMAT_TIME);
|
||||
seg.stop = gst_util_uint64_scale (20, GST_SECOND, 25);
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg)));
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (320 * 240 + 2 * 160 * 120);
|
||||
memset (GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer));
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (srcpad));
|
||||
gst_buffer_memset (buffer, 0, 0, -1);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
GST_BUFFER_TIMESTAMP (buffer) = gst_util_uint64_scale (i, GST_SECOND, 25);
|
||||
|
@ -143,8 +143,6 @@ GST_START_TEST (test_encode_simple)
|
|||
gst_util_uint64_scale (i, GST_SECOND, 25));
|
||||
fail_unless_equals_uint64 (GST_BUFFER_DURATION (buffer),
|
||||
gst_util_uint64_scale (1, GST_SECOND, 25));
|
||||
|
||||
fail_unless (gst_caps_can_intersect (GST_BUFFER_CAPS (buffer), outcaps));
|
||||
}
|
||||
|
||||
gst_caps_unref (outcaps);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
GST_START_TEST (test_still_image)
|
||||
{
|
||||
GstMessage *zbar_msg = NULL;
|
||||
const GstStructure *s;
|
||||
GstElement *pipeline, *src, *dec, *csp, *zbar, *sink;
|
||||
const gchar *type, *symbol;
|
||||
gchar *path;
|
||||
|
@ -70,16 +71,19 @@ GST_START_TEST (test_still_image)
|
|||
} while (1);
|
||||
|
||||
fail_unless (zbar_msg != NULL);
|
||||
fail_unless (gst_structure_has_name (zbar_msg->structure, "barcode"));
|
||||
fail_unless (gst_structure_has_field (zbar_msg->structure, "timestamp"));
|
||||
fail_unless (gst_structure_has_field (zbar_msg->structure, "type"));
|
||||
fail_unless (gst_structure_has_field (zbar_msg->structure, "symbol"));
|
||||
fail_unless (gst_structure_has_field (zbar_msg->structure, "quality"));
|
||||
fail_unless (gst_structure_get_int (zbar_msg->structure, "quality", &qual));
|
||||
s = gst_message_get_structure (zbar_msg);
|
||||
fail_unless (s != NULL);
|
||||
|
||||
fail_unless (gst_structure_has_name (s, "barcode"));
|
||||
fail_unless (gst_structure_has_field (s, "timestamp"));
|
||||
fail_unless (gst_structure_has_field (s, "type"));
|
||||
fail_unless (gst_structure_has_field (s, "symbol"));
|
||||
fail_unless (gst_structure_has_field (s, "quality"));
|
||||
fail_unless (gst_structure_get_int (s, "quality", &qual));
|
||||
fail_unless (qual >= 90);
|
||||
type = gst_structure_get_string (zbar_msg->structure, "type");
|
||||
type = gst_structure_get_string (s, "type");
|
||||
fail_unless_equals_string (type, "EAN-13");
|
||||
symbol = gst_structure_get_string (zbar_msg->structure, "symbol");
|
||||
symbol = gst_structure_get_string (s, "symbol");
|
||||
fail_unless_equals_string (symbol, "9876543210128");
|
||||
|
||||
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL),
|
||||
|
@ -99,7 +103,8 @@ zbar_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
if (!gst_default_registry_check_feature_version ("pngdec", 0, 10, 25)) {
|
||||
if (!gst_registry_check_feature_version (gst_registry_get (), "pngdec", 0, 10,
|
||||
25)) {
|
||||
GST_INFO ("Skipping test, pngdec either not available or too old");
|
||||
} else {
|
||||
tcase_add_test (tc_chain, test_still_image);
|
||||
|
|
Loading…
Reference in a new issue