diff options
author | Wim Taymans <wtaymans@redhat.com> | 2013-12-04 09:00:43 +0100 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2013-12-04 09:49:20 +0100 |
commit | d5a16bccac7fdc30daef3e31fbb499131f21b4b7 (patch) | |
tree | f8d548eed4ed1c34d80f0c9a5b15b3a6c504c85a /gst/videoparsers/gstvc1parse.c | |
parent | 26bf14c9fd5eaefefcd1d4ffa7d65b793e1aabdd (diff) |
videoparsers: refactor remove_fields in getcaps
Diffstat (limited to 'gst/videoparsers/gstvc1parse.c')
-rw-r--r-- | gst/videoparsers/gstvc1parse.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gst/videoparsers/gstvc1parse.c b/gst/videoparsers/gstvc1parse.c index 9bb37aba3b..5643d3da6a 100644 --- a/gst/videoparsers/gstvc1parse.c +++ b/gst/videoparsers/gstvc1parse.c @@ -363,6 +363,20 @@ gst_vc1_parse_renegotiate (GstVC1Parse * vc1parse) return TRUE; } +static void +remove_fields (GstCaps * caps) +{ + guint i, n; + + n = gst_caps_get_size (caps); + for (i = 0; i < n; i++) { + GstStructure *s = gst_caps_get_structure (caps, i); + + gst_structure_remove_field (s, "stream-format"); + gst_structure_remove_field (s, "header-format"); + } +} + static GstCaps * gst_vc1_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -373,20 +387,11 @@ gst_vc1_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse)); peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), NULL); if (peercaps) { - guint i, n; - GstStructure *s; - /* Remove the stream-format and header-format fields * and add the generic ones again by intersecting * with our template */ peercaps = gst_caps_make_writable (peercaps); - n = gst_caps_get_size (peercaps); - for (i = 0; i < n; i++) { - s = gst_caps_get_structure (peercaps, i); - - gst_structure_remove_field (s, "stream-format"); - gst_structure_remove_field (s, "header-format"); - } + remove_fields (peercaps); ret = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); |