libs/xmpwriter \
$(cxx_checks) \
$(check_orc) \
- pipelines/simple-launch-lines
-
-# TORTURE_TO_FIX = \
-# elements/adder
-
-# videoconvert takes too long, so disabled for now
-VALGRIND_TO_FIX = \
- elements/videoconvert \
- libs/video
-
-# FIXME 0.11: these tests don't even build at the moment
-ZERO_11_TO_PORT = \
+ pipelines/simple-launch-lines \
pipelines/streamheader \
pipelines/basetime \
pipelines/capsfilter-renegotiation \
elements/videoscale \
elements/videotestsrc \
elements/volume
-
-# FIXME 0.11: these tests don't pass at the moment
-ZERO_11_TO_FIX = \
elements/adder \
$(check_theora)
+# TORTURE_TO_FIX = \
+# elements/adder
+
+# videoconvert takes too long, so disabled for now
+VALGRIND_TO_FIX = \
+ elements/videoconvert \
+ libs/video
+
# these tests don't even pass
-noinst_PROGRAMS = $(check_libvisual) $(ZERO_11_TO_FIX)
+noinst_PROGRAMS = $(check_libvisual)
noinst_HEADERS = \
libs/struct_arm.h \
$(GST_BASE_LIBS) \
$(LDADD)
-elements_audiorate_LDADD = $(LDADD)
+elements_audiorate_LDADD = \
+ $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
+ $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
+ $(GST_BASE_LIBS) \
+ $(LDADD)
elements_audiorate_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_libvisual_LDADD = $(LDADD)
elements_textoverlay_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_volume_LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
+ $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
$(GST_CONTROLLER_LIBS) \
$(GST_BASE_LIBS) \
$(LDADD)
GST_DEBUG ("setup_appsink");
appsink = gst_check_setup_element ("appsink");
- mysrcpad = gst_check_setup_src_pad (appsink, &srctemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (appsink, &srctemplate);
return appsink;
}
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
global_testdata = 0;
testdata = 5; /* Arbitrary value */
- callbacks.new_buffer = callback_function;
+ callbacks.new_sample = callback_function;
gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, &testdata, NULL);
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
/* Pushing a buffer should run our callback */
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
mycaps = gst_caps_from_string ("application/x-gst-check");
fail_if (mycaps == NULL);
- len = gst_buffer_list_len (mylist);
+ len = gst_buffer_list_length (mylist);
fail_if (len != 0);
buffer = gst_buffer_new_and_alloc (sizeof (gint));
gst_buffer_fill (buffer, 0, &values[0], sizeof (gint));
- gst_buffer_set_caps (buffer, mycaps);
gst_buffer_list_add (mylist, buffer);
buffer = gst_buffer_new_and_alloc (sizeof (gint));
gst_buffer_fill (buffer, 0, &values[1], sizeof (gint));
- gst_buffer_set_caps (buffer, mycaps);
gst_buffer_list_add (mylist, buffer);
buffer = gst_buffer_new_and_alloc (sizeof (gint));
gst_buffer_fill (buffer, 0, &values[2], sizeof (gint));
- gst_buffer_set_caps (buffer, mycaps);
gst_buffer_list_add (mylist, buffer);
- return mylist;
-}
-
-static void
-check_buffer_list (GstBufferList * list)
-{
- guint len;
- GstBuffer *buf;
- GstCaps *caps;
-
- fail_unless (list == mylist);
- fail_unless (gst_buffer_list_len (list) == 3);
-
- len = gst_buffer_list_len (list);
-
- buf = gst_buffer_list_get (list, 0);
- fail_if (buf == NULL);
- gst_check_buffer_data (buf, &values[0], sizeof (gint));
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- fail_unless (gst_caps_is_equal (caps, mycaps));
- gst_caps_unref (caps);
-
- buf = gst_buffer_list_get (list, 1);
- fail_if (buf == NULL);
- gst_check_buffer_data (buf, &values[1], sizeof (gint));
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- gst_caps_unref (caps);
-
- buf = gst_buffer_list_get (list, 2);
- fail_if (buf == NULL);
- gst_check_buffer_data (buf, &values[2], sizeof (gint));
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- gst_caps_unref (caps);
-}
-
-static GstFlowReturn
-callback_function_buffer_list (GstAppSink * appsink, gpointer callback_data)
-{
- GstBufferList *list;
-
- list = gst_app_sink_pull_buffer_list (appsink);
- fail_unless (GST_IS_BUFFER_LIST (list));
-
- check_buffer_list (list);
+ gst_pad_set_caps (mysrcpad, mycaps);
+ gst_caps_unref (mycaps);
- gst_buffer_list_unref (list);
-
- return GST_FLOW_OK;
-}
-
-GST_START_TEST (test_buffer_list)
-{
- GstElement *sink;
- GstBufferList *list;
- GstAppSinkCallbacks callbacks = { NULL };
-
- sink = setup_appsink ();
-
- callbacks.new_buffer_list = callback_function_buffer_list;
-
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, NULL, NULL);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- list = create_buffer_list ();
- fail_unless (gst_pad_push_list (mysrcpad, list) == GST_FLOW_OK);
-
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_appsink (sink);
+ return mylist;
}
-GST_END_TEST;
-
static GstFlowReturn
-callback_function_buffer (GstAppSink * appsink, gpointer p_counter)
+callback_function_sample (GstAppSink * appsink, gpointer p_counter)
{
+ GstSample *sample;
GstBuffer *buf;
gint *p_int_counter = p_counter;
- buf = gst_app_sink_pull_buffer (appsink);
+ sample = gst_app_sink_pull_sample (appsink);
+ buf = gst_sample_get_buffer (sample);
fail_unless (GST_IS_BUFFER (buf));
/* buffer list has 3 buffers in two groups */
break;
}
- gst_buffer_unref (buf);
+ gst_sample_unref (sample);
*p_int_counter += 1;
sink = setup_appsink ();
- callbacks.new_buffer = callback_function_buffer;
+ callbacks.new_sample = callback_function_sample;
gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, &counter, NULL);
sink = setup_appsink ();
/* C calling convention to the rescue.. */
- g_signal_connect (sink, "new-buffer", G_CALLBACK (callback_function_buffer),
+ g_signal_connect (sink, "new-sample", G_CALLBACK (callback_function_sample),
&counter);
g_object_set (sink, "emit-signals", TRUE, NULL);
tcase_add_test (tc_chain, test_handoff_callback);
tcase_add_test (tc_chain, test_notify0);
tcase_add_test (tc_chain, test_notify1);
- tcase_add_test (tc_chain, test_buffer_list);
tcase_add_test (tc_chain, test_buffer_list_fallback);
tcase_add_test (tc_chain, test_buffer_list_fallback_signal);
GST_DEBUG ("setup_appsrc");
appsrc = gst_check_setup_element ("appsrc");
- mysinkpad = gst_check_setup_sink_pad (appsrc, &sinktemplate, NULL);
+ mysinkpad = gst_check_setup_sink_pad (appsrc, &sinktemplate);
gst_pad_set_active (mysinkpad, TRUE);
gst_check_teardown_element (appsrc);
}
-
-/*
- * Pushes 4 buffers into appsrc and checks the caps on them on the output.
- *
- * Appsrc is configured with caps=null, so the buffers should have the
- * same caps that they were pushed with.
- *
- * The 4 buffers have NULL, SAMPLE_CAPS, NULL, SAMPLE_CAPS caps,
- * respectively.
- */
-GST_START_TEST (test_appsrc_null_caps)
-{
- GstElement *src;
- GstBuffer *buffer;
- GList *iter;
- GstCaps *caps;
-
- src = setup_appsrc ();
-
- g_object_set (src, "caps", NULL, NULL);
- caps = gst_caps_from_string (SAMPLE_CAPS);
-
- ASSERT_SET_STATE (src, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS);
-
- buffer = gst_buffer_new_and_alloc (4);
- fail_unless (gst_app_src_push_buffer (GST_APP_SRC (src),
- buffer) == GST_FLOW_OK);
-
- buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
- fail_unless (gst_app_src_push_buffer (GST_APP_SRC (src),
- buffer) == GST_FLOW_OK);
-
- fail_unless (gst_app_src_end_of_stream (GST_APP_SRC (src)) == GST_FLOW_OK);
-
- /* Give some time to the appsrc loop to push the buffers */
- g_usleep (G_USEC_PER_SEC * 3);
-
- /* Check the output caps */
- fail_unless (g_list_length (buffers) == 2);
- iter = buffers;
- buffer = (GstBuffer *) iter->data;
- fail_unless (GST_BUFFER_CAPS (buffer) == NULL);
-
- iter = g_list_next (iter);
- buffer = (GstBuffer *) iter->data;
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
-
- ASSERT_SET_STATE (src, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- gst_caps_unref (caps);
- cleanup_appsrc (src);
-}
-
-GST_END_TEST;
-
-
/*
* Pushes 4 buffers into appsrc and checks the caps on them on the output.
*
{
GstElement *src;
GstBuffer *buffer;
- GList *iter;
GstCaps *caps;
src = setup_appsrc ();
buffer) == GST_FLOW_OK);
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
fail_unless (gst_app_src_push_buffer (GST_APP_SRC (src),
buffer) == GST_FLOW_OK);
buffer) == GST_FLOW_OK);
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
fail_unless (gst_app_src_push_buffer (GST_APP_SRC (src),
buffer) == GST_FLOW_OK);
/* Check the output caps */
fail_unless (g_list_length (buffers) == 4);
- for (iter = buffers; iter; iter = g_list_next (iter)) {
- GstBuffer *buf = (GstBuffer *) iter->data;
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buf), caps));
- }
+ fail_unless (gst_caps_is_equal (gst_pad_get_current_caps (mysinkpad), caps));
ASSERT_SET_STATE (src, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
gst_caps_unref (caps);
Suite *s = suite_create ("appsrc");
TCase *tc_chain = tcase_create ("general");
- tcase_add_test (tc_chain, test_appsrc_null_caps);
tcase_add_test (tc_chain, test_appsrc_non_null_caps);
suite_add_tcase (s, tc_chain);
#endif
#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
/* helper element to insert additional buffers overlapping with previous ones */
static gdouble injector_inject_probability = 0.0;
}
static GstFlowReturn
-test_injector_chain (GstPad * pad, GstBuffer * buf)
+test_injector_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstFlowReturn ret;
GstPad *srcpad;
pad = gst_pad_new_from_static_template (&sink_template, "sink");
gst_pad_set_chain_function (pad, test_injector_chain);
- gst_pad_set_getcaps_function (pad, gst_pad_proxy_getcaps);
- gst_pad_set_setcaps_function (pad, gst_pad_proxy_setcaps);
+ GST_PAD_SET_PROXY_CAPS (pad);
gst_element_add_pad (GST_ELEMENT (injector), pad);
pad = gst_pad_new_from_static_template (&src_template, "src");
- gst_pad_set_getcaps_function (pad, gst_pad_proxy_getcaps);
- gst_pad_set_setcaps_function (pad, gst_pad_proxy_setcaps);
+ GST_PAD_SET_PROXY_CAPS (pad);
gst_element_add_pad (GST_ELEMENT (injector), pad);
}
-static gboolean
-probe_cb (GstPad * pad, GstBuffer * buf, gdouble * drop_probability)
+static GstPadProbeReturn
+probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
+ GstBuffer *buf = GST_PAD_PROBE_INFO_BUFFER (info);
+ gdouble *drop_probability = user_data;
+
if (g_random_double () < *drop_probability) {
GST_LOG ("dropping buffer [t=%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "], "
"offset=%" G_GINT64_FORMAT ", offset_end=%" G_GINT64_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf));
- return FALSE; /* drop buffer */
+ return GST_PAD_PROBE_DROP; /* drop buffer */
}
- return TRUE; /* don't drop buffer */
+ return GST_PAD_PROBE_OK; /* don't drop buffer */
}
static void
GList *l, *bufs = NULL;
GstClockTime next_time = GST_CLOCK_TIME_NONE;
guint64 next_offset = GST_BUFFER_OFFSET_NONE;
+ GstAudioFormat fmt;
+ const GstAudioFormatInfo *finfo;
+ gint width;
+
+ fmt = gst_audio_format_from_string (format);
+ g_assert (format != GST_AUDIO_FORMAT_UNKNOWN);
+
+ finfo = gst_audio_format_get_info (fmt);
+ width = GST_AUDIO_FORMAT_INFO_WIDTH (finfo);
caps = gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT,
rate, "format", G_TYPE_STRING, format, NULL);
g_assert (drop_probability >= 0.0 && drop_probability <= 1.0);
g_assert (inject_probability >= 0.0 && inject_probability <= 1.0);
- g_assert (width > 0 && (width % 8) == 0);
pipe = gst_pipeline_new ("pipeline");
fail_unless (pipe != NULL);
srcpad = gst_element_get_static_pad (injector, "src");
fail_unless (srcpad != NULL);
- gst_pad_add_buffer_probe (srcpad, G_CALLBACK (probe_cb), &drop_probability);
+ gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BUFFER, probe_cb,
+ &drop_probability, NULL);
gst_object_unref (srcpad);
audiorate = gst_element_factory_make ("audiorate", "audiorate");
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 44100, NULL);
- srcpad = gst_check_setup_src_pad (audiorate, &srctemplate, caps);
- sinkpad = gst_check_setup_sink_pad (audiorate, &sinktemplate, caps);
+ srcpad = gst_check_setup_src_pad (audiorate, &srctemplate);
+ sinkpad = gst_check_setup_sink_pad (audiorate, &sinktemplate);
gst_pad_set_active (srcpad, TRUE);
gst_pad_set_active (sinkpad, TRUE);
"failed to set audiorate playing");
buf = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buf, caps);
+ gst_pad_set_caps (srcpad, caps);
GST_BUFFER_TIMESTAMP (buf) = 0;
gst_pad_push (srcpad, buf);
fail_unless_equals_int (g_list_length (buffers), 1);
buf = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buf, caps);
GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
gst_pad_push (srcpad, buf);
/* Now we should have 3 more buffers: the one we injected, plus _two_ filler
GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS,
"could not set to paused");
- mysrcpad = gst_check_setup_src_pad (audioresample, &srctemplate, caps);
+ mysrcpad = gst_check_setup_src_pad (audioresample, &srctemplate);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
gst_structure_set (structure, "depth", G_TYPE_INT, width, NULL);
fail_unless (gst_caps_is_fixed (caps));
- mysinkpad = gst_check_setup_sink_pad (audioresample, &sinktemplate, caps);
+ mysinkpad = gst_check_setup_sink_pad (audioresample, &sinktemplate);
/* this installs a getcaps func that will always return the caps we set
* later */
gst_pad_set_caps (mysinkpad, caps);
gint16 *p, *data;
audioresample = setup_audioresample (2, inrate, outrate, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
+ caps = gst_pad_get_current_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
offset += samples;
GST_BUFFER_OFFSET_END (inbuffer) = offset;
- gst_buffer_set_caps (inbuffer, caps);
-
p = data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
/* create a 16 bit signed ramp */
inrate, outrate, samples, numbuffers);
audioresample = setup_audioresample (2, inrate, outrate, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
+ caps = gst_pad_get_current_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
GST_BUFFER_OFFSET (inbuffer) = (j - 1) * 2 * samples;
GST_BUFFER_OFFSET_END (inbuffer) = j * 2 * samples + samples;
- gst_buffer_set_caps (inbuffer, caps);
-
p = data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
/* create a 16 bit signed ramp */
for (i = 0; i < samples; ++i) {
GstBuffer *inbuffer;
GstCaps *caps;
guint8 *data;
+ GstSegment segment;
audioresample = setup_audioresample (1, 9343, 48000, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
+ caps = gst_pad_get_current_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ newseg = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
inbuffer = gst_buffer_new_and_alloc (9343 * 4);
GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_OFFSET (inbuffer) = 0;
- gst_buffer_set_caps (inbuffer, caps);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
+ newseg = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
inbuffer = gst_buffer_new_and_alloc (9343 * 4);
GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_OFFSET (inbuffer) = 0;
- gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
return GST_FLOW_OK;
}
-#endif
static GstCaps *
live_switch_get_sink_caps (GstPad * pad)
{
GstCaps *result;
- result = gst_caps_copy (GST_PAD_CAPS (pad));
+ result = gst_caps_make_writable (gst_pad_get_current_caps (pad));
gst_caps_set_simple (result,
"rate", GST_TYPE_INT_RANGE, 48000, G_MAXINT, NULL);
return result;
}
+#endif
static void
live_switch_push (int rate, GstCaps * caps)
GstBuffer *inbuffer;
GstCaps *desired;
GList *l;
- guint8 *data;
desired = gst_caps_copy (caps);
gst_caps_set_simple (desired, "rate", G_TYPE_INT, rate, NULL);
GST_BUFFER_OFFSET_NONE, rate * 4, desired, &inbuffer) == GST_FLOW_OK);
#endif
inbuffer = gst_buffer_new_and_alloc (rate * 4);
- gst_buffer_set_caps (inbuffer, desired);
-
- /* When the basetransform hits the non-configured case it always
- * returns a buffer with exactly the same caps as we requested so the actual
- * renegotiation (if needed) will be done in the _chain*/
- fail_unless (inbuffer != NULL);
- GST_DEBUG ("desired: %" GST_PTR_FORMAT ".... got: %" GST_PTR_FORMAT,
- desired, GST_BUFFER_CAPS (inbuffer));
- fail_unless (gst_caps_is_equal (desired, GST_BUFFER_CAPS (inbuffer)));
-
- data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
- memset (data, 0, rate * 4);
- gst_buffer_unmap (inbuffer, data, rate * 4);
+ gst_buffer_memset (inbuffer, 0, 0, rate * 4);
GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GstElement *audioresample;
GstEvent *newseg;
GstCaps *caps;
+ GstSegment segment;
audioresample = setup_audioresample (4, 48000, 48000, 16, FALSE);
* tries to get a buffer with a rate higher then 48000 tries to renegotiate
* */
//gst_pad_set_bufferalloc_function (mysinkpad, live_switch_alloc_only_48000);
- gst_pad_set_getcaps_function (mysinkpad, live_switch_get_sink_caps);
+ //gst_pad_set_getcaps_function (mysinkpad, live_switch_get_sink_caps);
gst_pad_use_fixed_caps (mysrcpad);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
+ caps = gst_pad_get_current_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ newseg = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
/* downstream can provide the requested rate, a buffer alloc will be passed
for (quality = 0; quality < 11; quality += 5) {
GST_DEBUG ("Checking with quality %d", quality);
- test_pipeline (8, FALSE, 44100, 48000, quality);
- test_pipeline (8, FALSE, 48000, 44100, quality);
+ test_pipeline ("S8", 44100, 48000, quality);
+ test_pipeline ("S8", 48000, 44100, quality);
- test_pipeline (16, FALSE, 44100, 48000, quality);
- test_pipeline (16, FALSE, 48000, 44100, quality);
+ test_pipeline ("S16", 44100, 48000, quality);
+ test_pipeline ("S16", 48000, 44100, quality);
- test_pipeline (24, FALSE, 44100, 48000, quality);
- test_pipeline (24, FALSE, 48000, 44100, quality);
+ test_pipeline ("S24", 44100, 48000, quality);
+ test_pipeline ("S24", 48000, 44100, quality);
- test_pipeline (32, FALSE, 44100, 48000, quality);
- test_pipeline (32, FALSE, 48000, 44100, quality);
+ test_pipeline ("S32", 44100, 48000, quality);
+ test_pipeline ("S32", 48000, 44100, quality);
- test_pipeline (32, TRUE, 44100, 48000, quality);
- test_pipeline (32, TRUE, 48000, 44100, quality);
+ test_pipeline ("F32", 44100, 48000, quality);
+ test_pipeline ("F32", 48000, 44100, quality);
- test_pipeline (64, TRUE, 44100, 48000, quality);
- test_pipeline (64, TRUE, 48000, 44100, quality);
+ test_pipeline ("F64", 44100, 48000, quality);
+ test_pipeline ("F64", 48000, 44100, quality);
}
}
fail_unless (src != NULL);
pad = gst_element_get_static_pad (src, "src");
fail_unless (pad != NULL);
- caps = gst_pad_get_negotiated_caps (pad);
- GST_LOG ("negotiated audiotestsrc caps: %" GST_PTR_FORMAT, caps);
+ caps = gst_pad_get_current_caps (pad);
+ GST_LOG ("current audiotestsrc caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
s = gst_caps_get_structure (caps, 0);
fail_unless (gst_structure_get_int (s, "rate", &rate));
} \
return TRUE; \
} \
-static void compare_ffts_##ffttag (const GstBuffer *inbuffer, const GstBuffer *outbuffer) \
+static void compare_ffts_##ffttag (GstBuffer *inbuffer, GstBuffer *outbuffer) \
{ \
- int insamples = GST_BUFFER_SIZE (inbuffer) / sizeof(type) & ~1; \
- int outsamples = GST_BUFFER_SIZE (outbuffer) / sizeof(type) & ~1; \
+ gsize insize, outsize; \
+ gpointer indata, outdata; \
+ int insamples, outsamples; \
gdouble inspot, outspot; \
+ GstFFT##ffttag *inctx, *outctx; \
+ GstFFT##ffttag##Complex *in, *out; \
+ \
+ indata = gst_buffer_map (inbuffer, &insize, NULL, GST_MAP_READ); \
+ outdata = gst_buffer_map (outbuffer, &outsize, NULL, GST_MAP_READWRITE); \
\
- GstFFT##ffttag *inctx = gst_fft_##ffttag2##_new (insamples, FALSE); \
- GstFFT##ffttag##Complex *in = g_new (GstFFT##ffttag##Complex, insamples / 2 + 1); \
- GstFFT##ffttag *outctx = gst_fft_##ffttag2##_new (outsamples, FALSE); \
- GstFFT##ffttag##Complex *out = g_new (GstFFT##ffttag##Complex, outsamples / 2 + 1); \
+ insamples = insize / sizeof(type) & ~1; \
+ outsamples = outsize / sizeof(type) & ~1; \
+ inctx = gst_fft_##ffttag2##_new (insamples, FALSE); \
+ outctx = gst_fft_##ffttag2##_new (outsamples, FALSE); \
+ in = g_new (GstFFT##ffttag##Complex, insamples / 2 + 1); \
+ out = g_new (GstFFT##ffttag##Complex, outsamples / 2 + 1); \
\
- gst_fft_##ffttag2##_window (inctx, (type*)GST_BUFFER_DATA (inbuffer), \
+ gst_fft_##ffttag2##_window (inctx, (type*)indata, \
GST_FFT_WINDOW_HAMMING); \
- gst_fft_##ffttag2##_fft (inctx, (type*)GST_BUFFER_DATA (inbuffer), in); \
- gst_fft_##ffttag2##_window (outctx, (type*)GST_BUFFER_DATA (outbuffer), \
+ gst_fft_##ffttag2##_fft (inctx, (type*)indata, in); \
+ gst_fft_##ffttag2##_window (outctx, (type*)outdata, \
GST_FFT_WINDOW_HAMMING); \
- gst_fft_##ffttag2##_fft (outctx, (type*)GST_BUFFER_DATA (outbuffer), out); \
+ gst_fft_##ffttag2##_fft (outctx, (type*)outdata, out); \
\
inspot = find_main_frequency_spot_##ffttag (in, insamples / 2 + 1); \
outspot = find_main_frequency_spot_##ffttag (out, outsamples / 2 + 1); \
fail_unless (is_zero_except_##ffttag (in, insamples / 2 + 1, inspot)); \
fail_unless (is_zero_except_##ffttag (out, outsamples / 2 + 1, outspot)); \
\
+ gst_buffer_unmap (inbuffer, indata, insize); \
+ gst_buffer_unmap (outbuffer, outdata, outsize); \
+ \
gst_fft_##ffttag2##_free (inctx); \
gst_fft_##ffttag2##_free (outctx); \
g_free (in); \
#define FILL_BUFFER(type, desc, value); \
static void init_##type##_##desc (GstBuffer *buffer) \
{ \
- type *ptr = (type *) GST_BUFFER_DATA (buffer); \
- int i, nsamples = GST_BUFFER_SIZE (buffer) / sizeof (type); \
+ gsize size; \
+ type *ptr = gst_buffer_map (buffer, &size, NULL, GST_MAP_WRITE); \
+ int i, nsamples = size / sizeof (type); \
for (i = 0; i < nsamples; ++i) { \
*ptr++ = value; \
} \
static void
run_fft_pipeline (int inrate, int outrate, int quality, int width, gboolean fp,
- void (*init) (GstBuffer *),
- void (*compare_ffts) (const GstBuffer *, const GstBuffer *))
+ void (*init) (GstBuffer *), void (*compare_ffts) (GstBuffer *, GstBuffer *))
{
GstElement *audioresample;
GstBuffer *inbuffer, *outbuffer;
audioresample = setup_audioresample (1, inrate, outrate, width, fp);
fail_unless (audioresample != NULL);
g_object_set (audioresample, "quality", quality, NULL);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
+ caps = gst_pad_get_current_caps (mysrcpad);
fail_unless (gst_caps_is_fixed (caps));
fail_unless (gst_element_set_state (audioresample,
inbuffer = gst_buffer_new_and_alloc (nsamples * width / 8);
GST_BUFFER_DURATION (inbuffer) = GST_FRAMES_TO_CLOCK_TIME (nsamples, inrate);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_buffer_ref (inbuffer);
(*init) (inbuffer);
#include <unistd.h>
#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
+#undef GST_CAT_DEFAULT
#include "../../gst/gdp/dataprotocol.c"
/* For ease of programming we use globals to keep refs for our floating
GST_DEBUG ("setup_gdpdepay");
gdpdepay = gst_check_setup_element ("gdpdepay");
- mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdpdepay, &sinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate);
+ mysinkpad = gst_check_setup_sink_pad (gdpdepay, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- caps = gst_pad_get_caps (srcpad);
+ caps = gst_pad_query_caps (srcpad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
+ fail_if (gst_pad_get_current_caps (srcpad));
/* create caps and buffer packets and push them */
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
gdpdepay_push_per_byte ("caps payload", payload,
gst_dp_header_payload_length (header));
fail_unless_equals_int (g_list_length (buffers), 0);
- caps = gst_pad_get_caps (srcpad);
+ caps = gst_pad_query_caps (srcpad, NULL);
fail_if (gst_caps_is_any (caps));
gst_caps_unref (caps);
"could not set to playing");
/* make sure no caps are set yet */
- caps = gst_pad_get_caps (srcpad);
+ caps = gst_pad_query_caps (srcpad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
+ fail_if (gst_pad_get_current_caps (srcpad));
/* create caps and buffer packets and push them as one buffer */
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
GST_DEBUG ("setup_gdpdepay");
gdpdepay = gst_check_setup_element ("gdpdepay");
- mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate, NULL);
- myshsinkpad = gst_check_setup_sink_pad (gdpdepay, &shsinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate);
+ myshsinkpad = gst_check_setup_sink_pad (gdpdepay, &shsinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (myshsinkpad, TRUE);
* have a streamheader set */
GST_START_TEST (test_streamheader)
{
- GstCaps *caps, *padcaps;
+ GstCaps *caps;
GstPad *srcpad;
GstElement *gdpdepay;
GstBuffer *buffer, *inbuffer, *outbuffer, *shbuffer;
"could not set to playing");
/* make sure no caps are set yet */
- caps = gst_pad_get_caps (srcpad);
+ caps = gst_pad_query_caps (srcpad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
+ fail_if (gst_pad_get_current_caps (srcpad));
/* create a streamheader buffer and the caps containing it */
caps = gst_caps_from_string ("application/x-gst-test-streamheader");
gst_structure_set_value (structure, "streamheader", &array);
g_value_unset (&array);
- gst_buffer_set_caps (buffer, caps);
-
/* create GDP packets for the caps and the buffer, and put them in one
* GDP buffer */
fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
fail_unless (GST_BUFFER_FLAG_IS_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS));
- padcaps = gst_pad_get_negotiated_caps (myshsinkpad);
- caps = gst_buffer_get_caps (outbuffer);
- fail_if (caps == NULL);
- fail_if (padcaps == NULL);
- GST_DEBUG ("caps: %" GST_PTR_FORMAT ", padcaps: %" GST_PTR_FORMAT, caps,
- padcaps);
- fail_unless (gst_caps_is_equal (padcaps, caps));
-
/* FIXME: get streamheader, compare data with buffer */
gst_buffer_unref (outbuffer);
- gst_caps_unref (padcaps);
gst_caps_unref (caps);
/* clean up */
* Boston, MA 02111-1307, USA.
*/
+#include "config.h"
#include <string.h>
#include <unistd.h>
#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
+#undef GST_CAT_DEFAULT
#include "../../gst/gdp/dataprotocol.c"
/* For ease of programming we use globals to keep refs for our floating
GST_DEBUG ("setup_gdppay");
gdppay = gst_check_setup_element ("gdppay");
- mysrcpad = gst_check_setup_src_pad (gdppay, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (gdppay, &srctemplate);
+ mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
GstCaps *caps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer;
+ GstSegment segment;
GstEvent *event;
gchar *caps_string;
gint length;
"could not set to playing");
GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ segment.stop = GST_SECOND;
+ event = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, event));
/* no buffer should be pushed yet, waiting for caps */
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
caps_string = gst_caps_to_string (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* second buffer */
GST_DEBUG ("second buffer");
inbuffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (inbuffer, caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GST_DEBUG ("setup_gdppay");
gdppay = gst_check_setup_element ("gdppay");
- myshsrcpad = gst_check_setup_src_pad (gdppay, &shsrctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate, NULL);
+ myshsrcpad = gst_check_setup_src_pad (gdppay, &shsrctemplate);
+ mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate);
gst_pad_set_active (myshsrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
GstCaps *caps, *sinkcaps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer, *shbuffer;
+ GstSegment segment;
GstEvent *event;
gchar *caps_string;
gint length;
"could not set to playing");
GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ segment.stop = GST_SECOND;
+ event = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (myshsrcpad, event));
/* no buffer should be pushed yet, still waiting for caps */
g_value_unset (&array);
caps_string = gst_caps_to_string (caps);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (myshsrcpad, caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference */
/* our sink pad should now have GDP caps with a streamheader that includes
* GDP wrappings of our streamheader */
- sinkcaps = gst_pad_get_negotiated_caps (mysinkpad);
+ sinkcaps = gst_pad_get_current_caps (mysinkpad);
structure = gst_caps_get_structure (sinkcaps, 0);
fail_unless_equals_string ((gchar *) gst_structure_get_name (structure),
"application/x-gdp");
/* second buffer */
GST_DEBUG ("second buffer");
inbuffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (inbuffer, caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GstCaps *caps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer;
+ GstSegment segment;
GstEvent *event;
gchar *caps_string;
gint length;
"could not set to playing");
GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ event = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, event));
/* no buffer should be pushed yet, waiting for caps */
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
caps_string = gst_caps_to_string (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GST_DEBUG ("setup_multifdsink");
multifdsink = gst_check_setup_element ("multifdsink");
- mysrcpad = gst_check_setup_src_pad (multifdsink, &srctemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (multifdsink, &srctemplate);
return multifdsink;
}
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
caps = gst_caps_from_string ("application/x-gst-check");
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
gst_buffer_fill (buffer, 0, "dead", 4);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
g_value_unset (&array);
ASSERT_CAPS_REFCOUNT (*caps, "streamheader caps", 1);
- /* set our streamheadery caps on the buffers */
- gst_buffer_set_caps (*hbuf1, *caps);
- gst_buffer_set_caps (*hbuf2, *caps);
- ASSERT_CAPS_REFCOUNT (*caps, "streamheader caps", 3);
-
/* we want to keep them around for the tests */
gst_buffer_ref (*hbuf1);
gst_buffer_ref (*hbuf2);
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
caps = gst_caps_from_string ("application/x-gst-check");
+ gst_pad_set_caps (mysrcpad, caps);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
/* copy some id */
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
/* copy some id */
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
caps = gst_caps_from_string ("application/x-gst-check");
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
+ gst_pad_set_caps (mysrcpad, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
for (i = 0; i < 9; i++) {
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
/* mark most buffers as delta */
if (i != 0 && i != 4 && i != 8)
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
/* copy some id */
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
caps = gst_caps_from_string ("application/x-gst-check");
+ gst_pad_set_caps (mysrcpad, caps);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
/* mark most buffers as delta */
if (i != 0 && i != 4 && i != 8)
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
/* copy some id */
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
caps = gst_caps_from_string ("application/x-gst-check");
+ gst_pad_set_caps (mysrcpad, caps);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* now add our client */
gchar *data;
buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
/* copy some id */
data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
static GType gst_audio_codec_sink_get_type (void);
static GType gst_video_codec_sink_get_type (void);
-#undef parent_class
-#define parent_class caps_src_parent_class
typedef struct _GstCapsSrc GstCapsSrc;
typedef GstPushSrcClass GstCapsSrcClass;
};
static GstURIType
-gst_caps_src_uri_get_type (void)
+gst_caps_src_uri_get_type (GType type)
{
return GST_URI_SRC;
}
static const gchar *const *
-gst_caps_src_uri_get_protocols (void)
+gst_caps_src_uri_get_protocols (GType type)
{
static const gchar *protocols[] = { "caps", NULL };
return protocols;
}
-static const gchar *
+static gchar *
gst_caps_src_uri_get_uri (GstURIHandler * handler)
{
GstCapsSrc *src = (GstCapsSrc *) handler;
- return src->uri;
+ return g_strdup (src->uri);
}
static gboolean
-gst_caps_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_caps_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstCapsSrc *src = (GstCapsSrc *) handler;
iface->set_uri = gst_caps_src_uri_set_uri;
}
-static void
-gst_caps_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_caps_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-GST_BOILERPLATE_FULL (GstCapsSrc, gst_caps_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_caps_src_init_type);
-
-static void
-gst_caps_src_base_init (gpointer klass)
-{
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details_simple (element_class,
- "CapsSource", "Source/Generic", "yep", "me");
-}
+G_DEFINE_TYPE_WITH_CODE (GstCapsSrc, gst_caps_src, GST_TYPE_PUSH_SRC,
+ G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
+ gst_caps_src_uri_handler_init));
static void
gst_caps_src_finalize (GObject * object)
src->caps = NULL;
g_free (src->uri);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gst_caps_src_parent_class)->finalize (object);
}
static GstFlowReturn
GstBuffer *buf;
if (src->nbuffers >= NBUFFERS) {
- return GST_FLOW_UNEXPECTED;
+ return GST_FLOW_EOS;
}
if (!src->caps) {
}
buf = gst_buffer_new ();
- gst_buffer_set_caps (buf, src->caps);
GST_BUFFER_TIMESTAMP (buf) =
gst_util_uint64_scale (src->nbuffers, GST_SECOND, 25);
src->nbuffers++;
gst_caps_src_class_init (GstCapsSrcClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstPushSrcClass *pushsrc_class = (GstPushSrcClass *) klass;
+ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_templ));
+ gst_element_class_set_details_simple (element_class,
+ "CapsSource", "Source/Generic", "yep", "me");
gobject_class->finalize = gst_caps_src_finalize;
pushsrc_class->create = gst_caps_src_create;
}
static void
-gst_caps_src_init (GstCapsSrc * src, GstCapsSrcClass * klass)
+gst_caps_src_init (GstCapsSrc * src)
{
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
}
-#undef parent_class
-#define parent_class codec_sink_parent_class
-
typedef struct _GstCodecSink GstCodecSink;
typedef GstBaseSinkClass GstCodecSinkClass;
gint n_raw, n_compressed;
};
-GST_BOILERPLATE (GstCodecSink, gst_codec_sink, GstBaseSink, GST_TYPE_BASE_SINK);
-
-static void
-gst_codec_sink_base_init (gpointer klass)
-{
-}
+G_DEFINE_TYPE (GstCodecSink, gst_codec_sink, GST_TYPE_BASE_SINK);
static gboolean
gst_codec_sink_start (GstBaseSink * bsink)
}
static void
-gst_codec_sink_init (GstCodecSink * sink, GstCodecSinkClass * klass)
+gst_codec_sink_init (GstCodecSink * sink)
{
}
-#undef parent_class
-#define parent_class audio_codec_sink_parent_class
-
typedef GstCodecSink GstAudioCodecSink;
typedef GstCodecSinkClass GstAudioCodecSinkClass;
-static void
-gst_audio_codec_sink_init_type (GType type)
-{
- static const GInterfaceInfo svol_iface_info = {
- NULL, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_iface_info);
-}
-
-GST_BOILERPLATE_FULL (GstAudioCodecSink, gst_audio_codec_sink, GstBaseSink,
- gst_codec_sink_get_type (), gst_audio_codec_sink_init_type);
-
-static void
-gst_audio_codec_sink_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw; audio/x-compressed")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_templ));
- gst_element_class_set_details_simple (element_class,
- "AudioCodecSink", "Sink/Audio", "yep", "me");
-}
+G_DEFINE_TYPE_WITH_CODE (GstAudioCodecSink, gst_audio_codec_sink,
+ gst_codec_sink_get_type (),
+ G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
static void
gst_audio_codec_sink_set_property (GObject * object,
gst_audio_codec_sink_class_init (GstAudioCodecSinkClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
+ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw; audio/x-compressed")
+ );
gobject_class->set_property = gst_audio_codec_sink_set_property;
gobject_class->get_property = gst_audio_codec_sink_get_property;
g_param_spec_boolean ("mute", "Mute",
"Mute", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
+ gst_element_class_set_details_simple (element_class,
+ "AudioCodecSink", "Sink/Audio", "yep", "me");
+
basesink_class->set_caps = gst_audio_codec_sink_set_caps;
}
static void
-gst_audio_codec_sink_init (GstAudioCodecSink * sink,
- GstAudioCodecSinkClass * klass)
+gst_audio_codec_sink_init (GstAudioCodecSink * sink)
{
sink->audio = TRUE;
}
-#undef parent_class
-#define parent_class video_codec_sink_parent_class
-
typedef GstCodecSink GstVideoCodecSink;
typedef GstCodecSinkClass GstVideoCodecSinkClass;
-GST_BOILERPLATE (GstVideoCodecSink, gst_video_codec_sink, GstBaseSink,
+G_DEFINE_TYPE (GstVideoCodecSink, gst_video_codec_sink,
gst_codec_sink_get_type ());
-static void
-gst_video_codec_sink_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw; video/x-compressed")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_templ));
- gst_element_class_set_details_simple (element_class,
- "VideoCodecSink", "Sink/Video", "yep", "me");
-}
-
static gboolean
gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{
gst_video_codec_sink_class_init (GstVideoCodecSinkClass * klass)
{
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
+ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw; video/x-compressed")
+ );
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
+ gst_element_class_set_details_simple (element_class,
+ "VideoCodecSink", "Sink/Video", "yep", "me");
basesink_class->set_caps = gst_video_codec_sink_set_caps;
}
static void
-gst_video_codec_sink_init (GstVideoCodecSink * sink,
- GstVideoCodecSinkClass * klass)
+gst_video_codec_sink_init (GstVideoCodecSink * sink)
{
sink->audio = FALSE;
}
-#undef parent_class
-#define parent_class codec_demuxer_parent_class
typedef struct _GstCodecDemuxer GstCodecDemuxer;
typedef GstElementClass GstCodecDemuxerClass;
GstEvent *newseg_event;
};
-GST_BOILERPLATE (GstCodecDemuxer, gst_codec_demuxer, GstElement,
- GST_TYPE_ELEMENT);
-
#define STREAM_TYPES "{ " \
"none, " \
"raw-audio, " \
"compressed-video " \
"}"
-static void
-gst_codec_demuxer_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-container,"
- " stream0 = (string)" STREAM_TYPES " ,"
- " stream1 = (string)" STREAM_TYPES)
- );
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
- GST_PAD_SRC, GST_PAD_SOMETIMES,
- GST_STATIC_CAPS ("audio/x-raw; audio/x-compressed; "
- "video/x-raw; video/x-compressed")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+static GstStaticPadTemplate cd_sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-container,"
+ " stream0 = (string)" STREAM_TYPES " ,"
+ " stream1 = (string)" STREAM_TYPES)
+ );
+static GstStaticPadTemplate cd_src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
+ GST_PAD_SRC, GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS ("audio/x-raw; audio/x-compressed; "
+ "video/x-raw; video/x-compressed")
+ );
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_templ));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details_simple (element_class,
- "CodecDemuxer", "Codec/Demuxer", "yep", "me");
-}
+G_DEFINE_TYPE (GstCodecDemuxer, gst_codec_demuxer, GST_TYPE_ELEMENT);
static void
gst_codec_demuxer_finalize (GObject * object)
gst_event_unref (demux->newseg_event);
demux->newseg_event = NULL;
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gst_codec_demuxer_parent_class)->finalize (object);
}
static void
gst_codec_demuxer_class_init (GstCodecDemuxerClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gobject_class->finalize = gst_codec_demuxer_finalize;
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&cd_sink_templ));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&cd_src_templ));
+ gst_element_class_set_details_simple (element_class,
+ "CodecDemuxer", "Codec/Demuxer", "yep", "me");
}
static GstFlowReturn
-gst_codec_demuxer_chain (GstPad * pad, GstBuffer * buf)
+gst_codec_demuxer_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
- GstCodecDemuxer *demux = (GstCodecDemuxer *) GST_PAD_PARENT (pad);
+ GstCodecDemuxer *demux = (GstCodecDemuxer *) parent;
GstFlowReturn ret0 = GST_FLOW_OK, ret1 = GST_FLOW_OK;
if (demux->srcpad0) {
GstBuffer *outbuf = gst_buffer_new ();
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (demux->srcpad0));
ret0 = gst_pad_push (demux->srcpad0, outbuf);
}
if (demux->srcpad1) {
GstBuffer *outbuf = gst_buffer_new ();
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (demux->srcpad1));
ret1 = gst_pad_push (demux->srcpad1, outbuf);
}
gst_buffer_unref (buf);
return MIN (ret0, ret1);
}
-static gboolean
-gst_codec_demuxer_event (GstPad * pad, GstEvent * event)
-{
- GstCodecDemuxer *demux = (GstCodecDemuxer *) gst_pad_get_parent (pad);
- gboolean ret = TRUE;
-
- /* The single newsegment event is pushed when the pads are created */
- if (GST_EVENT_TYPE (event) != GST_EVENT_NEWSEGMENT) {
- if (demux->srcpad0)
- ret = ret && gst_pad_push_event (demux->srcpad0, gst_event_ref (event));
- if (demux->srcpad1)
- ret = ret && gst_pad_push_event (demux->srcpad1, gst_event_ref (event));
- } else {
- gst_event_replace (&demux->newseg_event, event);
- }
-
- gst_event_unref (event);
-
- gst_object_unref (demux);
- return ret;
-}
-
static void
gst_codec_demuxer_setup_pad (GstCodecDemuxer * demux, GstPad ** pad,
const gchar * streaminfo)
if (g_str_equal (streaminfo, "raw-video")) {
caps = gst_caps_new_simple ("video/x-raw",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
+ "format", G_TYPE_STRING, "I420",
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
"framerate", GST_TYPE_FRACTION, 25, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
} else if (g_str_equal (streaminfo, "compressed-video")) {
- caps = gst_caps_new_simple ("video/x-compressed", NULL);
+ caps = gst_caps_new_empty_simple ("video/x-compressed");
} else if (g_str_equal (streaminfo, "raw-audio")) {
caps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, "S16LE",
"rate", G_TYPE_INT, 48000, "channels", G_TYPE_INT, 2, NULL);
} else {
- caps = gst_caps_new_simple ("audio/x-compressed", NULL);
+ caps = gst_caps_new_empty_simple ("audio/x-compressed");
}
gst_pad_set_caps (*pad, caps);
gst_caps_unref (caps);
}
static gboolean
-gst_codec_demuxer_setcaps (GstPad * pad, GstCaps * caps)
+gst_codec_demuxer_setcaps (GstPad * pad, GstObject * parent, GstCaps * caps)
{
- GstCodecDemuxer *demux = (GstCodecDemuxer *) gst_pad_get_parent (pad);
+ GstCodecDemuxer *demux = (GstCodecDemuxer *) parent;
GstStructure *s;
const gchar *streaminfo;
streaminfo = gst_structure_get_string (s, "stream1");
gst_codec_demuxer_setup_pad (demux, &demux->srcpad1, streaminfo);
- gst_object_unref (demux);
return TRUE;
}
-static void
-gst_codec_demuxer_init (GstCodecDemuxer * demux, GstCodecDemuxerClass * klass)
+static gboolean
+gst_codec_demuxer_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
- GstPadTemplate *templ;
+ GstCodecDemuxer *demux = (GstCodecDemuxer *) parent;
+ gboolean ret = TRUE;
- templ = gst_element_class_get_pad_template (klass, "sink");
- demux->sinkpad = gst_pad_new_from_template (templ, "sink");
- gst_pad_set_setcaps_function (demux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_codec_demuxer_setcaps));
+ /* The single newsegment event is pushed when the pads are created */
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_codec_demuxer_setcaps (pad, parent, caps);
+ break;
+ }
+ case GST_EVENT_SEGMENT:
+ gst_event_replace (&demux->newseg_event, event);
+ break;
+ default:
+ if (demux->srcpad0)
+ ret = ret && gst_pad_push_event (demux->srcpad0, gst_event_ref (event));
+ if (demux->srcpad1)
+ ret = ret && gst_pad_push_event (demux->srcpad1, gst_event_ref (event));
+ break;
+ }
+ gst_event_unref (event);
+
+ return ret;
+}
+
+static void
+gst_codec_demuxer_init (GstCodecDemuxer * demux)
+{
+ demux->sinkpad = gst_pad_new_from_static_template (&cd_sink_templ, "sink");
gst_pad_set_chain_function (demux->sinkpad,
GST_DEBUG_FUNCPTR (gst_codec_demuxer_chain));
gst_pad_set_event_function (demux->sinkpad,
GstElement *playbin, *videosink;
GstElement *src = NULL;
- if (!gst_default_registry_check_feature_version ("redvideosrc", 0, 10, 0)) {
+ if (!gst_registry_check_feature_version (gst_registry_get (), "redvideosrc",
+ 0, 10, 0)) {
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ()));
}
/*** redvideo:// source ***/
static GstURIType
-gst_red_video_src_uri_get_type (void)
+gst_red_video_src_uri_get_type (GType type)
{
return GST_URI_SRC;
}
static const gchar *const *
-gst_red_video_src_uri_get_protocols (void)
+gst_red_video_src_uri_get_protocols (GType type)
{
static const gchar *protocols[] = { "redvideo", NULL };
return protocols;
}
-static const gchar *
+static gchar *
gst_red_video_src_uri_get_uri (GstURIHandler * handler)
{
- return "redvideo://";
+ return g_strdup ("redvideo://");
}
static gboolean
-gst_red_video_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_red_video_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
return (uri != NULL && g_str_has_prefix (uri, "redvideo:"));
}
gst_red_video_src_get_caps (GstBaseSrc * src, GstCaps * filter)
{
guint w = 64, h = 64;
- return gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
+ return gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING,
+ "I420", "width", G_TYPE_INT, w, "height",
G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
}
/*** codec:// source ***/
static GstURIType
-gst_codec_src_uri_get_type (void)
+gst_codec_src_uri_get_type (GType type)
{
return GST_URI_SRC;
}
-static gchar **
-gst_codec_src_uri_get_protocols (void)
+static const gchar *const *
+gst_codec_src_uri_get_protocols (GType type)
{
- static gchar *protocols[] = { (char *) "codec", NULL };
+ static const gchar *protocols[] = { (char *) "codec", NULL };
return protocols;
}
-static const gchar *
+static gchar *
gst_codec_src_uri_get_uri (GstURIHandler * handler)
{
- return "codec://";
+ return g_strdup ("codec://");
}
static gboolean
-gst_codec_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_codec_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
return (uri != NULL && g_str_has_prefix (uri, "codec:"));
}
static GstCaps *
gst_codec_src_get_caps (GstBaseSrc * src, GstCaps * filter)
{
- return gst_caps_new_simple ("application/x-codec", NULL);
+ return gst_caps_new_empty_simple ("application/x-codec");
}
static void
len = strlen (s);
buf = gst_buffer_new ();
- gst_buffer_take_memory (buf,
+ gst_buffer_take_memory (buf, -1,
gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
(gpointer) s, NULL, len, 0, len));
{
subparse = gst_check_setup_element ("subparse");
- mysrcpad = gst_check_setup_src_pad (subparse, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (subparse, &sinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (subparse, &srctemplate);
+ mysinkpad = gst_check_setup_sink_pad (subparse, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num)
{
guint n;
+ GstCaps *outcaps;
GST_LOG ("srt test: start_idx = %u, num = %u", start_idx, num);
fail_unless_equals_int (g_list_length (buffers), num);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+
for (n = start_idx; n < start_idx + num; ++n) {
const GstStructure *buffer_caps_struct;
GstBuffer *buf;
}
gst_buffer_unmap (buf, out, out_size);
/* check caps */
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
+ fail_unless (outcaps != NULL);
+ buffer_caps_struct = gst_caps_get_structure (outcaps, 0);
fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct),
"text/x-pango-markup");
}
+ gst_caps_unref (outcaps);
teardown_subparse ();
}
do_test (SubParseInputChunk * input, guint num, const gchar * media_type)
{
guint n;
+ GstCaps *outcaps;
setup_subparse ();
fail_unless_equals_int (g_list_length (buffers), num);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+
for (n = 0; n < num; ++n) {
const GstStructure *buffer_caps_struct;
GstBuffer *buf;
}
gst_buffer_unmap (buf, out, out_size);
/* check caps */
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
+ fail_unless (outcaps != NULL);
+ buffer_caps_struct = gst_caps_get_structure (outcaps, 0);
fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct),
media_type);
}
+ gst_caps_unref (outcaps);
teardown_subparse ();
}
GST_DEBUG ("setup_textoverlay");
textoverlay = gst_check_setup_element ("textoverlay");
- mysinkpad = gst_check_setup_sink_pad (textoverlay, &sinktemplate, NULL);
+ mysinkpad = gst_check_setup_sink_pad (textoverlay, &sinktemplate);
myvideosrcpad =
notgst_check_setup_src_pad2 (textoverlay, &video_srctemplate, NULL,
"video_sink");
}
static gboolean
-buffer_is_all_black (GstBuffer * buf)
+buffer_is_all_black (GstBuffer * buf, GstCaps * caps)
{
GstStructure *s;
gint x, y, w, h;
gsize size;
fail_unless (buf != NULL);
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
+ fail_unless (caps != NULL);
+ s = gst_caps_get_structure (caps, 0);
fail_unless (s != NULL);
fail_unless (gst_structure_get_int (s, "width", &w));
fail_unless (gst_structure_get_int (s, "height", &h));
return TRUE;
}
+static GstCaps *
+create_video_caps (const gchar * caps_string)
+{
+ GstCaps *caps;
+
+ caps = gst_caps_from_string (caps_string);
+ fail_unless (caps != NULL);
+ fail_unless (gst_caps_is_fixed (caps));
+
+ return caps;
+}
+
static GstBuffer *
-create_black_buffer (const gchar * caps_string)
+create_black_buffer (GstCaps * caps)
{
GstStructure *s;
GstBuffer *buffer;
- GstCaps *caps;
gint w, h, size;
guint8 *data;
- fail_unless (caps_string != NULL);
-
- caps = gst_caps_from_string (caps_string);
fail_unless (caps != NULL);
- fail_unless (gst_caps_is_fixed (caps));
s = gst_caps_get_structure (caps, 0);
fail_unless (gst_structure_get_int (s, "width", &w));
fail_unless (gst_structure_get_int (s, "height", &h));
GST_LOG ("creating buffer (%dx%d)", w, h);
+
size = I420_SIZE (w, h);
buffer = gst_buffer_new_and_alloc (size);
memset (data, 0, size);
gst_buffer_unmap (buffer, data, size);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
-
/* double check to make sure it's been created right */
- fail_unless (buffer_is_all_black (buffer));
+ fail_unless (buffer_is_all_black (buffer, caps));
return buffer;
}
create_text_buffer (const gchar * txt, GstClockTime ts, GstClockTime duration)
{
GstBuffer *buffer;
- GstCaps *caps;
guint txt_len;
fail_unless (txt != NULL);
GST_BUFFER_TIMESTAMP (buffer) = ts;
GST_BUFFER_DURATION (buffer) = duration;
- caps = gst_caps_new_simple ("text/plain", NULL);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
-
return buffer;
}
GST_START_TEST (test_video_passthrough)
{
GstElement *textoverlay;
- GstBuffer *inbuffer;
+ GstBuffer *inbuffer, *outbuffer;
+ GstCaps *incaps, *outcaps;
+ GstSegment segment;
textoverlay = setup_textoverlay (TRUE);
fail_unless (gst_element_set_state (textoverlay,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
+ incaps = create_video_caps (VIDEO_CAPS_STRING);
+ gst_pad_set_caps (myvideosrcpad, incaps);
+ inbuffer = create_black_buffer (incaps);
+ gst_caps_unref (incaps);
+
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* ========== (1) video buffer without timestamp => should be dropped ==== */
/* text pad is not linked, timestamp is in segment, no static text to
* render, should have gone through right away without modification */
fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) == inbuffer);
- fail_unless (buffer_is_all_black (inbuffer));
+ outbuffer = GST_BUFFER_CAST (buffers->data);
+ fail_unless (outbuffer == inbuffer);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (buffer_is_all_black (outbuffer, outcaps));
+ gst_caps_unref (outcaps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
/* and clean up */
/* ========== (3) buffer with 0 timestamp and no duration, with the
* segment starting from 1sec => should be discarded */
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 1 * GST_SECOND,
- -1, 0));
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ segment.start = 1 * GST_SECOND;
+ segment.stop = -1;
+ segment.time = 0;
+ gst_pad_push_event (myvideosrcpad, gst_event_new_segment (&segment));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_DURATION (inbuffer) = GST_CLOCK_TIME_NONE;
/* ========== (4) buffer with 0 timestamp and small defined duration, with
* segment starting from 1sec => should be discarded */
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, 1 * GST_FORMAT_TIME, GST_SECOND,
- -1, 0));
+ gst_pad_push_event (myvideosrcpad, gst_event_new_segment (&segment));
GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 10;
/* ========== (5) buffer partially overlapping into the segment => should
* be pushed through, but with adjusted stamp values */
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, 1 * GST_FORMAT_TIME, GST_SECOND,
- -1, 0));
+ gst_pad_push_event (myvideosrcpad, gst_event_new_segment (&segment));
GST_BUFFER_TIMESTAMP (inbuffer) = GST_SECOND / 4;
GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
/* should be a new buffer for the stamp fix-up */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) != inbuffer);
- fail_unless (GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (buffers->data)) ==
- GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (GST_BUFFER_CAST (buffers->data)) ==
- (GST_SECOND / 4));
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)));
+ outbuffer = GST_BUFFER_CAST (buffers->data);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (outbuffer != inbuffer);
+ fail_unless (GST_BUFFER_TIMESTAMP (outbuffer) == GST_SECOND);
+ fail_unless (GST_BUFFER_DURATION (outbuffer) == (GST_SECOND / 4));
+ fail_unless (buffer_is_all_black (outbuffer, outcaps));
+ gst_caps_unref (outcaps);
/* and clean up */
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (buffers);
GST_START_TEST (test_video_render_static_text)
{
GstElement *textoverlay;
- GstBuffer *inbuffer;
+ GstBuffer *inbuffer, *outbuffer;
+ GstCaps *incaps, *outcaps;
textoverlay = setup_textoverlay (TRUE);
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
+ incaps = create_video_caps (VIDEO_CAPS_STRING);
+ gst_pad_set_caps (myvideosrcpad, incaps);
+ inbuffer = create_black_buffer (incaps);
+ gst_caps_unref (incaps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
/* should have been dropped in favour of a new writable buffer */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) != inbuffer);
+ outbuffer = GST_BUFFER_CAST (buffers->data);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (outbuffer != inbuffer);
/* there should be text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)) == FALSE);
+ fail_unless (buffer_is_all_black (outbuffer, outcaps) == FALSE);
+ gst_caps_unref (outcaps);
- fail_unless (GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (buffers->data)) == 0);
- fail_unless (GST_BUFFER_DURATION (GST_BUFFER_CAST (buffers->data)) ==
- (GST_SECOND / 10));
+ fail_unless (GST_BUFFER_TIMESTAMP (outbuffer) == 0);
+ fail_unless (GST_BUFFER_DURATION (outbuffer) == (GST_SECOND / 10));
/* and clean up */
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
static gpointer
test_video_waits_for_text_send_text_newsegment_thread (gpointer data)
{
+ GstSegment segment;
+
g_usleep (1 * G_USEC_PER_SEC);
/* send an update newsegment; the video buffer should now be pushed through
* even though there is no text buffer queued at the moment */
GST_INFO ("Sending newsegment update on text pad");
- gst_pad_push_event (mytextsrcpad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME,
- 35 * GST_SECOND, -1, 35 * GST_SECOND));
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ segment.base = 35 * GST_SECOND;
+ segment.start = 35 * GST_SECOND;
+ segment.time = 35 * GST_SECOND;
+ gst_pad_push_event (mytextsrcpad, gst_event_new_segment (&segment));
return NULL;
}
GST_START_TEST (test_video_waits_for_text)
{
GstElement *textoverlay;
- GstBuffer *inbuffer, *tbuf;
+ GstBuffer *inbuffer, *outbuffer, *tbuf;
+ GstCaps *caps, *incaps, *outcaps;
GThread *thread;
textoverlay = setup_textoverlay (FALSE);
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
+ caps = gst_caps_new_empty_simple ("text/plain");
+ gst_pad_set_caps (mytextsrcpad, caps);
+ gst_caps_unref (caps);
+
tbuf = create_text_buffer ("XLX", 1 * GST_SECOND, 5 * GST_SECOND);
gst_buffer_ref (tbuf);
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
* newsegment event that indicates it's not needed any longer */
fail_unless_equals_int (g_list_length (buffers), 0);
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
+ incaps = create_video_caps (VIDEO_CAPS_STRING);
+ gst_pad_set_caps (myvideosrcpad, incaps);
+ inbuffer = create_black_buffer (incaps);
+ gst_caps_unref (incaps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
/* there should be no text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)));
+ outbuffer = GST_BUFFER_CAST (buffers->data);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (buffer_is_all_black (outbuffer, outcaps));
+ gst_caps_unref (outcaps);
/* now, another video buffer */
inbuffer = gst_buffer_make_writable (inbuffer);
ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
/* there should be text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->next->data)) ==
- FALSE);
+ outbuffer = GST_BUFFER_CAST (buffers->next->data);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (buffer_is_all_black (outbuffer, outcaps) == FALSE);
+ gst_caps_unref (outcaps);
/* a third video buffer */
inbuffer = gst_buffer_make_writable (inbuffer);
fail_unless_equals_int (g_list_length (buffers), 3);
/* ... and there should not be any text rendered on it */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->next->
- next->data)));
+ outbuffer = GST_BUFFER_CAST (buffers->next->next->data);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+ fail_unless (buffer_is_all_black (outbuffer, outcaps));
+ gst_caps_unref (outcaps);
/* a fourth video buffer */
inbuffer = gst_buffer_make_writable (inbuffer);
{
/* push video buffers at 1fps */
guint frame_count = 0;
+ GstCaps *vcaps;
+
+ vcaps = create_video_caps (VIDEO_CAPS_STRING);
+ gst_pad_set_caps (myvideosrcpad, vcaps);
do {
GstBuffer *vbuf;
- vbuf = create_black_buffer (VIDEO_CAPS_STRING);
+ vbuf = create_black_buffer (vcaps);
ASSERT_BUFFER_REFCOUNT (vbuf, "vbuf", 1);
GST_BUFFER_TIMESTAMP (vbuf) = frame_count * GST_SECOND;
++frame_count;
} while (frame_count < 15);
+ gst_caps_unref (vcaps);
+
return NULL;
}
-
GST_START_TEST (test_render_continuity)
{
GThread *thread;
GstElement *textoverlay;
GstBuffer *tbuf;
+ GstCaps *caps, *outcaps;
textoverlay = setup_textoverlay (FALSE);
NULL, FALSE, NULL);
fail_unless (thread != NULL);
+ caps = gst_caps_new_empty_simple ("text/plain");
+ gst_pad_set_caps (mytextsrcpad, caps);
+ gst_caps_unref (caps);
+
tbuf = create_text_buffer ("XLX", 2 * GST_SECOND, GST_SECOND);
GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
/* we should have 15 buffers each with one second length now */
fail_unless_equals_int (g_list_length (buffers), 15);
+ outcaps = gst_pad_get_current_caps (mysinkpad);
+
/* buffers 0 + 1 should be black */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 0))));
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 1))));
+ fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 0)),
+ outcaps));
+ fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 1)),
+ outcaps));
/* buffers 2 - 4 should have text */
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 2))) == FALSE);
+ 2)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 3))) == FALSE);
+ 3)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 4))) == FALSE);
+ 4)), outcaps) == FALSE);
/* buffers 5 + 6 should be black */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 5))));
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 6))));
+ fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 5)),
+ outcaps));
+ fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 6)),
+ outcaps));
/* buffers 7 - last should have text */
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 7))) == FALSE);
+ 7)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 8))) == FALSE);
+ 8)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 9))) == FALSE);
+ 9)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 10))) == FALSE);
+ 10)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 11))) == FALSE);
+ 11)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 12))) == FALSE);
+ 12)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 13))) == FALSE);
+ 13)), outcaps) == FALSE);
fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 14))) == FALSE);
+ 14)), outcaps) == FALSE);
+ gst_caps_unref (outcaps);
/* and clean up */
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
GST_DEBUG ("setup_videorate");
videorate = gst_check_setup_element ("videorate");
- mysrcpad = gst_check_setup_src_pad (videorate, srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (videorate, sinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (videorate, srctemplate);
+ mysinkpad = gst_check_setup_sink_pad (videorate, sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
gst_check_teardown_element (videorate);
}
-static void
-buffer_memset (GstBuffer * buffer, gint val, gsize size)
-{
- guint8 *data;
-
- data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE);
- memset (data, val, size);
- gst_buffer_unmap (buffer, data, size);
-}
-
static guint8
buffer_get_byte (GstBuffer * buffer, gint offset)
{
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (4);
- buffer_memset (inbuffer, 0, 4);
+ gst_buffer_memset (inbuffer, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
streams */
GST_BUFFER_OFFSET (first) = g_rand_int (rand);
GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- buffer_memset (first, 1, 4);
+ gst_buffer_memset (first, 0, 1, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (first, "first", 1);
gst_buffer_ref (first);
GST_BUFFER_TIMESTAMP (second) = GST_SECOND * 3 / 50;
GST_BUFFER_OFFSET (first) = g_rand_int (rand);
GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- buffer_memset (second, 2, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (second, 0, 2, 4);
ASSERT_BUFFER_REFCOUNT (second, "second", 1);
gst_buffer_ref (second);
GST_BUFFER_TIMESTAMP (third) = GST_SECOND * 12 / 50;
GST_BUFFER_OFFSET (first) = g_rand_int (rand);
GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- buffer_memset (third, 3, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (third, 0, 3, 4);
ASSERT_BUFFER_REFCOUNT (third, "third", 1);
gst_buffer_ref (third);
/* first buffer */
first = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (first) = GST_SECOND;
- buffer_memset (first, 0, 4);
+ gst_buffer_memset (first, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (first, "first", 1);
gst_buffer_ref (first);
/* second buffer */
second = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (second) = 0;
- buffer_memset (second, 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (second, 0, 0, 4);
ASSERT_BUFFER_REFCOUNT (second, "second", 1);
gst_buffer_ref (second);
/* third buffer */
third = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
- buffer_memset (third, 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (third, 0, 0, 4);
ASSERT_BUFFER_REFCOUNT (third, "third", 1);
gst_buffer_ref (third);
/* first buffer */
first = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (first) = 0;
- buffer_memset (first, 0, 4);
+ gst_buffer_memset (first, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (first, "first", 1);
gst_buffer_ref (first);
/* second buffer */
second = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (second) = GST_SECOND;
- buffer_memset (second, 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (second, 0, 0, 4);
ASSERT_BUFFER_REFCOUNT (second, "second", 1);
gst_buffer_ref (second);
/* third buffer */
third = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
- buffer_memset (third, 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (third, 0, 0, 4);
ASSERT_BUFFER_REFCOUNT (third, "third", 1);
gst_buffer_ref (third);
/* fourth buffer */
fourth = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (fourth) = 0;
- buffer_memset (fourth, 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (fourth, caps);
- gst_caps_unref (caps);
+ gst_buffer_memset (fourth, 0, 0, 4);
ASSERT_BUFFER_REFCOUNT (fourth, "fourth", 1);
gst_buffer_ref (fourth);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (4);
- buffer_memset (inbuffer, 0, 4);
+ gst_buffer_memset (inbuffer, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_NO_FRAMERATE_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GstBuffer *outbuf;
GstEvent *newsegment;
GstCaps *caps, *caps_newsize;
+ GstSegment segment;
videorate = setup_videorate ();
fail_unless (gst_element_set_state (videorate,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- newsegment = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1,
- 0);
+ gst_segment_init (&segment, GST_FORMAT_TIME);
+ newsegment = gst_event_new_segment (&segment);
fail_unless (gst_pad_push_event (mysrcpad, newsegment) == TRUE);
first = gst_buffer_new_and_alloc (4);
- buffer_memset (first, 0, 4);
+ gst_buffer_memset (first, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
GST_BUFFER_TIMESTAMP (first) = 0;
- gst_buffer_set_caps (first, caps);
+ gst_pad_set_caps (mysrcpad, caps);
GST_DEBUG ("pushing first buffer");
fail_unless (gst_pad_push (mysrcpad, first) == GST_FLOW_OK);
/* second buffer */
second = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (second) = GST_SECOND / 25;
- buffer_memset (second, 0, 4);
- gst_buffer_set_caps (second, caps);
+ gst_buffer_memset (second, 0, 0, 4);
fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
fail_unless_equals_int (g_list_length (buffers), 1);
outbuf = buffers->data;
/* first buffer should be output here */
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 0);
/* third buffer with new size */
third = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND / 25;
- buffer_memset (third, 0, 4);
+ gst_buffer_memset (third, 0, 0, 4);
caps_newsize = gst_caps_from_string (VIDEO_CAPS_NEWSIZE_STRING);
- gst_buffer_set_caps (third, caps_newsize);
+ gst_pad_set_caps (mysrcpad, caps_newsize);
fail_unless (gst_pad_push (mysrcpad, third) == GST_FLOW_OK);
/* new caps flushed the internal state, no new output yet */
fail_unless_equals_int (g_list_length (buffers), 1);
outbuf = g_list_last (buffers)->data;
/* first buffer should be output here */
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
+ //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 0);
/* fourth buffer with original size */
fourth = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (fourth) = 3 * GST_SECOND / 25;
- buffer_memset (fourth, 0, 4);
- gst_buffer_set_caps (fourth, caps);
+ gst_buffer_memset (fourth, 0, 0, 4);
+ gst_pad_set_caps (mysrcpad, caps);
fail_unless (gst_pad_push (mysrcpad, fourth) == GST_FLOW_OK);
fail_unless_equals_int (g_list_length (buffers), 1);
/* fifth buffer with original size */
fifth = gst_buffer_new_and_alloc (4);
GST_BUFFER_TIMESTAMP (fifth) = 4 * GST_SECOND / 25;
- buffer_memset (fifth, 0, 4);
- gst_buffer_set_caps (fifth, caps);
+ gst_buffer_memset (fifth, 0, 0, 4);
fail_unless (gst_pad_push (mysrcpad, fifth) == GST_FLOW_OK);
/* all four missing buffers here, dups of fourth buffer */
outbuf = g_list_last (buffers)->data;
/* third buffer should be output here */
fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 3 * GST_SECOND / 25);
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
+ //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
gst_caps_unref (caps);
gst_caps_unref (caps_newsize);
"could not set to playing");
buf = gst_buffer_new_and_alloc (4);
- buffer_memset (buf, 0, 4);
+ gst_buffer_memset (buf, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (buf, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (buf, "inbuffer", 1);
"could not set to playing");
videorate_pad = gst_element_get_static_pad (videorate, "sink");
- caps = gst_pad_get_caps (videorate_pad);
+ caps = gst_pad_query_caps (videorate_pad, NULL);
/* assemble the expected caps */
structure = gst_structure_from_string (VIDEO_CAPS_STRING, NULL);
"video/x-raw, framerate=(fraction)[0/1, 20/1]"},
};
-static GstCaps *
-_getcaps_function (GstPad * pad)
+static gboolean
+_query_function (GstPad * pad, GstObject * parent, GstQuery * query)
{
- GstCaps *caps = g_object_get_data (G_OBJECT (pad), "caps");
+ gboolean res;
- fail_unless (caps != NULL);
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_CAPS:{
+ GstCaps *caps = g_object_get_data (G_OBJECT (pad), "caps");
+
+ fail_unless (caps != NULL);
- return gst_caps_copy (caps);
+ gst_query_set_caps_result (query, caps);
+ res = TRUE;
+ break;
+ }
+ default:
+ res = gst_pad_query_default (pad, parent, query);
+ break;
+ }
+ return res;
}
static void
GstCaps *caps;
GstCaps *expected_caps;
- caps = gst_pad_peer_get_caps (pad);
+ caps = gst_pad_peer_query_caps (pad, NULL);
fail_unless (caps != NULL);
expected_caps = gst_caps_from_string (expected);
if (test->max_rate != 0)
g_object_set (videorate, "max-rate", test->max_rate, NULL);
- gst_pad_set_getcaps_function (mysrcpad, _getcaps_function);
- gst_pad_set_getcaps_function (mysinkpad, _getcaps_function);
+ gst_pad_set_query_function (mysrcpad, _query_function);
+ gst_pad_set_query_function (mysinkpad, _query_function);
check_peer_caps (mysrcpad, test->expected_sink_caps, "sink");
check_peer_caps (mysinkpad, test->expected_src_caps, "src");
caps_are_64bpp (const GstCaps * caps)
{
GstVideoFormat fmt;
- GstCaps *fmt_caps;
+ GstStructure *s;
+ const gchar *format;
+
+ s = gst_caps_get_structure (caps, 0);
+ format = gst_structure_get_string (s, "format");
+ fail_if (format == NULL);
- /* need fixed caps for _parse_caps */
- fmt_caps = gst_caps_copy (caps);
- gst_structure_remove_field (gst_caps_get_structure (fmt_caps, 0), "width");
- gst_structure_remove_field (gst_caps_get_structure (fmt_caps, 0), "height");
- gst_structure_remove_field (gst_caps_get_structure (fmt_caps, 0),
- "framerate");
+ fmt = gst_video_format_from_string (format);
+ fail_if (fmt == GST_VIDEO_FORMAT_UNKNOWN);
- fail_unless (gst_video_format_parse_caps (fmt_caps, &fmt, NULL, NULL));
- gst_caps_unref (fmt_caps);
return (fmt == GST_VIDEO_FORMAT_ARGB64 || fmt == GST_VIDEO_FORMAT_AYUV64);
}
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB));
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("xRGB")));
#if 0
static GstFlowReturn
{
GstTestReverseNegotiationSink *sink =
GST_TEST_REVERSE_NEGOTIATION_SINK (bsink);
- GstCaps *caps = gst_buffer_get_caps (buffer);
- GstVideoFormat fmt;
- gint width, height;
+ GstCaps *caps;
+ GstVideoInfo info;
+
+ caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (bsink));
fail_unless (caps != NULL);
- fail_unless (gst_video_format_parse_caps (caps, &fmt, &width, &height));
+ fail_unless (gst_video_info_from_caps (&info, caps));
sink->nbuffers++;
* the frame sizes
*/
if (sink->nbuffers > 3) {
- fail_unless_equals_int (width, 512);
- fail_unless_equals_int (height, 128);
+ fail_unless_equals_int (GST_VIDEO_INFO_WIDTH (&info), 512);
+ fail_unless_equals_int (GST_VIDEO_INFO_HEIGHT (&info), 128);
}
gst_caps_unref (caps);
g_object_set (src, "num-buffers", 3, NULL);
- caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
+ caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING,
+ "UYVY", "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
g_object_set (capsfilter1, "caps", caps, NULL);
gst_caps_unref (caps);
/* same caps, just different pixel-aspect-ratio */
- caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
+ caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING,
+ "UYVY", "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL);
g_object_set (capsfilter2, "caps", caps, NULL);
GST_DEBUG ("setup_videotestsrc");
videotestsrc = gst_check_setup_element ("videotestsrc");
- mysinkpad = gst_check_setup_sink_pad (videotestsrc, &sinktemplate, NULL);
+ mysinkpad = gst_check_setup_sink_pad (videotestsrc, &sinktemplate);
gst_pad_set_active (mysinkpad, TRUE);
return videotestsrc;
static void
check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
guint32 b_mask, guint32 a_mask, guint8 r_expected, guint8 g_expected,
- guint8 b_expected, guint endianness, guint bpp, guint depth)
+ guint8 b_expected, guint bpp, guint depth)
{
guint32 pixel, red, green, blue, alpha;
switch (bpp) {
- case 32:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT32_LE (pixels);
- else
- pixel = GST_READ_UINT32_BE (pixels);
+ case 32:
+ pixel = GST_READ_UINT32_BE (pixels);
break;
- }
- case 24:{
- if (endianness == G_BIG_ENDIAN) {
- pixel = (GST_READ_UINT8 (pixels) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 2) << 0);
- } else {
- pixel = (GST_READ_UINT8 (pixels + 2) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 0) << 0);
- }
+ case 24:
+ pixel = (GST_READ_UINT8 (pixels) << 16) |
+ (GST_READ_UINT8 (pixels + 1) << 8) |
+ (GST_READ_UINT8 (pixels + 2) << 0);
break;
- }
- case 16:{
- if (endianness == G_LITTLE_ENDIAN)
+ case 16:
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
pixel = GST_READ_UINT16_LE (pixels);
else
pixel = GST_READ_UINT16_BE (pixels);
break;
- }
default:
g_return_if_reached ();
}
"xRGB", 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}, {
"BGRx", 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0x00000000}, {
"xBGR", 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}, {
- "RGB ", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}, {
- "BGR ", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}, {
- "RGB565", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000}, {
- "xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000}
+ "RGB", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}, {
+ "BGR", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}, {
+ "RGB16", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000}, {
+ "RGB15", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000}
};
GstElement *pipeline, *src, *filter, *sink;
GstCaps *template_caps;
srcpad = gst_element_get_static_pad (src, "src");
template_caps = gst_pad_get_pad_template_caps (srcpad);
- gst_object_unref (srcpad);
g_object_set (sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
for (i = 0; i < G_N_ELEMENTS (rgb_formats); ++i) {
for (e = 0; e < 2; ++e) {
- guint endianness;
GstCaps *caps;
- if (e == 0) {
- endianness = G_BYTE_ORDER;
- } else {
- endianness =
- (G_BYTE_ORDER == G_BIG_ENDIAN) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
- }
-
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, rgb_formats[i].bpp,
- "depth", G_TYPE_INT, rgb_formats[i].depth,
- "red_mask", G_TYPE_INT, rgb_formats[i].red_mask,
- "green_mask", G_TYPE_INT, rgb_formats[i].green_mask,
- "blue_mask", G_TYPE_INT, rgb_formats[i].blue_mask,
+ caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, rgb_formats[i].nick,
"width", G_TYPE_INT, 16, "height", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, endianness,
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
- fail_unless (rgb_formats[i].alpha_mask == 0 || rgb_formats[i].bpp == 32);
-
- if (rgb_formats[i].alpha_mask != 0) {
- gst_structure_set (gst_caps_get_structure (caps, 0),
- "alpha_mask", G_TYPE_INT, rgb_formats[i].alpha_mask, NULL);
- }
-
if (gst_caps_is_subset (caps, template_caps)) {
-
/* caps are supported, let's run some tests then ... */
for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
GstStateChangeReturn state_ret;
g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
- GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
+ GST_INFO ("%5s %u/%u %08x %08x %08x %08x, pattern=%s",
rgb_formats[i].nick, rgb_formats[i].bpp, rgb_formats[i].depth,
rgb_formats[i].red_mask, rgb_formats[i].green_mask,
- rgb_formats[i].blue_mask, rgb_formats[i].alpha_mask, endianness,
+ rgb_formats[i].blue_mask, rgb_formats[i].alpha_mask,
test_patterns[p].pattern_name);
/* now get videotestsrc to produce a buffer with the given caps */
/* check buffer caps */
{
GstStructure *s;
- gint v;
-
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
-
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless (gst_structure_get_int (s, "bpp", &v));
- fail_unless_equals_int (v, rgb_formats[i].bpp);
- fail_unless (gst_structure_get_int (s, "depth", &v));
- fail_unless_equals_int (v, rgb_formats[i].depth);
- fail_unless (gst_structure_get_int (s, "red_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].red_mask);
- fail_unless (gst_structure_get_int (s, "green_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].green_mask);
- fail_unless (gst_structure_get_int (s, "blue_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].blue_mask);
- /* there mustn't be an alpha_mask if there's no alpha component */
- if (rgb_formats[i].depth == 32) {
- fail_unless (gst_structure_get_int (s, "alpha_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].alpha_mask);
- } else {
- fail_unless (gst_structure_get_value (s, "alpha_mask") == NULL);
- }
- }
+ GstCaps *caps;
+ const gchar *format;
+
+ caps = gst_pad_get_current_caps (srcpad);
+ fail_unless (caps != NULL);
+ s = gst_caps_get_structure (caps, 0);
+ format = gst_structure_get_string (s, "format");
+ fail_unless (g_str_equal (format, rgb_formats[i].nick));
+ }
/* now check the first pixel */
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
rgb_formats[i].green_mask, rgb_formats[i].blue_mask,
rgb_formats[i].alpha_mask, test_patterns[p].r_expected,
test_patterns[p].g_expected, test_patterns[p].b_expected,
- endianness, rgb_formats[i].bpp, rgb_formats[i].depth);
+ rgb_formats[i].bpp, rgb_formats[i].depth);
gst_buffer_unmap (buf, data, size);
gst_buffer_unref (buf);
}
}
gst_caps_unref (template_caps);
+ gst_object_unref (srcpad);
gst_object_unref (pipeline);
}
#include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h>
-#include <gst/interfaces/streamvolume.h>
+#include <gst/audio/streamvolume.h>
#include <gst/controller/gstinterpolationcontrolsource.h>
/* For ease of programming we use globals to keep refs for our floating
GST_DEBUG ("setup_volume");
volume = gst_check_setup_element ("volume");
- mysrcpad = gst_check_setup_src_pad (volume, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate, NULL);
+ mysrcpad = gst_check_setup_src_pad (volume, &srctemplate);
+ mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
inbuffer = gst_buffer_new_and_alloc (2);
gst_buffer_fill (inbuffer, 0, in, 2);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (2);
gst_buffer_fill (inbuffer, 0, in, 2);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (2);
gst_buffer_fill (inbuffer, 0, in, 2);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
gint8 in[2] = { 64, -10 };
gint8 out[2] = { 127, -100 }; /* notice the clamped sample */
gint8 *res;
+ gsize size;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (2);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 2);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 2) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = (gint8 *) GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
+ fail_unless (memcmp (res, out, 2) == 0);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (2);
gst_buffer_fill (inbuffer, 0, in, 2);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
gint16 in[2] = { 16384, -10 };
gint16 out[2] = { 32767, -100 }; /* notice the clamped sample */
gint16 *res;
+ gsize size;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 4);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
+ fail_unless (memcmp (res, out, 4) == 0);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (6);
gst_buffer_fill (inbuffer, 0, in, 6);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (6);
gst_buffer_fill (inbuffer, 0, in, 6);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (6);
gst_buffer_fill (inbuffer, 0, in, 6);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
guint8 *res;
gint32 res_32[2];
gint32 out_32[2] = { 8388607, -100 }; /* notice the clamped sample */
+ gsize size;
write_unaligned_u24 (in, in_32[0]);
write_unaligned_u24 (in + 3, in_32[1]);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (6);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 6);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 6) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
res_32[0] = get_unaligned_i24 (res);
res_32[1] = get_unaligned_i24 ((res + 3));
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
res_32[0], res_32[1]);
fail_unless (memcmp (res_32, out_32, 8) == 0);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (6);
gst_buffer_fill (inbuffer, 0, in, 6);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
gint32 in[2] = { 1073741824, -10 };
gint32 out[2] = { 2147483647, -100 }; /* notice the clamped sample */
gint32 *res;
+ gsize size;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 8);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = (gint32 *) GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
+ fail_unless (memcmp (res, out, 8) == 0);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
gfloat in[2] = { 0.75, -0.25 };
gfloat out[2] = { 7.5, -2.5 }; /* nothing is clamped */
gfloat *res;
+ gsize size;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 8);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
res[0], res[1]);
fail_unless_equals_float (res[0], out[0]);
fail_unless_equals_float (res[1], out[1]);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (8);
gst_buffer_fill (inbuffer, 0, in, 8);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (16);
gst_buffer_fill (inbuffer, 0, in, 16);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
inbuffer = gst_buffer_new_and_alloc (16);
gst_buffer_fill (inbuffer, 0, in, 16);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (16);
gst_buffer_fill (inbuffer, 0, in, 16);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
gdouble in[2] = { 0.75, -0.25 };
gdouble out[2] = { 7.5, -2.5 }; /* nothing is clamped */
gdouble *res;
+ gsize size;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (16);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
+ gst_buffer_fill (inbuffer, 0, in, 16);
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 16) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
res[0], res[1]);
fail_unless_equals_float (res[0], out[0]);
fail_unless_equals_float (res[1], out[1]);
+ gst_buffer_unmap (outbuffer, res, size);
/* cleanup */
cleanup_volume (volume);
inbuffer = gst_buffer_new_and_alloc (16);
gst_buffer_fill (inbuffer, 0, in, 16);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_WRONG_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
gst_buffer_ref (inbuffer);
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GstInterpolationControlSource *csource;
GstTimedValueControlSource *cs;
GstElement *volume;
- GValue value = { 0, };
volume = setup_volume ();
/* this shouldn't crash, whether this mode is implemented or not */
csource = gst_interpolation_control_source_new ();
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
- gst_object_set_control_source (volume, "volume",
+ gst_object_set_control_source (GST_OBJECT_CAST (volume), "volume",
GST_CONTROL_SOURCE (csource));
cs = (GstTimedValueControlSource *) csource;
csource = gst_interpolation_control_source_new ();
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
- gst_object_set_control_source (volume, "volume",
+ gst_object_set_control_source (GST_OBJECT_CAST (volume), "volume",
GST_CONTROL_SOURCE (csource));
fail_unless (gst_element_set_state (volume,
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_fill (inbuffer, 0, in, 4);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
+ gst_pad_set_caps (mysrcpad, caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
return FALSE;
}
-static gboolean
-buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
+static GstPadProbeReturn
+buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info);
GstClockTime new_ts = GST_BUFFER_TIMESTAMP (buffer);
GST_LOG ("ts = %" GST_TIME_FORMAT, GST_TIME_ARGS (new_ts));
pad = gst_element_get_static_pad (asink, "sink");
fail_unless (pad != NULL, "Could not get pad out of sink");
- gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_cb), NULL);
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe_cb, NULL,
+ NULL);
gst_element_set_locked_state (bin, TRUE);
/* Run main pipeline first */
GstCaps *current_caps = NULL;
int caps_change = 0;
-static gboolean
-buffer_probe (GstPad * pad, GstMiniObject * obj, gpointer data)
+static GstPadProbeReturn
+buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
{
- GstBuffer *buffer;
- GstCaps *buffer_caps;
+ GstCaps *pad_caps;
GstElement *capsfilter = GST_ELEMENT (data);
GstCaps *caps = NULL;
- buffer = GST_BUFFER (obj);
-
/* increment the buffer count and check if it is time to change the caps */
buffer_count++;
if (buffer_count == 50) {
g_object_set (capsfilter, "caps", caps, NULL);
gst_caps_unref (caps);
}
-
- /* now check if the buffer caps has changed since last check */
- buffer_caps = GST_BUFFER_CAPS (buffer);
- if (current_caps == NULL && buffer_caps != NULL) {
+ /* now check if the pad caps has changed since last check */
+ pad_caps = gst_pad_get_current_caps (pad);
+ if (current_caps == NULL && pad_caps != NULL) {
/* probably the first caps, this is a change */
- current_caps = gst_caps_copy (buffer_caps);
+ current_caps = gst_caps_copy (pad_caps);
caps_change++;
} else if (current_caps != NULL) {
- if (buffer_caps == NULL) {
+ if (pad_caps == NULL) {
/* caps was set to NULL, we consider this a change */
gst_caps_unref (current_caps);
current_caps = NULL;
caps_change++;
} else {
- if (!gst_caps_is_equal (current_caps, buffer_caps)) {
+ if (!gst_caps_is_equal (current_caps, pad_caps)) {
/* a caps change */
gst_caps_unref (current_caps);
- current_caps = gst_caps_copy (buffer_caps);
+ current_caps = gst_caps_copy (pad_caps);
caps_change++;
}
}
g_assert (sink);
pad = gst_element_get_static_pad (sink, "sink");
- gst_pad_add_buffer_probe (pad, (GCallback) buffer_probe, capsfilter);
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe, capsfilter,
+ NULL);
gst_object_unref (pad);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
static int n_tags = 0;
-static gboolean
-tag_event_probe_cb (GstPad * pad, GstEvent * event, GMainLoop * loop)
+static GstPadProbeReturn
+tag_event_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
+ GMainLoop *loop = user_data;
+ GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
+
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_TAG:
{
break;
}
- return TRUE;
+ return GST_PAD_PROBE_OK;
}
GST_START_TEST (test_multifdsink_gdp_tag)
fail_unless (pad != NULL, "Could not get pad out of depay");
gst_object_unref (depay);
- gst_pad_add_event_probe (pad, G_CALLBACK (tag_event_probe_cb), loop);
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+ tag_event_probe_cb, loop, NULL);
gst_element_set_state (p1, GST_STATE_PLAYING);
gst_element_set_state (p2, GST_STATE_PLAYING);
static int n_in_caps = 0;
-static gboolean
-buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
+static GstPadProbeReturn
+buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info);
guint8 *data;
gsize size;
n_in_caps++;
- caps = gst_buffer_get_caps (buffer);
+ caps = gst_pad_get_current_caps (pad);
s = gst_caps_get_structure (caps, 0);
fail_unless (gst_structure_has_field (s, "streamheader"));
sh = gst_structure_get_value (s, "streamheader");
buffers = g_value_peek_pointer (sh);
assert_equals_int (buffers->len, 3);
-
for (i = 0; i < 3; ++i) {
GValue *val;
guint8 *data2;
fail_unless (pad != NULL, "Could not get pad out of depay");
gst_object_unref (depay);
- gst_pad_add_event_probe (pad, G_CALLBACK (tag_event_probe_cb), loop);
- gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_cb), NULL);
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+ tag_event_probe_cb, loop, NULL);
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe_cb, NULL,
+ NULL);
gst_element_set_state (p1, GST_STATE_PLAYING);
gst_element_set_state (p2, GST_STATE_PLAYING);