summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-05-15 11:09:08 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-05-15 11:12:42 +0200
commit0b6898caeaf15bc1de678b1471624ab9661c4d1c (patch)
tree7117c584a62adb3fa9ded2d95adaa1236c5cfeed
parentd35cba1d6afc407fb00cee89fa8b7e57d36948b8 (diff)
downloadgstreamer-plugins-bad-0b6898caeaf15bc1de678b1471624ab9661c4d1c.tar.gz
gdp: Fix event handling in unit test
gdp elements still needs to be fixed for all the event related changes and generally properly ported to 1.0.
-rw-r--r--tests/check/elements/gdpdepay.c12
-rw-r--r--tests/check/elements/gdppay.c32
2 files changed, 16 insertions, 28 deletions
diff --git a/tests/check/elements/gdpdepay.c b/tests/check/elements/gdpdepay.c
index 27a9355c5..104f119ee 100644
--- a/tests/check/elements/gdpdepay.c
+++ b/tests/check/elements/gdpdepay.c
@@ -128,6 +128,10 @@ GST_START_TEST (test_audio_per_byte)
gst_caps_unref (caps);
fail_if (gst_pad_get_current_caps (srcpad));
+ caps = gst_caps_new_empty_simple ("application/x-gdp");
+ gst_check_setup_events (mysrcpad, gdpdepay, caps, GST_FORMAT_BYTES);
+ gst_caps_unref (caps);
+
/* create caps and buffer packets and push them */
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
fail_unless (pk->packet_from_caps (caps, 0, &len, &header, &payload));
@@ -205,6 +209,10 @@ GST_START_TEST (test_audio_in_one_buffer)
gst_caps_unref (caps);
fail_if (gst_pad_get_current_caps (srcpad));
+ caps = gst_caps_new_empty_simple ("application/x-gdp");
+ gst_check_setup_events (mysrcpad, gdpdepay, caps, GST_FORMAT_BYTES);
+ gst_caps_unref (caps);
+
/* create caps and buffer packets and push them as one buffer */
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
@@ -308,6 +316,10 @@ GST_START_TEST (test_streamheader)
gst_caps_unref (caps);
fail_if (gst_pad_get_current_caps (srcpad));
+ caps = gst_caps_new_empty_simple ("application/x-gdp");
+ gst_check_setup_events (mysrcpad, gdpdepay, caps, GST_FORMAT_BYTES);
+ gst_caps_unref (caps);
+
/* create a streamheader buffer and the caps containing it */
caps = gst_caps_from_string ("application/x-gst-test-streamheader");
structure = gst_caps_get_structure (caps, 0);
diff --git a/tests/check/elements/gdppay.c b/tests/check/elements/gdppay.c
index 92bd46e50..8029a7273 100644
--- a/tests/check/elements/gdppay.c
+++ b/tests/check/elements/gdppay.c
@@ -95,8 +95,6 @@ GST_START_TEST (test_audio)
GstCaps *caps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer;
- GstSegment segment;
- GstEvent *event;
gchar *caps_string;
gint length;
@@ -106,19 +104,13 @@ GST_START_TEST (test_audio)
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- GST_DEBUG ("new segment");
- 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 */
fail_unless_equals_int (g_list_length (buffers), 0);
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_pad_set_caps (mysrcpad, caps);
+ gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
caps_string = gst_caps_to_string (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@@ -236,8 +228,6 @@ GST_START_TEST (test_streamheader)
GstCaps *caps, *sinkcaps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer, *shbuffer;
- GstSegment segment;
- GstEvent *event;
gchar *caps_string;
gint length;
GstStructure *structure;
@@ -246,19 +236,12 @@ GST_START_TEST (test_streamheader)
const GValue *sh;
GArray *shbuffers;
-
gdppay = setup_gdppay_streamheader ();
fail_unless (gst_element_set_state (gdppay,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- GST_DEBUG ("new segment");
- 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 */
fail_unless_equals_int (g_list_length (buffers), 0);
@@ -279,7 +262,7 @@ GST_START_TEST (test_streamheader)
g_value_unset (&array);
caps_string = gst_caps_to_string (caps);
- gst_pad_set_caps (myshsrcpad, caps);
+ gst_check_setup_events (myshsrcpad, gdppay, caps, GST_FORMAT_TIME);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference */
@@ -431,7 +414,7 @@ GST_START_TEST (test_first_no_new_segment)
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_pad_set_caps (mysrcpad, caps);
+ gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@@ -461,8 +444,6 @@ GST_START_TEST (test_crc)
GstCaps *caps;
GstElement *gdppay;
GstBuffer *inbuffer, *outbuffer;
- GstSegment segment;
- GstEvent *event;
gchar *caps_string;
gint length;
GstMapInfo map;
@@ -475,18 +456,13 @@ GST_START_TEST (test_crc)
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- GST_DEBUG ("new segment");
- 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 */
fail_unless_equals_int (g_list_length (buffers), 0);
GST_DEBUG ("first buffer");
inbuffer = gst_buffer_new_and_alloc (4);
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_pad_set_caps (mysrcpad, caps);
+ gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
caps_string = gst_caps_to_string (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);