Commit d8a3895a authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

tests: Fix event order and missing events

parent b19d64d7
......@@ -914,13 +914,7 @@ GST_START_TEST (test_clip)
sinkpad = gst_element_get_request_pad (adder, "sink_%u");
fail_if (sinkpad == NULL, NULL);
/* send segment to adder */
gst_segment_init (&segment, GST_FORMAT_TIME);
segment.start = GST_SECOND;
segment.stop = 2 * GST_SECOND;
segment.time = 0;
event = gst_event_new_segment (&segment);
gst_pad_send_event (sinkpad, event);
gst_pad_send_event (sinkpad, gst_event_new_stream_start ("test"));
caps = gst_caps_new_simple ("audio/x-raw",
#if G_BYTE_ORDER == G_BIG_ENDIAN
......@@ -934,6 +928,14 @@ GST_START_TEST (test_clip)
gst_pad_set_caps (sinkpad, caps);
gst_caps_unref (caps);
/* send segment to adder */
gst_segment_init (&segment, GST_FORMAT_TIME);
segment.start = GST_SECOND;
segment.stop = 2 * GST_SECOND;
segment.time = 0;
event = gst_event_new_segment (&segment);
gst_pad_send_event (sinkpad, event);
/* should be clipped and ok */
buffer = gst_buffer_new_and_alloc (44100);
GST_BUFFER_TIMESTAMP (buffer) = 0;
......
......@@ -35,12 +35,17 @@ static GstElement *
setup_appsink (void)
{
GstElement *appsink;
GstCaps *caps;
GST_DEBUG ("setup_appsink");
appsink = gst_check_setup_element ("appsink");
mysrcpad = gst_check_setup_src_pad (appsink, &srctemplate);
gst_pad_set_active (mysrcpad, TRUE);
caps = gst_caps_new_empty_simple ("application/x-gst-check");
gst_check_setup_events (mysrcpad, appsink, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
return appsink;
}
......@@ -81,16 +86,12 @@ GST_START_TEST (test_non_clients)
{
GstElement *sink;
GstBuffer *buffer;
GstCaps *caps;
sink = setup_appsink ();
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
GST_DEBUG ("cleaning up appsink");
......@@ -105,7 +106,6 @@ GST_START_TEST (test_handoff_callback)
{
GstElement *sink;
GstBuffer *buffer;
GstCaps *caps;
gint testdata;
GstAppSinkCallbacks callbacks = { NULL };
......@@ -120,10 +120,7 @@ GST_START_TEST (test_handoff_callback)
ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
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);
......@@ -196,23 +193,18 @@ GST_START_TEST (test_notify1)
GST_END_TEST;
static GstBufferList *mylist;
static GstCaps *mycaps;
static gint values[] = { 1, 2, 4 };
static const gint values[] = { 1, 2, 4 };
static GstBufferList *
create_buffer_list (void)
{
guint len;
GstBuffer *buffer;
GstBufferList *mylist;
mylist = gst_buffer_list_new ();
fail_if (mylist == NULL);
mycaps = gst_caps_from_string ("application/x-gst-check");
fail_if (mycaps == NULL);
len = gst_buffer_list_length (mylist);
fail_if (len != 0);
......@@ -228,9 +220,6 @@ create_buffer_list (void)
gst_buffer_fill (buffer, 0, &values[2], sizeof (gint));
gst_buffer_list_add (mylist, buffer);
gst_pad_set_caps (mysrcpad, mycaps);
gst_caps_unref (mycaps);
return mylist;
}
......
......@@ -43,22 +43,25 @@ static GstPad *mysrcpad, *mysinkpad;
"rate = (int) [ 1, MAX ], " \
"channels = (int) [ 1, MAX ]"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
);
/* takes over reference for outcaps */
static GstElement *
setup_audioconvert (GstCaps * outcaps)
{
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
);
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
);
GstElement *audioconvert;
gchar *caps_str;
caps_str = gst_caps_to_string (outcaps);
sinktemplate.static_caps.string = caps_str;
GST_DEBUG ("setup_audioconvert with caps %" GST_PTR_FORMAT, outcaps);
audioconvert = gst_check_setup_element ("audioconvert");
......@@ -73,11 +76,7 @@ setup_audioconvert (GstCaps * outcaps)
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
gst_pad_set_caps (mysinkpad, outcaps);
gst_caps_unref (outcaps);
outcaps = gst_pad_get_current_caps (mysinkpad);
fail_unless (gst_caps_is_fixed (outcaps));
gst_caps_unref (outcaps);
g_free (caps_str);
return audioconvert;
}
......@@ -420,7 +419,7 @@ verify_convert (const gchar * which, void *in, int inlength,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
gst_pad_set_caps (mysrcpad, incaps);
gst_check_setup_events (mysrcpad, audioconvert, incaps, GST_FORMAT_TIME);
GST_DEBUG ("Creating buffer of %d bytes", inlength);
inbuffer = gst_buffer_new_and_alloc (inlength);
......@@ -1447,15 +1446,18 @@ GST_END_TEST;
"rate = (int) [ 1, MAX ], " \
"channels = (int) [ 1, MAX ]"
static GstStaticPadTemplate simple_sinktemplate =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (SIMPLE_CAPS_TEMPLATE_STRING)
);
GST_START_TEST (test_preserve_width)
{
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (SIMPLE_CAPS_TEMPLATE_STRING)
);
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
);
static const struct _test_formats
{
int width;
......@@ -1474,7 +1476,7 @@ GST_START_TEST (test_preserve_width)
audioconvert = gst_check_setup_element ("audioconvert");
mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate);
mysinkpad = gst_check_setup_sink_pad (audioconvert, &simple_sinktemplate);
mysinkpad = gst_check_setup_sink_pad (audioconvert, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
......
......@@ -419,6 +419,9 @@ GST_START_TEST (test_large_discont)
sinkpad = gst_check_setup_sink_pad (audiorate, &sinktemplate);
gst_pad_set_active (srcpad, TRUE);
gst_check_setup_events (srcpad, audiorate, caps, GST_FORMAT_TIME);
gst_pad_set_active (sinkpad, TRUE);
fail_unless (gst_element_set_state (audiorate,
......@@ -426,7 +429,6 @@ GST_START_TEST (test_large_discont)
"failed to set audiorate playing");
buf = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (srcpad, caps);
GST_BUFFER_TIMESTAMP (buf) = 0;
gst_pad_push (srcpad, buf);
......
......@@ -51,24 +51,24 @@ static GstPad *mysrcpad, *mysinkpad;
"rate = (int) [ 1, MAX ], " \
"layout = (string) interleaved"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (RESAMPLE_CAPS)
);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (RESAMPLE_CAPS)
);
static GstElement *
setup_audioresample (int channels, guint64 mask, int inrate, int outrate,
const gchar * format)
{
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (RESAMPLE_CAPS)
);
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (RESAMPLE_CAPS)
);
GstElement *audioresample;
GstCaps *caps;
GstStructure *structure;
gchar *caps_str;
GST_DEBUG ("setup_audioresample");
audioresample = gst_check_setup_element ("audioresample");
......@@ -86,7 +86,7 @@ setup_audioresample (int channels, guint64 mask, int inrate, int outrate,
mysrcpad = gst_check_setup_src_pad (audioresample, &srctemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, audioresample, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
caps = gst_caps_from_string (RESAMPLE_CAPS);
......@@ -94,15 +94,16 @@ setup_audioresample (int channels, guint64 mask, int inrate, int outrate,
gst_structure_set (structure, "channels", G_TYPE_INT, channels,
"rate", G_TYPE_INT, outrate, "format", G_TYPE_STRING, format, NULL);
fail_unless (gst_caps_is_fixed (caps));
caps_str = gst_caps_to_string (caps);
sinktemplate.static_caps.string = caps_str;
mysinkpad = gst_check_setup_sink_pad (audioresample, &sinktemplate);
gst_pad_set_active (mysinkpad, TRUE);
/* this installs a getcaps func that will always return the caps we set
* later */
gst_pad_set_caps (mysinkpad, caps);
gst_pad_use_fixed_caps (mysinkpad);
g_free (caps_str);
gst_caps_unref (caps);
return audioresample;
......@@ -1011,14 +1012,11 @@ run_fft_pipeline (int inrate, int outrate, int quality, int width,
{
GstElement *audioresample;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
const int nsamples = 2048;
audioresample = setup_audioresample (1, 0, inrate, outrate, format);
fail_unless (audioresample != NULL);
g_object_set (audioresample, "quality", quality, NULL);
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,
......@@ -1027,7 +1025,6 @@ run_fft_pipeline (int inrate, int outrate, int quality, int width,
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_pad_set_caps (mysrcpad, caps);
(*init) (inbuffer);
......@@ -1048,7 +1045,6 @@ run_fft_pipeline (int inrate, int outrate, int quality, int width,
(*compare_ffts) (inbuffer, outbuffer);
/* cleanup */
gst_caps_unref (caps);
cleanup_audioresample (audioresample);
}
......
......@@ -89,7 +89,7 @@ GST_START_TEST (test_no_clients)
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
......@@ -121,7 +121,7 @@ GST_START_TEST (test_add_client)
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
buffer = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
gst_buffer_fill (buffer, 0, "dead", 4);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
......@@ -273,7 +273,7 @@ GST_START_TEST (test_streamheader)
gst_multifdsink_create_streamheader ("babe", "deadbeef", &hbuf1, &hbuf2,
&caps);
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one is ours, two from set_caps */
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
......@@ -365,7 +365,7 @@ GST_START_TEST (test_change_streamheader)
gst_multifdsink_create_streamheader ("first", "header", &hbuf1, &hbuf2,
&caps);
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one is ours, two from set_caps */
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
......@@ -411,7 +411,7 @@ GST_START_TEST (test_change_streamheader)
gst_multifdsink_create_streamheader ("second", "header", &hbuf1, &hbuf2,
&caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one to hold for the test and one to give away */
ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
......@@ -501,7 +501,7 @@ GST_START_TEST (test_burst_client_bytes)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
......@@ -590,7 +590,7 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
......@@ -681,7 +681,7 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
......@@ -767,7 +767,7 @@ GST_START_TEST (test_client_next_keyframe)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* now add our client */
......
......@@ -91,7 +91,7 @@ GST_START_TEST (test_no_clients)
caps = gst_caps_from_string ("application/x-gst-check");
buffer = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
......@@ -177,7 +177,7 @@ GST_START_TEST (test_add_client)
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
buffer = gst_buffer_new_and_alloc (4);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
gst_buffer_fill (buffer, 0, "dead", 4);
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
......@@ -299,7 +299,7 @@ GST_START_TEST (test_streamheader)
ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one is ours, two from set_caps */
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
......@@ -400,7 +400,7 @@ GST_START_TEST (test_change_streamheader)
gst_multisocketsink_create_streamheader ("first", "header", &hbuf1, &hbuf2,
&caps);
ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one is ours, two from set_caps */
ASSERT_CAPS_REFCOUNT (caps, "caps", 3);
......@@ -446,7 +446,7 @@ GST_START_TEST (test_change_streamheader)
gst_multisocketsink_create_streamheader ("second", "header", &hbuf1, &hbuf2,
&caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* one to hold for the test and one to give away */
ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
......@@ -539,7 +539,7 @@ GST_START_TEST (test_burst_client_bytes)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
......@@ -634,7 +634,7 @@ GST_START_TEST (test_burst_client_bytes_keyframe)
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);
gst_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
/* push buffers in, 9 * 16 bytes = 144 bytes */
for (i = 0; i < 9; i++) {
......@@ -732,7 +732,7 @@ GST_START_TEST (test_burst_client_bytes_with_keyframe)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* push buffers in, 9 * 16 bytes = 144 bytes */
......@@ -825,7 +825,7 @@ GST_START_TEST (test_client_next_keyframe)
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_check_setup_events (mysrcpad, sink, caps, GST_FORMAT_BYTES);
GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
/* now add our client */
......
......@@ -157,12 +157,17 @@ static SubParseInputChunk srt_input3[] = {
static void
setup_subparse (void)
{
GstSegment segment;
subparse = gst_check_setup_element ("subparse");
mysrcpad = gst_check_setup_src_pad (subparse, &srctemplate);
mysinkpad = gst_check_setup_sink_pad (subparse, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_segment_init (&segment, GST_FORMAT_BYTES);
gst_pad_push_event (mysrcpad, gst_event_new_stream_start ("test"));
gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment));
gst_pad_set_active (mysinkpad, TRUE);
fail_unless_equals_int (gst_element_set_state (subparse, GST_STATE_PLAYING),
......
......@@ -68,6 +68,21 @@ static GstStaticPadTemplate video_srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (VIDEO_CAPS_TEMPLATE_STRING)
);
static void
gst_check_setup_events_textoverlay (GstPad * srcpad, GstElement * element,
GstCaps * caps, GstFormat format, const gchar * stream_id)
{
GstSegment segment;
gst_segment_init (&segment, format);
fail_unless (gst_pad_push_event (srcpad,
gst_event_new_stream_start (stream_id)));
if (caps)
fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment)));
}
/* much like gst_check_setup_src_pad(), but with possibility to give a hint
* which sink template of the element to use, if there are multiple ones */
static GstPad *
......@@ -279,7 +294,8 @@ GST_START_TEST (test_video_passthrough)
"could not set to playing");
incaps = create_video_caps (VIDEO_CAPS_STRING);
gst_pad_set_caps (myvideosrcpad, incaps);
gst_check_setup_events_textoverlay (myvideosrcpad, textoverlay, incaps,
GST_FORMAT_TIME, "video");
inbuffer = create_black_buffer (incaps);
gst_caps_unref (incaps);
......@@ -422,7 +438,8 @@ GST_START_TEST (test_video_render_static_text)
"could not set to playing");
incaps = create_video_caps (VIDEO_CAPS_STRING);
gst_pad_set_caps (myvideosrcpad, incaps);
gst_check_setup_events_textoverlay (myvideosrcpad, textoverlay, incaps,
GST_FORMAT_TIME, "video");
inbuffer = create_black_buffer (incaps);
gst_caps_unref (incaps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -512,7 +529,8 @@ GST_START_TEST (test_video_waits_for_text)
caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, "utf8",
NULL);
gst_pad_set_caps (mytextsrcpad, caps);
gst_check_setup_events_textoverlay (mytextsrcpad, textoverlay, caps,
GST_FORMAT_TIME, "text");
gst_caps_unref (caps);
tbuf = create_text_buffer ("XLX", 1 * GST_SECOND, 5 * GST_SECOND);
......@@ -527,7 +545,8 @@ GST_START_TEST (test_video_waits_for_text)
fail_unless_equals_int (g_list_length (buffers), 0);
incaps = create_video_caps (VIDEO_CAPS_STRING);
gst_pad_set_caps (myvideosrcpad, incaps);
gst_check_setup_events_textoverlay (myvideosrcpad, textoverlay, incaps,
GST_FORMAT_TIME, "video");
inbuffer = create_black_buffer (incaps);
gst_caps_unref (incaps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -646,7 +665,8 @@ test_render_continuity_push_video_buffers_thread (gpointer data)
GstCaps *vcaps;
vcaps = create_video_caps (VIDEO_CAPS_STRING);
gst_pad_set_caps (myvideosrcpad, vcaps);
gst_check_setup_events_textoverlay (myvideosrcpad, data, vcaps,
GST_FORMAT_TIME, "video");
do {
GstBuffer *vbuf;
......@@ -684,13 +704,14 @@ GST_START_TEST (test_render_continuity)
"could not set to playing");
thread = g_thread_try_new ("gst-check",
test_render_continuity_push_video_buffers_thread, NULL, NULL);
test_render_continuity_push_video_buffers_thread, textoverlay, NULL);
fail_unless (thread != NULL);
g_thread_unref (thread);
caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, "utf8",
NULL);
gst_pad_set_caps (mytextsrcpad, caps);
gst_check_setup_events_textoverlay (mytextsrcpad, textoverlay, caps,
GST_FORMAT_TIME, "text");
gst_caps_unref (caps);
tbuf = create_text_buffer ("XLX", 2 * GST_SECOND, GST_SECOND);
......
......@@ -165,7 +165,7 @@ GST_START_TEST (test_one)
inbuffer = gst_buffer_new_and_alloc (4);
gst_buffer_memset (inbuffer, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, videorate, caps, GST_FORMAT_TIME);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -207,7 +207,7 @@ GST_START_TEST (test_more)
GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
gst_buffer_memset (first, 0, 1, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
gst_pad_set_caps (mysrcpad, caps);
gst_check_setup_events (mysrcpad, videorate, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (first, "first", 1);
gst_buffer_ref (first);
......@@ -325,7 +325,7 @@ GST_START_TEST (test_wrong_order_from_zero)
GST_BUFFER_TIMESTAMP (first) = GST_SECOND;
gst_buffer_memset (first, 0, 0, 4);
caps = gst_caps_from_string (VIDEO_CAPS_STRING);
gst_pad_set_caps (mysrcpad, caps);