summaryrefslogtreecommitdiff
path: root/tests/check
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2014-12-17 14:18:03 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2014-12-17 19:15:23 -0300
commit8085352fb32c293c1128f5fcc6646f1f5e74663c (patch)
tree2ffa1731a7a44af9d3a3db4823354bf8292a6897 /tests/check
parent49568005494bfdaf82734437ccaa0584eab22c9c (diff)
videodecoder: expose getcaps virtual function
Allows subclasses to do custom caps query replies. Also exposes the standard caps query handler so subclasses can just extend on top of it instead of reimplementing the caps query proxying. https://bugzilla.gnome.org/show_bug.cgi?id=741263
Diffstat (limited to 'tests/check')
-rw-r--r--tests/check/libs/videodecoder.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/check/libs/videodecoder.c b/tests/check/libs/videodecoder.c
index 960cbd17d..2197c7596 100644
--- a/tests/check/libs/videodecoder.c
+++ b/tests/check/libs/videodecoder.c
@@ -989,6 +989,42 @@ GST_START_TEST (videodecoder_query_caps_with_range_caps_peer)
GST_END_TEST;
+#define GETCAPS_CAPS_STR "video/x-test-custom, somefield=(string)getcaps"
+static GstCaps *
+_custom_video_decoder_getcaps (GstVideoDecoder * dec, GstCaps * filter)
+{
+ return gst_caps_from_string (GETCAPS_CAPS_STR);
+}
+
+GST_START_TEST (videodecoder_query_caps_with_custom_getcaps)
+{
+ GstCaps *caps;
+ GstVideoDecoderClass *klass;
+ GstCaps *expected_caps;
+
+ setup_videodecodertester (&sinktemplate_restricted, NULL);
+
+ klass = GST_VIDEO_DECODER_CLASS (GST_VIDEO_DECODER_GET_CLASS (dec));
+ klass->getcaps = _custom_video_decoder_getcaps;
+
+ gst_pad_set_active (mysrcpad, TRUE);
+ gst_element_set_state (dec, GST_STATE_PLAYING);
+ gst_pad_set_active (mysinkpad, TRUE);
+
+ caps = gst_pad_peer_query_caps (mysrcpad, NULL);
+ fail_unless (caps != NULL);
+
+ expected_caps = gst_caps_from_string (GETCAPS_CAPS_STR);
+ fail_unless (gst_caps_is_equal (expected_caps, caps));
+ gst_caps_unref (expected_caps);
+ gst_caps_unref (caps);
+
+ cleanup_videodecodertest ();
+}
+
+GST_END_TEST;
+
+
static Suite *
gst_videodecoder_suite (void)
{
@@ -999,6 +1035,7 @@ gst_videodecoder_suite (void)
tcase_add_test (tc, videodecoder_query_caps_with_fixed_caps_peer);
tcase_add_test (tc, videodecoder_query_caps_with_range_caps_peer);
+ tcase_add_test (tc, videodecoder_query_caps_with_custom_getcaps);
tcase_add_test (tc, videodecoder_playback);
tcase_add_test (tc, videodecoder_playback_with_events);