diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-11-16 10:38:49 -0800 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-11-16 10:39:40 -0800 |
commit | f3f9e4b9786d00299e0c6909180c4cd326489bdf (patch) | |
tree | 266872847c15542a5e82f0e1deaee239c4e61a94 /gst/videoparsers | |
parent | 714ced7d19324b18e26eac2ee91224b198dd4ba7 (diff) | |
download | gstreamer-plugins-bad-f3f9e4b9786d00299e0c6909180c4cd326489bdf.tar.gz |
h264parse: Implement ::sink_get_caps to allow stream-format conversion again
Just proxying the downstream caps will prevent h264parse from
accepting a different stream-format than what is supported
downstream, although it could convert to a different stream-format.
Diffstat (limited to 'gst/videoparsers')
-rw-r--r-- | gst/videoparsers/gsth264parse.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 2127125f4..6fdad115b 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -91,6 +91,7 @@ static void gst_h264_parse_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static gboolean gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps); +static GstCaps *gst_h264_parse_get_caps (GstBaseParse * parse); static GstFlowReturn gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer); static void @@ -138,6 +139,7 @@ gst_h264_parse_class_init (GstH264ParseClass * klass) parse_class->pre_push_frame = GST_DEBUG_FUNCPTR (gst_h264_parse_pre_push_frame); parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_h264_parse_set_caps); + parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_h264_parse_get_caps); } static void @@ -1336,6 +1338,38 @@ refuse_caps: } } +static GstCaps * +gst_h264_parse_get_caps (GstBaseParse * parse) +{ + GstCaps *peercaps; + GstCaps *res; + + peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse)); + if (peercaps) { + guint i, n; + + peercaps = gst_caps_make_writable (peercaps); + n = gst_caps_get_size (peercaps); + for (i = 0; i < n; i++) { + GstStructure *s = gst_caps_get_structure (peercaps, i); + gst_structure_remove_field (s, "alignment"); + gst_structure_remove_field (s, "stream-format"); + } + + res = + gst_caps_intersect_full (peercaps, + gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)), + GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (peercaps); + } else { + res = + gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD + (parse))); + } + + return res; +} + static GstFlowReturn gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer) { |