tests: make more tests compile

This commit is contained in:
Wim Taymans 2012-01-03 14:16:28 +01:00
parent 06b3c265b8
commit 8e39d52bbb
16 changed files with 252 additions and 275 deletions

View file

@ -243,6 +243,9 @@ elements_rglimiter_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR)
elements_rgvolume_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_rgvolume_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_rgvolume_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD) elements_rgvolume_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_spectrum_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_spectrum_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_cmmldec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_cmmldec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_cmmlenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_cmmlenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
@ -263,7 +266,7 @@ elements_imagefreeze_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM
elements_imagefreeze_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LDADD) elements_imagefreeze_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LDADD)
elements_jpegenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS) elements_jpegenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_jpegenc_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstapp-0.10 $(GST_BASE_LIBS) $(LDADD) elements_jpegenc_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstapp-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LDADD)
elements_level_LDADD = $(LDADD) $(LIBM) elements_level_LDADD = $(LDADD) $(LIBM)
@ -279,7 +282,7 @@ elements_qtmux_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstpbutils-@GST_MAJORMINOR@ \
elements_rtpbin_buffer_list_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \ elements_rtpbin_buffer_list_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
$(WARNING_CFLAGS) $(ERROR_CFLAGS) $(GST_CHECK_CFLAGS) $(AM_CFLAGS) $(WARNING_CFLAGS) $(ERROR_CFLAGS) $(GST_CHECK_CFLAGS) $(AM_CFLAGS)
elements_rtpbin_buffer_list_LDADD = $(GST_PLUGINS_BASE_LIBS) \ elements_rtpbin_buffer_list_LDADD = $(GST_PLUGINS_BASE_LIBS) \
-lgstnetbuffer-@GST_MAJORMINOR@ -lgstrtp-@GST_MAJORMINOR@ \ -lgstrtp-@GST_MAJORMINOR@ \
$(GST_BASE_LIBS) $(GST_LIBS) $(GST_CHECK_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(GST_CHECK_LIBS)
elements_rtpbin_buffer_list_SOURCES = elements/rtpbin_buffer_list.c elements_rtpbin_buffer_list_SOURCES = elements/rtpbin_buffer_list.c
@ -293,8 +296,8 @@ elements_sunaudio_LDADD = \
$(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-@GST_MAJORMINOR@ \ $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-@GST_MAJORMINOR@ \
$(LDADD) $(LDADD)
elements_videocrop_LDADD = $(GST_BASE_LIBS) $(LDADD) elements_videocrop_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(LDADD)
elements_videocrop_CFLAGS = $(GST_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_videocrop_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_videofilter_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_videofilter_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_videofilter_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(LDADD) elements_videofilter_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(LDADD)
@ -307,6 +310,9 @@ elements_gdkpixbufsink_LDADD = \
$(LDADD) $(GDK_PIXBUF_LIBS) $(LDADD) $(GDK_PIXBUF_LIBS)
pipelines_flacdec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
pipelines_flacdec_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
pipelines_wavenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) pipelines_wavenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
pipelines_wavenc_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD) pipelines_wavenc_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)

View file

@ -94,6 +94,7 @@ create_video_buffer (GstCaps * caps)
GstElement *pipeline; GstElement *pipeline;
GstElement *cf; GstElement *cf;
GstElement *sink; GstElement *sink;
GstSample *sample;
GstBuffer *buffer; GstBuffer *buffer;
pipeline = pipeline =
@ -109,12 +110,18 @@ create_video_buffer (GstCaps * caps)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
buffer = gst_app_sink_pull_buffer (GST_APP_SINK (sink)); sample = gst_app_sink_pull_sample (GST_APP_SINK (sink));
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline); gst_object_unref (pipeline);
gst_object_unref (sink); gst_object_unref (sink);
gst_object_unref (cf); gst_object_unref (cf);
buffer = gst_sample_get_buffer (sample);
gst_buffer_ref (buffer);
gst_sample_unref (sample);
return buffer; return buffer;
} }
@ -135,7 +142,7 @@ GST_START_TEST (test_jpegenc_getcaps)
jpegenc = setup_jpegenc (&any_sinktemplate); jpegenc = setup_jpegenc (&any_sinktemplate);
sinkpad = gst_element_get_static_pad (jpegenc, "sink"); sinkpad = gst_element_get_static_pad (jpegenc, "sink");
/* this should assert if non-subset */ /* this should assert if non-subset */
caps = gst_pad_get_caps (sinkpad); caps = gst_pad_query_caps (sinkpad, NULL);
gst_caps_unref (caps); gst_caps_unref (caps);
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
cleanup_jpegenc (jpegenc); cleanup_jpegenc (jpegenc);
@ -143,7 +150,7 @@ GST_START_TEST (test_jpegenc_getcaps)
jpegenc = setup_jpegenc (&jpeg_sinktemplate); jpegenc = setup_jpegenc (&jpeg_sinktemplate);
sinkpad = gst_element_get_static_pad (jpegenc, "sink"); sinkpad = gst_element_get_static_pad (jpegenc, "sink");
/* this should assert if non-subset */ /* this should assert if non-subset */
caps = gst_pad_get_caps (sinkpad); caps = gst_pad_query_caps (sinkpad, NULL);
gst_caps_unref (caps); gst_caps_unref (caps);
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
cleanup_jpegenc (jpegenc); cleanup_jpegenc (jpegenc);
@ -152,7 +159,7 @@ GST_START_TEST (test_jpegenc_getcaps)
jpegenc = setup_jpegenc (&jpeg_restrictive_sinktemplate); jpegenc = setup_jpegenc (&jpeg_restrictive_sinktemplate);
sinkpad = gst_element_get_static_pad (jpegenc, "sink"); sinkpad = gst_element_get_static_pad (jpegenc, "sink");
/* this should assert if non-subset */ /* this should assert if non-subset */
caps = gst_pad_get_caps (sinkpad); caps = gst_pad_query_caps (sinkpad, NULL);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
/* check the width */ /* check the width */
@ -185,10 +192,9 @@ GST_START_TEST (test_jpegenc_different_caps)
gst_element_set_state (jpegenc, GST_STATE_PLAYING); gst_element_set_state (jpegenc, GST_STATE_PLAYING);
/* push first buffer with 800x600 resolution */ /* push first buffer with 800x600 resolution */
caps = gst_caps_new_simple ("video/x-raw-yuv", "width", G_TYPE_INT, caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT,
800, "height", G_TYPE_INT, 600, "framerate", 800, "height", G_TYPE_INT, 600, "framerate",
GST_TYPE_FRACTION, 1, 1, "format", GST_TYPE_FOURCC, GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING, "I420", NULL);
GST_MAKE_FOURCC ('I', '4', '2', '0'), NULL);
buffer = create_video_buffer (caps); buffer = create_video_buffer (caps);
gst_caps_unref (caps); gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK); fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
@ -198,10 +204,9 @@ GST_START_TEST (test_jpegenc_different_caps)
allowed_caps = gst_pad_get_allowed_caps (mysrcpad); allowed_caps = gst_pad_get_allowed_caps (mysrcpad);
/* the caps we want to negotiate to */ /* the caps we want to negotiate to */
caps = gst_caps_new_simple ("video/x-raw-yuv", "width", G_TYPE_INT, caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT,
640, "height", G_TYPE_INT, 480, "framerate", 640, "height", G_TYPE_INT, 480, "framerate",
GST_TYPE_FRACTION, 1, 1, "format", GST_TYPE_FOURCC, GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING, "I420", NULL);
GST_MAKE_FOURCC ('I', '4', '2', '0'), NULL);
fail_unless (gst_caps_can_intersect (allowed_caps, caps)); fail_unless (gst_caps_can_intersect (allowed_caps, caps));
/* push second buffer with 640x480 resolution */ /* push second buffer with 640x480 resolution */

View file

@ -72,7 +72,7 @@ GST_START_TEST (test_multifilesink_key_frame)
pipeline = pipeline =
gst_parse_launch gst_parse_launch
("videotestsrc num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! multifilesink name=mfs", ("videotestsrc num-buffers=10 ! video/x-raw,format=(string)I420,width=320,height=240 ! multifilesink name=mfs",
NULL); NULL);
fail_if (pipeline == NULL); fail_if (pipeline == NULL);
mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs"); mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs");
@ -115,7 +115,7 @@ GST_START_TEST (test_multifilesink_max_files)
pipeline = pipeline =
gst_parse_launch gst_parse_launch
("videotestsrc num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! multifilesink name=mfs", ("videotestsrc num-buffers=10 ! video/x-raw,format=(string)I420,width=320,height=240 ! multifilesink name=mfs",
NULL); NULL);
fail_if (pipeline == NULL); fail_if (pipeline == NULL);
mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs"); mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs");
@ -224,7 +224,7 @@ GST_START_TEST (test_multifilesrc)
pipeline = pipeline =
gst_parse_launch gst_parse_launch
("videotestsrc num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! multifilesink name=mfs", ("videotestsrc num-buffers=10 ! video/x-raw,format=(string)I420,width=320,height=240 ! multifilesink name=mfs",
NULL); NULL);
fail_if (pipeline == NULL); fail_if (pipeline == NULL);
mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs"); mfs = gst_bin_get_by_name (GST_BIN (pipeline), "mfs");
@ -238,7 +238,7 @@ GST_START_TEST (test_multifilesrc)
pipeline = pipeline =
gst_parse_launch gst_parse_launch
("multifilesrc ! video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,framerate=10/1 ! fakesink", ("multifilesrc ! video/x-raw,format=(string)I420,width=320,height=240,framerate=10/1 ! fakesink",
NULL); NULL);
fail_if (pipeline == NULL); fail_if (pipeline == NULL);
mfs = gst_bin_get_by_name (GST_BIN (pipeline), "multifilesrc0"); mfs = gst_bin_get_by_name (GST_BIN (pipeline), "multifilesrc0");

View file

@ -539,10 +539,9 @@ create_qtmux_profile (const gchar * variant)
cprof = gst_encoding_container_profile_new ("Name", "blah", caps, NULL); cprof = gst_encoding_container_profile_new ("Name", "blah", caps, NULL);
gst_caps_unref (caps); gst_caps_unref (caps);
caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 16, caps = gst_caps_new_simple ("audio/x-raw",
"depth", G_TYPE_INT, 16, "endianness", G_TYPE_INT, 4321, "format", G_TYPE_STRING, "S16BE",
"channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 44100, NULL);
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
gst_encoding_container_profile_add_profile (cprof, gst_encoding_container_profile_add_profile (cprof,
GST_ENCODING_PROFILE (gst_encoding_audio_profile_new (caps, NULL, NULL, GST_ENCODING_PROFILE (gst_encoding_audio_profile_new (caps, NULL, NULL,
1))); 1)));
@ -600,7 +599,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int") GST_STATIC_CAPS ("audio/x-raw")
); );
static GType test_mp3_enc_get_type (void); static GType test_mp3_enc_get_type (void);

View file

@ -51,31 +51,25 @@ static guint chain_list_bytes_received;
* Chain list function for testing buffer lists * Chain list function for testing buffer lists
*/ */
static GstFlowReturn static GstFlowReturn
rtp_pipeline_chain_list (GstPad * pad, GstBufferList * list) rtp_pipeline_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
{ {
GstBufferListIterator *it; guint i, len;
fail_if (!list); fail_if (!list);
it = gst_buffer_list_iterate (list);
/* /*
* Count the size of the payload in the buffer list. * Count the size of the payload in the buffer list.
*/ */
len = gst_buffer_list_length (list);
/* Loop through all groups */ /* Loop through all groups */
while (gst_buffer_list_iterator_next_group (it)) { for (i = 0; i < len; i++) {
GstBuffer *paybuf; GstBuffer *paybuf;
/* Skip the first buffer in the group, its the RTP header */ /* FIXME need to discard RTP header */
fail_if (!gst_buffer_list_iterator_next (it)); paybuf = gst_buffer_list_get (list, i);
/* Loop through all payload buffers in the current group */ /* Loop through all payload buffers in the current group */
while ((paybuf = gst_buffer_list_iterator_next (it))) { chain_list_bytes_received += gst_buffer_get_size (paybuf);
chain_list_bytes_received += GST_BUFFER_SIZE (paybuf);
} }
}
gst_buffer_list_iterator_free (it);
gst_buffer_list_unref (list); gst_buffer_list_unref (list);
return GST_FLOW_OK; return GST_FLOW_OK;

View file

@ -124,11 +124,12 @@ static guint8 rtp_packet[] = { 0x80, 0x60, 0x94, 0xbc, 0x8f, 0x37, 0x4e, 0xb8,
0x2b, 0x82, 0x31, 0x3b, 0x36, 0xc1, 0x3c, 0x13 0x2b, 0x82, 0x31, 0x3b, 0x36, 0xc1, 0x3c, 0x13
}; };
static GstBuffer * static GstFlowReturn
make_rtp_packet (CleanupData * data) chain_rtp_packet (GstPad * pad, CleanupData * data)
{ {
GstFlowReturn res;
static GstCaps *caps = NULL; static GstCaps *caps = NULL;
GstBuffer *result; GstBuffer *buffer;
guint8 *datap; guint8 *datap;
if (caps == NULL) { if (caps == NULL) {
@ -136,24 +137,26 @@ make_rtp_packet (CleanupData * data)
"media=(string)audio, clock-rate=(int)44100, " "media=(string)audio, clock-rate=(int)44100, "
"encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1"); "encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1");
data->seqnum = 0; data->seqnum = 0;
gst_pad_set_caps (pad, caps);
} }
result = gst_buffer_new_and_alloc (sizeof (rtp_packet)); buffer = gst_buffer_new_and_alloc (sizeof (rtp_packet));
datap = GST_BUFFER_DATA (result); datap = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
memcpy (datap, rtp_packet, sizeof (rtp_packet)); memcpy (datap, rtp_packet, sizeof (rtp_packet));
datap[2] = (data->seqnum >> 8) & 0xff; datap[2] = (data->seqnum >> 8) & 0xff;
datap[3] = data->seqnum & 0xff; datap[3] = data->seqnum & 0xff;
data->seqnum++; data->seqnum++;
gst_buffer_unmap (buffer, datap, -1);
gst_buffer_set_caps (result, caps); res = gst_pad_chain (pad, buffer);
return result; return res;
} }
static GstFlowReturn static GstFlowReturn
dummy_chain (GstPad * pad, GstBuffer * buffer) dummy_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{ {
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
@ -226,7 +229,6 @@ GST_START_TEST (test_cleanup_recv)
CleanupData data; CleanupData data;
GstStateChangeReturn ret; GstStateChangeReturn ret;
GstFlowReturn res; GstFlowReturn res;
GstBuffer *buffer;
gint count = 2; gint count = 2;
init_data (&data); init_data (&data);
@ -249,13 +251,11 @@ GST_START_TEST (test_cleanup_recv)
fail_unless (rtpbin->numsinkpads == 1); fail_unless (rtpbin->numsinkpads == 1);
fail_unless (rtpbin->numsrcpads == 0); fail_unless (rtpbin->numsrcpads == 0);
buffer = make_rtp_packet (&data); res = chain_rtp_packet (rtp_sink, &data);
res = gst_pad_chain (rtp_sink, buffer);
GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res)); GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res));
fail_unless (res == GST_FLOW_OK); fail_unless (res == GST_FLOW_OK);
buffer = make_rtp_packet (&data); res = chain_rtp_packet (rtp_sink, &data);
res = gst_pad_chain (rtp_sink, buffer);
GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res)); GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res));
fail_unless (res == GST_FLOW_OK); fail_unless (res == GST_FLOW_OK);
@ -301,7 +301,6 @@ GST_START_TEST (test_cleanup_recv2)
CleanupData data; CleanupData data;
GstStateChangeReturn ret; GstStateChangeReturn ret;
GstFlowReturn res; GstFlowReturn res;
GstBuffer *buffer;
gint count = 2; gint count = 2;
init_data (&data); init_data (&data);
@ -324,13 +323,11 @@ GST_START_TEST (test_cleanup_recv2)
fail_unless (rtpbin->numsinkpads == 1); fail_unless (rtpbin->numsinkpads == 1);
fail_unless (rtpbin->numsrcpads == 0); fail_unless (rtpbin->numsrcpads == 0);
buffer = make_rtp_packet (&data); res = chain_rtp_packet (rtp_sink, &data);
res = gst_pad_chain (rtp_sink, buffer);
GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res)); GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res));
fail_unless (res == GST_FLOW_OK); fail_unless (res == GST_FLOW_OK);
buffer = make_rtp_packet (&data); res = chain_rtp_packet (rtp_sink, &data);
res = gst_pad_chain (rtp_sink, buffer);
GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res)); GST_DEBUG ("res %d, %s\n", res, gst_flow_get_name (res));
fail_unless (res == GST_FLOW_OK); fail_unless (res == GST_FLOW_OK);

View file

@ -24,6 +24,7 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#if 0
/* This test makes sure that RTP packets sent as buffer lists are sent through /* This test makes sure that RTP packets sent as buffer lists are sent through
* the rtpbin as they are supposed to, and not corrupted in any way. * the rtpbin as they are supposed to, and not corrupted in any way.
@ -310,6 +311,7 @@ GST_START_TEST (test_bufferlist)
GST_END_TEST; GST_END_TEST;
#endif
static Suite * static Suite *
@ -323,7 +325,9 @@ bufferlist_suite (void)
tcase_set_timeout (tc_chain, 10); tcase_set_timeout (tc_chain, 10);
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
#if 0
tcase_add_test (tc_chain, test_bufferlist); tcase_add_test (tc_chain, test_bufferlist);
#endif
return s; return s;
} }

View file

@ -51,14 +51,11 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
); );
static void static void
buffer_dropped (gpointer mem) buffer_dropped (gpointer data, GstMiniObject * obj)
{ {
if (mem) { GST_DEBUG ("dropping buffer %p", obj);
GST_DEBUG ("dropping buffer: data=%p", mem);
g_free (mem);
num_dropped++; num_dropped++;
} }
}
static GstElement * static GstElement *
setup_jitterbuffer (gint num_buffers) setup_jitterbuffer (gint num_buffers)
@ -103,12 +100,11 @@ setup_jitterbuffer (gint num_buffers)
caps = gst_caps_from_string (RTP_CAPS_STRING); caps = gst_caps_from_string (RTP_CAPS_STRING);
for (i = 0; i < num_buffers; i++) { for (i = 0; i < num_buffers; i++) {
buffer = gst_buffer_new_and_alloc (sizeof (in)); buffer = gst_buffer_new_and_alloc (sizeof (in));
memcpy (GST_BUFFER_DATA (buffer), in, sizeof (in)); gst_buffer_fill (buffer, 0, in, sizeof (in));
gst_buffer_set_caps (buffer, caps);
GST_BUFFER_TIMESTAMP (buffer) = ts; GST_BUFFER_TIMESTAMP (buffer) = ts;
GST_BUFFER_DURATION (buffer) = tso; GST_BUFFER_DURATION (buffer) = tso;
GST_BUFFER_FREE_FUNC (buffer) = buffer_dropped; gst_mini_object_weak_ref (GST_MINI_OBJECT (buffer), buffer_dropped, NULL);
GST_DEBUG ("created buffer: %p, data=%p", buffer, GST_BUFFER_DATA (buffer)); GST_DEBUG ("created buffer: %p", buffer);
if (!i) if (!i)
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
@ -187,10 +183,11 @@ check_jitterbuffer_results (GstElement * jitterbuffer, gint num_buffers)
for (node = buffers; node; node = g_list_next (node)) { for (node = buffers; node; node = g_list_next (node)) {
fail_if ((buffer = (GstBuffer *) node->data) == NULL); fail_if ((buffer = (GstBuffer *) node->data) == NULL);
fail_if (GST_BUFFER_TIMESTAMP (buffer) != ts); fail_if (GST_BUFFER_TIMESTAMP (buffer) != ts);
data = GST_BUFFER_DATA (buffer); data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_READ);
cur_sn = ((guint16) data[2] << 8) | data[3]; cur_sn = ((guint16) data[2] << 8) | data[3];
cur_ts = ((guint32) data[4] << 24) | ((guint32) data[5] << 16) | cur_ts = ((guint32) data[4] << 24) | ((guint32) data[5] << 16) |
((guint32) data[6] << 8) | data[7]; ((guint32) data[6] << 8) | data[7];
gst_buffer_unmap (buffer, data, -1);
if (node != buffers) { if (node != buffers) {
fail_unless (cur_sn > prev_sn); fail_unless (cur_sn > prev_sn);

View file

@ -31,16 +31,15 @@ GstPad *myvideosrcpad, *mymasksrcpad, *mysinkpad;
#define SHAPEWIPE_VIDEO_CAPS_STRING \ #define SHAPEWIPE_VIDEO_CAPS_STRING \
"video/x-raw-yuv, " \ "video/x-raw, " \
"format = (GstFourcc)AYUV, " \ "format = (string)AYUV, " \
"width = 400, " \ "width = 400, " \
"height = 400, " \ "height = 400, " \
"framerate = 0/1" "framerate = 0/1"
#define SHAPEWIPE_MASK_CAPS_STRING \ #define SHAPEWIPE_MASK_CAPS_STRING \
"video/x-raw-gray, " \ "video/x-raw, " \
"bpp = 8, " \ "format = (string)GRAY8, " \
"depth = 8, " \
"width = 400, " \ "width = 400, " \
"height = 400, " \ "height = 400, " \
"framerate = 0/1" "framerate = 0/1"
@ -67,7 +66,7 @@ GST_STATIC_PAD_TEMPLATE ("masksrc",
static GstBuffer *output = NULL; static GstBuffer *output = NULL;
static GstFlowReturn static GstFlowReturn
on_chain (GstPad * pad, GstBuffer * buffer) on_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{ {
g_return_val_if_fail (output == NULL, GST_FLOW_ERROR); g_return_val_if_fail (output == NULL, GST_FLOW_ERROR);
@ -82,7 +81,7 @@ GST_START_TEST (test_general)
GstCaps *caps; GstCaps *caps;
GstBuffer *mask, *input; GstBuffer *mask, *input;
guint i, j; guint i, j;
guint8 *data; guint8 *data, *orig;
myvideosrcpad = myvideosrcpad =
gst_pad_new_from_static_template (&videosrctemplate, "videosrc"); gst_pad_new_from_static_template (&videosrctemplate, "videosrc");
@ -122,9 +121,9 @@ GST_START_TEST (test_general)
mask = gst_buffer_new_and_alloc (400 * 400); mask = gst_buffer_new_and_alloc (400 * 400);
caps = gst_caps_from_string (SHAPEWIPE_MASK_CAPS_STRING); caps = gst_caps_from_string (SHAPEWIPE_MASK_CAPS_STRING);
gst_buffer_set_caps (mask, caps); gst_pad_set_caps (mymasksrcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
data = GST_BUFFER_DATA (mask); data = orig = gst_buffer_map (mask, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
if (i < 100 && j < 100) if (i < 100 && j < 100)
@ -138,14 +137,15 @@ GST_START_TEST (test_general)
data++; data++;
} }
} }
gst_buffer_unmap (mask, orig, -1);
fail_unless (gst_pad_push (mymasksrcpad, mask) == GST_FLOW_OK); fail_unless (gst_pad_push (mymasksrcpad, mask) == GST_FLOW_OK);
input = gst_buffer_new_and_alloc (400 * 400 * 4); input = gst_buffer_new_and_alloc (400 * 400 * 4);
caps = gst_caps_from_string (SHAPEWIPE_VIDEO_CAPS_STRING); caps = gst_caps_from_string (SHAPEWIPE_VIDEO_CAPS_STRING);
gst_buffer_set_caps (input, caps); gst_pad_set_caps (myvideosrcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
data = GST_BUFFER_DATA (input); data = orig = gst_buffer_map (input, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
/* This is green */ /* This is green */
@ -156,13 +156,14 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (input, orig, -1);
g_object_set (G_OBJECT (shapewipe), "position", 0.0, NULL); g_object_set (G_OBJECT (shapewipe), "position", 0.0, NULL);
output = NULL; output = NULL;
fail_unless (gst_pad_push (myvideosrcpad, fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK); gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL); fail_unless (output != NULL);
data = GST_BUFFER_DATA (output); data = orig = gst_buffer_map (output, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
fail_unless_equals_int (data[0], 255); /* A */ fail_unless_equals_int (data[0], 255); /* A */
@ -172,6 +173,7 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (output, orig, -1);
gst_buffer_unref (output); gst_buffer_unref (output);
output = NULL; output = NULL;
@ -180,7 +182,7 @@ GST_START_TEST (test_general)
fail_unless (gst_pad_push (myvideosrcpad, fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK); gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL); fail_unless (output != NULL);
data = GST_BUFFER_DATA (output); data = orig = gst_buffer_map (output, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
if (i < 100 && j < 100) { if (i < 100 && j < 100) {
@ -197,6 +199,7 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (output, orig, -1);
gst_buffer_unref (output); gst_buffer_unref (output);
output = NULL; output = NULL;
@ -205,7 +208,7 @@ GST_START_TEST (test_general)
fail_unless (gst_pad_push (myvideosrcpad, fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK); gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL); fail_unless (output != NULL);
data = GST_BUFFER_DATA (output); data = orig = gst_buffer_map (output, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
if (i < 200 && j < 200) { if (i < 200 && j < 200) {
@ -222,6 +225,7 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (output, orig, -1);
gst_buffer_unref (output); gst_buffer_unref (output);
output = NULL; output = NULL;
@ -230,7 +234,7 @@ GST_START_TEST (test_general)
fail_unless (gst_pad_push (myvideosrcpad, fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK); gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL); fail_unless (output != NULL);
data = GST_BUFFER_DATA (output); data = orig = gst_buffer_map (output, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
if (i < 300 && j < 300) { if (i < 300 && j < 300) {
@ -247,6 +251,7 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (output, orig, -1);
gst_buffer_unref (output); gst_buffer_unref (output);
output = NULL; output = NULL;
@ -255,7 +260,7 @@ GST_START_TEST (test_general)
fail_unless (gst_pad_push (myvideosrcpad, fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK); gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL); fail_unless (output != NULL);
data = GST_BUFFER_DATA (output); data = orig = gst_buffer_map (output, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 400; i++) { for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) { for (j = 0; j < 400; j++) {
fail_unless_equals_int (data[0], 0); /* A */ fail_unless_equals_int (data[0], 0); /* A */
@ -265,6 +270,7 @@ GST_START_TEST (test_general)
data += 4; data += 4;
} }
} }
gst_buffer_unmap (output, orig, -1);
gst_buffer_unref (output); gst_buffer_unref (output);
output = NULL; output = NULL;

View file

@ -343,15 +343,18 @@ got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
gpointer user_data) gpointer user_data)
{ {
GstStructure *s; GstStructure *s;
GstCaps *caps;
/* Caps can be anything if we don't except icy caps */ /* Caps can be anything if we don't except icy caps */
if (!icy_caps) if (!icy_caps)
return; return;
/* Otherwise they _must_ be "application/x-icy" */ /* Otherwise they _must_ be "application/x-icy" */
fail_unless (GST_BUFFER_CAPS (buf) != NULL); caps = gst_pad_get_current_caps (pad);
s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0); fail_unless (caps != NULL);
s = gst_caps_get_structure (caps, 0);
fail_unless_equals_string (gst_structure_get_name (s), "application/x-icy"); fail_unless_equals_string (gst_structure_get_name (s), "application/x-icy");
gst_caps_unref (caps);
} }
GST_START_TEST (test_icy_stream) GST_START_TEST (test_icy_stream)

View file

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#if 0
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
@ -182,6 +183,7 @@ GST_START_TEST (test_udpsink_bufferlist)
} }
GST_END_TEST; GST_END_TEST;
#endif
/* /*
* Creates the test suite. * Creates the test suite.
@ -199,8 +201,10 @@ udpsink_suite (void)
tcase_set_timeout (tc_chain, 60); tcase_set_timeout (tc_chain, 60);
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
#if 0
tcase_add_test (tc_chain, test_udpsink); tcase_add_test (tc_chain, test_udpsink);
tcase_add_test (tc_chain, test_udpsink_bufferlist); tcase_add_test (tc_chain, test_udpsink_bufferlist);
#endif
return s; return s;
} }

View file

@ -28,6 +28,7 @@
#include <unistd.h> #include <unistd.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/video/video.h>
#include <gst/base/gstbasetransform.h> #include <gst/base/gstbasetransform.h>
/* return a list of caps where we only need to set /* return a list of caps where we only need to set
@ -110,8 +111,8 @@ GST_START_TEST (test_unit_sizes)
for (i = 0; i < G_N_ELEMENTS (sizes_to_try); ++i) { for (i = 0; i < G_N_ELEMENTS (sizes_to_try); ++i) {
gchar *caps_str; gchar *caps_str;
guint csp_size = 0; gsize csp_size = 0;
guint vc_size = 0; gsize vc_size = 0;
gst_structure_set (s, "width", G_TYPE_INT, sizes_to_try[i].width, gst_structure_set (s, "width", G_TYPE_INT, sizes_to_try[i].width,
"height", G_TYPE_INT, sizes_to_try[i].height, NULL); "height", G_TYPE_INT, sizes_to_try[i].height, NULL);
@ -157,13 +158,19 @@ typedef struct
GstElement *crop; GstElement *crop;
GstElement *sink; GstElement *sink;
GstBuffer *last_buf; GstBuffer *last_buf;
GstCaps *last_caps;
} GstVideoCropTestContext; } GstVideoCropTestContext;
static void static void
handoff_cb (GstElement * sink, GstBuffer * buf, GstPad * pad, handoff_cb (GstElement * sink, GstBuffer * buf, GstPad * pad,
GstBuffer ** p_buf) GstVideoCropTestContext * ctx)
{ {
gst_buffer_replace (p_buf, buf); GstCaps *caps;
gst_buffer_replace (&ctx->last_buf, buf);
caps = gst_pad_get_current_caps (pad);
gst_caps_replace (&ctx->last_caps, caps);
gst_caps_unref (caps);
} }
static void static void
@ -190,10 +197,10 @@ videocrop_test_cropping_init_context (GstVideoCropTestContext * ctx)
g_object_set (ctx->src, "pattern", 4, NULL); g_object_set (ctx->src, "pattern", 4, NULL);
g_object_set (ctx->sink, "signal-handoffs", TRUE, NULL); g_object_set (ctx->sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (ctx->sink, "preroll-handoff", G_CALLBACK (handoff_cb), g_signal_connect (ctx->sink, "preroll-handoff", G_CALLBACK (handoff_cb), ctx);
&ctx->last_buf);
ctx->last_buf = NULL; ctx->last_buf = NULL;
ctx->last_caps = NULL;
GST_LOG ("context inited"); GST_LOG ("context inited");
} }
@ -209,7 +216,7 @@ videocrop_test_cropping_deinit_context (GstVideoCropTestContext * ctx)
memset (ctx, 0x00, sizeof (GstVideoCropTestContext)); memset (ctx, 0x00, sizeof (GstVideoCropTestContext));
} }
typedef void (*GstVideoCropTestBufferFunc) (GstBuffer * buffer); typedef void (*GstVideoCropTestBufferFunc) (GstBuffer * buffer, GstCaps * caps);
static void static void
videocrop_test_cropping (GstVideoCropTestContext * ctx, GstCaps * in_caps, videocrop_test_cropping (GstVideoCropTestContext * ctx, GstCaps * in_caps,
@ -232,103 +239,45 @@ videocrop_test_cropping (GstVideoCropTestContext * ctx, GstCaps * in_caps,
-1) == GST_STATE_CHANGE_SUCCESS); -1) == GST_STATE_CHANGE_SUCCESS);
if (func != NULL) { if (func != NULL) {
func (ctx->last_buf); func (ctx->last_buf, ctx->last_caps);
} }
gst_element_set_state (ctx->pipeline, GST_STATE_NULL); gst_element_set_state (ctx->pipeline, GST_STATE_NULL);
} }
static void static void
check_1x1_buffer (GstBuffer * buf) check_1x1_buffer (GstBuffer * buf, GstCaps * caps)
{ {
GstStructure *s; GstVideoInfo info;
GstVideoFrame frame;
/* the exact values we check for come from videotestsrc */
static const guint yuv_values[] = { 81, 90, 240, 0 };
static const guint rgb_values[] = { 0xff, 0, 0, 0 };
const guint *values;
guint i;
fail_unless (buf != NULL); fail_unless (buf != NULL);
fail_unless (GST_BUFFER_CAPS (buf) != NULL); fail_unless (caps != NULL);
s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0); fail_unless (gst_video_info_from_caps (&info, caps));
if (gst_structure_has_name (s, "video/x-raw-yuv")) { fail_unless (gst_video_frame_map (&frame, &info, buf, GST_MAP_READ));
guint32 format = 0;
fail_unless (gst_structure_get_fourcc (s, "format", &format)); if (GST_VIDEO_INFO_IS_YUV (&info))
values = yuv_values;
/* the exact values we check for come from videotestsrc */
switch (format) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 81);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[8], 90);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[12], 240);
break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 81);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[8], 240);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[12], 90);
break;
case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 81);
/* no chroma planes */
break;
case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
fail_unless_equals_int (GST_BUFFER_DATA (buf)[1], 81);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[2], 90);
fail_unless_equals_int (GST_BUFFER_DATA (buf)[3], 240);
/* no chroma planes */
break;
default:
GST_LOG ("not checking %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (format));
break;
}
} else if (gst_structure_has_name (s, "video/x-raw-rgb")) {
guint32 pixel;
gint rmask = 0, bmask = 0, gmask = 0, endianness = 0, bpp = 0;
gint rshift, gshift, bshift;
fail_unless (gst_structure_get_int (s, "red_mask", &rmask));
fail_unless (gst_structure_get_int (s, "blue_mask", &bmask));
fail_unless (gst_structure_get_int (s, "green_mask", &gmask));
fail_unless (gst_structure_get_int (s, "bpp", &bpp));
fail_unless (gst_structure_get_int (s, "endianness", &endianness));
fail_unless (rmask != 0);
fail_unless (gmask != 0);
fail_unless (bmask != 0);
fail_unless (bpp != 0);
fail_unless (endianness != 0);
rshift = g_bit_nth_lsf (rmask, -1);
gshift = g_bit_nth_lsf (gmask, -1);
bshift = g_bit_nth_lsf (bmask, -1);
switch (bpp) {
case 32:{
if (endianness == G_LITTLE_ENDIAN)
pixel = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
else else
pixel = GST_READ_UINT32_BE (GST_BUFFER_DATA (buf)); values = rgb_values;
break;
} for (i = 0; i < GST_VIDEO_FRAME_N_COMPONENTS (&frame); i++) {
case 24:{ guint8 *data = GST_VIDEO_FRAME_COMP_DATA (&frame, i);
if (endianness == G_BIG_ENDIAN) {
pixel = (GST_READ_UINT8 (GST_BUFFER_DATA (buf)) << 16) | fail_unless_equals_int (data[0], values[i]);
(GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 1) << 8) |
(GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 2) << 0);
} else {
pixel = (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 2) << 16) |
(GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 1) << 8) |
(GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 0) << 0);
}
break;
}
default:{
GST_LOG ("not checking RGB-format buffer with %ubpp", bpp);
return;
}
} }
/*
fail_unless_equals_int ((pixel & rmask) >> rshift, 0xff); fail_unless_equals_int ((pixel & rmask) >> rshift, 0xff);
fail_unless_equals_int ((pixel & gmask) >> gshift, 0x00); fail_unless_equals_int ((pixel & gmask) >> gshift, 0x00);
fail_unless_equals_int ((pixel & bmask) >> bshift, 0x00); fail_unless_equals_int ((pixel & bmask) >> bshift, 0x00);
} */
} }
GST_START_TEST (test_crop_to_1x1) GST_START_TEST (test_crop_to_1x1)
@ -459,11 +408,15 @@ GST_START_TEST (test_cropping)
GST_END_TEST; GST_END_TEST;
static gboolean static GstPadProbeReturn
buffer_probe_cb (GstPad * pad, GstBuffer * buf, GstBuffer ** p_buf) buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer data)
{ {
GstBuffer **p_buf = data;
GstBuffer *buf = GST_PAD_PROBE_INFO_BUFFER (info);
gst_buffer_replace (p_buf, buf); gst_buffer_replace (p_buf, buf);
return TRUE; /* keep data */
return GST_PAD_PROBE_OK; /* keep data */
} }
GST_START_TEST (test_passthrough) GST_START_TEST (test_passthrough)
@ -479,7 +432,8 @@ GST_START_TEST (test_passthrough)
srcpad = gst_element_get_static_pad (ctx.src, "src"); srcpad = gst_element_get_static_pad (ctx.src, "src");
fail_unless (srcpad != NULL); fail_unless (srcpad != NULL);
gst_pad_add_buffer_probe (srcpad, G_CALLBACK (buffer_probe_cb), &gen_buf); gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe_cb,
&gen_buf, NULL);
gst_object_unref (srcpad); gst_object_unref (srcpad);
g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL); g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL);
@ -535,17 +489,17 @@ GST_START_TEST (test_caps_transform)
fail_unless (klass != NULL); fail_unless (klass != NULL);
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), "format", G_TYPE_STRING, "I420",
"framerate", GST_TYPE_FRACTION, 1, 1, "framerate", GST_TYPE_FRACTION, 1, 1,
"width", G_TYPE_INT, 200, "height", G_TYPE_INT, 100, NULL); "width", G_TYPE_INT, 200, "height", G_TYPE_INT, 100, NULL);
/* by default, it should be no cropping and hence passthrough */ /* by default, it should be no cropping and hence passthrough */
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_is_equal (adj_caps, caps)); fail_unless (gst_caps_is_equal (adj_caps, caps));
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_is_equal (adj_caps, caps)); fail_unless (gst_caps_is_equal (adj_caps, caps));
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
@ -554,12 +508,12 @@ GST_START_TEST (test_caps_transform)
g_object_set (ctx.crop, "left", 1, "right", 3, "top", 5, "bottom", 7, NULL); g_object_set (ctx.crop, "left", 1, "right", 3, "top", 5, "bottom", 7, NULL);
g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL); g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL);
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_is_equal (adj_caps, caps)); fail_unless (gst_caps_is_equal (adj_caps, caps));
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_is_equal (adj_caps, caps)); fail_unless (gst_caps_is_equal (adj_caps, caps));
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
@ -570,7 +524,7 @@ GST_START_TEST (test_caps_transform)
/* ========= (1) fixed value ============================================= */ /* ========= (1) fixed value ============================================= */
/* sink => source, source must be bigger if we crop stuff off */ /* sink => source, source must be bigger if we crop stuff off */
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -586,7 +540,7 @@ GST_START_TEST (test_caps_transform)
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
/* source => sink becomes smaller */ /* source => sink becomes smaller */
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -608,7 +562,7 @@ GST_START_TEST (test_caps_transform)
"height", GST_TYPE_INT_RANGE, 3000, 4000, NULL); "height", GST_TYPE_INT_RANGE, 3000, 4000, NULL);
/* sink => source, source must be bigger if we crop stuff off */ /* sink => source, source must be bigger if we crop stuff off */
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -626,7 +580,7 @@ GST_START_TEST (test_caps_transform)
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
/* source => sink becomes smaller */ /* source => sink becomes smaller */
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -650,7 +604,7 @@ GST_START_TEST (test_caps_transform)
"height", GST_TYPE_INT_RANGE, 2, G_MAXINT, NULL); "height", GST_TYPE_INT_RANGE, 2, G_MAXINT, NULL);
/* sink => source, source must be bigger if we crop stuff off */ /* sink => source, source must be bigger if we crop stuff off */
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -668,7 +622,7 @@ GST_START_TEST (test_caps_transform)
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
/* source => sink becomes smaller */ /* source => sink becomes smaller */
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -715,7 +669,7 @@ GST_START_TEST (test_caps_transform)
} }
/* sink => source, source must be bigger if we crop stuff off */ /* sink => source, source must be bigger if we crop stuff off */
adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =
@ -736,7 +690,7 @@ GST_START_TEST (test_caps_transform)
gst_caps_unref (adj_caps); gst_caps_unref (adj_caps);
/* source => sink becomes smaller */ /* source => sink becomes smaller */
adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps); adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps, NULL);
fail_unless (adj_caps != NULL); fail_unless (adj_caps != NULL);
fail_unless (gst_caps_get_size (adj_caps) == 1); fail_unless (gst_caps_get_size (adj_caps) == 1);
w_val = w_val =

View file

@ -34,12 +34,7 @@ gboolean have_eos = FALSE;
GstPad *mysrcpad, *mysinkpad; GstPad *mysrcpad, *mysinkpad;
#define VIDEO_CAPS_TEMPLATE_STRING \ #define VIDEO_CAPS_TEMPLATE_STRING \
GST_VIDEO_CAPS_YUV ("I420") ";" \ GST_VIDEO_CAPS_MAKE ("{ I420, AYUV, YUY2, UYVY, YVYU, xRGB }")
GST_VIDEO_CAPS_YUV ("AYUV") ";" \
GST_VIDEO_CAPS_YUV ("YUY2") ";" \
GST_VIDEO_CAPS_YUV ("UYVY") ";" \
GST_VIDEO_CAPS_YUV ("YVYU") ";" \
GST_VIDEO_CAPS_xRGB
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
@ -92,11 +87,12 @@ check_filter_caps (const gchar * name, GstCaps * caps, gint size,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing"); "could not set to playing");
gst_pad_set_caps (mysrcpad, caps);
for (i = 0; i < num_buffers; ++i) { for (i = 0; i < num_buffers; ++i) {
inbuffer = gst_buffer_new_and_alloc (size); inbuffer = gst_buffer_new_and_alloc (size);
/* makes valgrind's memcheck happier */ /* makes valgrind's memcheck happier */
memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer)); gst_buffer_memset (inbuffer, 0, 0, size);
gst_buffer_set_caps (inbuffer, caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0; GST_BUFFER_TIMESTAMP (inbuffer) = 0;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
@ -111,7 +107,7 @@ check_filter_caps (const gchar * name, GstCaps * caps, gint size,
switch (i) { switch (i) {
case 0: case 0:
fail_unless (GST_BUFFER_SIZE (outbuffer) == size); fail_unless (gst_buffer_get_size (outbuffer) == size);
/* no check on filter operation itself */ /* no check on filter operation itself */
break; break;
default: default:
@ -140,7 +136,6 @@ check_filter (const gchar * name, gint num_buffers, const gchar * prop, ...)
385, 289}, { 385, 289}, {
385, 385}}; 385, 385}};
gint i, n, r; gint i, n, r;
GstVideoFormat format;
gint size; gint size;
GstCaps *templ = gst_caps_from_string (VIDEO_CAPS_TEMPLATE_STRING); GstCaps *templ = gst_caps_from_string (VIDEO_CAPS_TEMPLATE_STRING);
va_list varargs; va_list varargs;
@ -155,15 +150,16 @@ check_filter (const gchar * name, gint num_buffers, const gchar * prop, ...)
/* try various resolutions */ /* try various resolutions */
for (r = 0; r < G_N_ELEMENTS (resolutions); ++r) { for (r = 0; r < G_N_ELEMENTS (resolutions); ++r) {
GstVideoInfo info;
caps = gst_caps_make_writable (caps); caps = gst_caps_make_writable (caps);
gst_caps_set_simple (caps, "width", G_TYPE_INT, resolutions[r].width, gst_caps_set_simple (caps, "width", G_TYPE_INT, resolutions[r].width,
"height", G_TYPE_INT, resolutions[r].height, "height", G_TYPE_INT, resolutions[r].height,
"framerate", GST_TYPE_FRACTION, 25, 1, NULL); "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
GST_DEBUG ("Testing with caps: %" GST_PTR_FORMAT, caps); GST_DEBUG ("Testing with caps: %" GST_PTR_FORMAT, caps);
gst_video_format_parse_caps (caps, &format, NULL, NULL); gst_video_info_from_caps (&info, caps);
size = gst_video_format_get_size (format, resolutions[r].width, size = GST_VIDEO_INFO_SIZE (&info);
resolutions[r].height);
va_start (varargs, prop); va_start (varargs, prop);
check_filter_caps (name, caps, size, num_buffers, prop, varargs); check_filter_caps (name, caps, size, num_buffers, prop, varargs);

View file

@ -29,8 +29,8 @@
* get_peer, and then remove references in every test function */ * get_peer, and then remove references in every test function */
static GstPad *mysrcpad, *mysinkpad; static GstPad *mysrcpad, *mysinkpad;
#define VIDEO_CAPS_STRING "video/x-raw-yuv, " \ #define VIDEO_CAPS_STRING "video/x-raw, " \
"format = (fourcc) I420, "\ "format = (string) I420, "\
"width = (int) 384, " \ "width = (int) 384, " \
"height = (int) 288, " \ "height = (int) 288, " \
"framerate = (fraction) 25/1, " \ "framerate = (fraction) 25/1, " \
@ -97,9 +97,9 @@ GST_START_TEST (test_y4m)
size = 384 * 288 * 3 / 2; size = 384 * 288 * 3 / 2;
inbuffer = gst_buffer_new_and_alloc (size); inbuffer = gst_buffer_new_and_alloc (size);
/* makes valgrind's memcheck happier */ /* makes valgrind's memcheck happier */
memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer)); gst_buffer_memset (inbuffer, 0, 0, size);
caps = gst_caps_from_string (VIDEO_CAPS_STRING); caps = gst_caps_from_string (VIDEO_CAPS_STRING);
gst_buffer_set_caps (inbuffer, caps); gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0; GST_BUFFER_TIMESTAMP (inbuffer) = 0;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -110,27 +110,28 @@ GST_START_TEST (test_y4m)
/* clean up buffers */ /* clean up buffers */
for (i = 0; i < num_buffers; ++i) { for (i = 0; i < num_buffers; ++i) {
gchar *data; gchar *data, *orig;
gsize outsize;
outbuffer = GST_BUFFER (buffers->data); outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL); fail_if (outbuffer == NULL);
switch (i) { switch (i) {
case 0: case 0:
fail_unless (GST_BUFFER_SIZE (outbuffer) > size); data = orig = gst_buffer_map (outbuffer, &outsize, NULL, GST_MAP_READ);
fail_unless (memcmp (data0, GST_BUFFER_DATA (outbuffer),
strlen (data0)) == 0 || fail_unless (outsize > size);
memcmp (data1, GST_BUFFER_DATA (outbuffer), strlen (data1)) == 0); fail_unless (memcmp (data, data0, strlen (data0)) == 0 ||
memcmp (data, data1, strlen (data1)) == 0);
/* so we know there is a newline */ /* so we know there is a newline */
data = (gchar *) GST_BUFFER_DATA (outbuffer);
data = strchr (data, '\n'); data = strchr (data, '\n');
fail_unless (data != NULL); fail_unless (data != NULL);
data++; data++;
fail_unless (memcmp (data2, data, strlen (data2)) == 0); fail_unless (memcmp (data2, data, strlen (data2)) == 0);
data += strlen (data2); data += strlen (data2);
/* remainder must be frame data */ /* remainder must be frame data */
fail_unless ((data - (gchar *) GST_BUFFER_DATA (outbuffer)) + size == fail_unless (data - orig + size == outsize);
GST_BUFFER_SIZE (outbuffer)); gst_buffer_unmap (outbuffer, orig, outsize);
break; break;
default: default:
break; break;

View file

@ -18,46 +18,55 @@
*/ */
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/audio/audio.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
static guint16 static guint16
buffer_get_first_sample (GstBuffer * buf) _get_first_sample (GstSample * sample)
{ {
GstStructure *s; GstAudioInfo info;
gint w, d, c, r, e; GstCaps *caps;
GstBuffer *buf;
guint8 *data;
gsize size;
guint16 res;
fail_unless (buf != NULL, "NULL buffer"); fail_unless (sample != NULL, "NULL sample");
fail_unless (GST_BUFFER_CAPS (buf) != NULL, "buffer without caps");
/* log buffer details */ caps = gst_sample_get_caps (sample);
fail_unless (caps != NULL, "sample without caps");
buf = gst_sample_get_buffer (sample);
GST_DEBUG ("buffer with size=%u, caps=%" GST_PTR_FORMAT, GST_DEBUG ("buffer with size=%u, caps=%" GST_PTR_FORMAT,
GST_BUFFER_SIZE (buf), GST_BUFFER_CAPS (buf)); gst_buffer_get_size (buf), caps);
GST_MEMDUMP ("buffer data from decoder", GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf)); data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
/* log buffer details */
GST_MEMDUMP ("buffer data from decoder", data, size);
/* make sure it's the format we expect */ /* make sure it's the format we expect */
s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0); fail_unless (gst_audio_info_from_caps (&info, caps));
fail_unless_equals_string (gst_structure_get_name (s), "audio/x-raw-int");
fail_unless (gst_structure_get_int (s, "width", &w)); fail_unless_equals_int (GST_AUDIO_INFO_WIDTH (&info), 16);
fail_unless_equals_int (w, 16); fail_unless_equals_int (GST_AUDIO_INFO_DEPTH (&info), 16);
fail_unless (gst_structure_get_int (s, "depth", &d)); fail_unless_equals_int (GST_AUDIO_INFO_RATE (&info), 44100);
fail_unless_equals_int (d, 16); fail_unless_equals_int (GST_AUDIO_INFO_CHANNELS (&info), 1);
fail_unless (gst_structure_get_int (s, "rate", &r));
fail_unless_equals_int (r, 44100); if (GST_AUDIO_INFO_IS_LITTLE_ENDIAN (&info))
fail_unless (gst_structure_get_int (s, "channels", &c)); res = GST_READ_UINT16_LE (data);
fail_unless_equals_int (c, 1);
fail_unless (gst_structure_get_int (s, "endianness", &e));
if (e == G_BIG_ENDIAN)
return GST_READ_UINT16_BE (GST_BUFFER_DATA (buf));
else else
return GST_READ_UINT16_LE (GST_BUFFER_DATA (buf)); res = GST_READ_UINT16_BE (data);
gst_buffer_unmap (buf, data, size);
return res;
} }
GST_START_TEST (test_decode) GST_START_TEST (test_decode)
{ {
GstElement *pipeline; GstElement *pipeline;
GstElement *appsink; GstElement *appsink;
GstBuffer *buffer = NULL; GstSample *sample = NULL;
guint16 first_sample = 0; guint16 first_sample = 0;
guint size = 0; guint size = 0;
gchar *path = gchar *path =
@ -78,17 +87,16 @@ GST_START_TEST (test_decode)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
do { do {
g_signal_emit_by_name (appsink, "pull-buffer", &buffer); g_signal_emit_by_name (appsink, "pull-sample", &sample);
if (buffer == NULL) if (sample == NULL)
break; break;
if (first_sample == 0) if (first_sample == 0)
first_sample = buffer_get_first_sample (buffer); first_sample = _get_first_sample (sample);
GST_DEBUG ("buffer: %d\n", buffer->size);
GST_DEBUG ("buffer: %04x\n", buffer_get_first_sample (buffer));
size += buffer->size;
gst_buffer_unref (buffer); size += gst_buffer_get_size (gst_sample_get_buffer (sample));
buffer = NULL;
gst_sample_unref (sample);
sample = NULL;
} }
while (TRUE); while (TRUE);
@ -108,7 +116,7 @@ GST_START_TEST (test_decode_seek_full)
GstElement *pipeline; GstElement *pipeline;
GstElement *appsink; GstElement *appsink;
GstEvent *event; GstEvent *event;
GstBuffer *buffer = NULL; GstSample *sample = NULL;
guint16 first_sample = 0; guint16 first_sample = 0;
guint size = 0; guint size = 0;
gchar *path = gchar *path =
@ -137,15 +145,15 @@ GST_START_TEST (test_decode_seek_full)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
do { do {
g_signal_emit_by_name (appsink, "pull-buffer", &buffer); g_signal_emit_by_name (appsink, "pull-sample", &sample);
if (buffer == NULL) if (sample == NULL)
break; break;
if (first_sample == 0) if (first_sample == 0)
first_sample = buffer_get_first_sample (buffer); first_sample = _get_first_sample (sample);
size += buffer->size; size += gst_buffer_get_size (gst_sample_get_buffer (sample));
gst_buffer_unref (buffer); gst_sample_unref (sample);
buffer = NULL; sample = NULL;
} }
while (TRUE); while (TRUE);
@ -167,7 +175,7 @@ GST_START_TEST (test_decode_seek_partial)
GstElement *pipeline; GstElement *pipeline;
GstElement *appsink; GstElement *appsink;
GstEvent *event; GstEvent *event;
GstBuffer *buffer = NULL; GstSample *sample = NULL;
guint size = 0; guint size = 0;
guint16 first_sample = 0; guint16 first_sample = 0;
gchar *path = gchar *path =
@ -198,19 +206,19 @@ GST_START_TEST (test_decode_seek_partial)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
do { do {
GST_DEBUG ("pulling buffer"); GST_DEBUG ("pulling sample");
g_signal_emit_by_name (appsink, "pull-buffer", &buffer); g_signal_emit_by_name (appsink, "pull-sample", &sample);
GST_DEBUG ("pulled buffer %p", buffer); GST_DEBUG ("pulled sample %p", sample);
if (buffer == NULL) if (sample == NULL)
break; break;
if (first_sample == 0) { if (first_sample == 0) {
fail_unless_equals_int (GST_BUFFER_OFFSET (buffer), 0L); // fail_unless_equals_int (GST_BUFFER_OFFSET (buffer), 0L);
first_sample = buffer_get_first_sample (buffer); first_sample = _get_first_sample (sample);
} }
size += buffer->size; size += gst_buffer_get_size (gst_sample_get_buffer (sample));
gst_buffer_unref (buffer); gst_sample_unref (sample);
buffer = NULL; sample = NULL;
} }
while (TRUE); while (TRUE);

View file

@ -112,7 +112,7 @@ test_mux_tags (const gchar * tag_str, const gchar * caps,
setter = GST_TAG_SETTER (mux); setter = GST_TAG_SETTER (mux);
fail_unless (setter != NULL); fail_unless (setter != NULL);
sent_tags = gst_structure_from_string (tag_str, NULL); sent_tags = gst_tag_list_new_from_string (tag_str);
fail_unless (sent_tags != NULL); fail_unless (sent_tags != NULL);
gst_tag_setter_merge_tags (setter, sent_tags, GST_TAG_MERGE_REPLACE); gst_tag_setter_merge_tags (setter, sent_tags, GST_TAG_MERGE_REPLACE);
gst_tag_list_free (sent_tags); gst_tag_list_free (sent_tags);
@ -176,7 +176,7 @@ test_demux_tags (const gchar * tag_str, const gchar * demuxer,
bus_watch = gst_bus_add_watch (bus, bus_handler, loop); bus_watch = gst_bus_add_watch (bus, bus_handler, loop);
gst_object_unref (bus); gst_object_unref (bus);
sent_tags = gst_structure_from_string (tag_str, NULL); sent_tags = gst_tag_list_new_from_string (tag_str);
fail_unless (sent_tags != NULL); fail_unless (sent_tags != NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
@ -186,18 +186,18 @@ test_demux_tags (const gchar * tag_str, const gchar * demuxer,
/* verify tags */ /* verify tags */
fail_unless (received_tags != NULL); fail_unless (received_tags != NULL);
n_recv = gst_structure_n_fields (received_tags); n_recv = gst_tag_list_n_tags (received_tags);
n_sent = gst_structure_n_fields (sent_tags); n_sent = gst_tag_list_n_tags (sent_tags);
fail_unless (n_recv >= n_sent); fail_unless (n_recv >= n_sent);
/* FIXME: compare taglits values */ /* FIXME: compare taglits values */
for (i = 0; i < n_sent; i++) { for (i = 0; i < n_sent; i++) {
name_sent = gst_structure_nth_field_name (sent_tags, i); name_sent = gst_tag_list_nth_tag_name (sent_tags, i);
value_sent = gst_structure_get_value (sent_tags, name_sent); value_sent = gst_tag_list_get_value (sent_tags, name_sent);
found = FALSE; found = FALSE;
for (j = 0; j < n_recv; j++) { for (j = 0; j < n_recv; j++) {
name_recv = gst_structure_nth_field_name (received_tags, j); name_recv = gst_tag_list_nth_tag_name (received_tags, j);
if (!strcmp (name_sent, name_recv)) { if (!strcmp (name_sent, name_recv)) {
value_recv = gst_structure_get_value (received_tags, name_recv); value_recv = gst_tag_list_get_value (received_tags, name_recv);
comparison = gst_value_compare (value_sent, value_recv); comparison = gst_value_compare (value_sent, value_recv);
if (comparison != GST_VALUE_EQUAL) { if (comparison != GST_VALUE_EQUAL) {
gchar *vs = g_strdup_value_contents (value_sent); gchar *vs = g_strdup_value_contents (value_sent);
@ -267,7 +267,8 @@ test_tags (const gchar * tag_str, const gchar * caps, const gchar * muxer,
GST_START_TEST (test_common_tags) GST_START_TEST (test_common_tags)
{ {
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { if (!gst_registry_check_feature_version (gst_registry_get (), "qtdemux", 0,
10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old"); GST_INFO ("Skipping test, qtdemux either not available or too old");
return; return;
} }
@ -288,7 +289,8 @@ GST_END_TEST;
GST_START_TEST (test_geo_location_tags) GST_START_TEST (test_geo_location_tags)
{ {
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { if (!gst_registry_check_feature_version (gst_registry_get (), "qtdemux", 0,
10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old"); GST_INFO ("Skipping test, qtdemux either not available or too old");
return; return;
} }
@ -305,7 +307,8 @@ GST_END_TEST;
GST_START_TEST (test_user_tags) GST_START_TEST (test_user_tags)
{ {
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { if (!gst_registry_check_feature_version (gst_registry_get (), "qtdemux", 0,
10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old"); GST_INFO ("Skipping test, qtdemux either not available or too old");
return; return;
} }