diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index ce7f6fe132..7b6cdced2c 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -1354,6 +1354,19 @@ gst_aac_parse_stop (GstBaseParse * parse) 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, "framed"); + } +} + static GstCaps * gst_aac_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter) { @@ -1361,18 +1374,12 @@ gst_aac_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter) GstCaps *res; 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), filter); if (peercaps) { - guint i, n; - - /* Remove the framed field */ 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, "framed"); - } + /* Remove the fields we convert */ + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c index 407e662c3b..5ad753ed77 100644 --- a/gst/audioparsers/gstac3parse.c +++ b/gst/audioparsers/gstac3parse.c @@ -799,6 +799,20 @@ gst_ac3_parse_src_event (GstBaseParse * parse, GstEvent * event) return GST_BASE_PARSE_CLASS (parent_class)->src_event (parse, event); } +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, "framed"); + gst_structure_remove_field (s, "alignment"); + } +} + static GstCaps * gst_ac3_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -809,18 +823,10 @@ gst_ac3_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the framed and alignment field. We can convert * between different alignments. */ 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, "framed"); - gst_structure_remove_field (s, "alignment"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstdcaparse.c b/gst/audioparsers/gstdcaparse.c index 6df74ea62a..5b18af4a36 100644 --- a/gst/audioparsers/gstdcaparse.c +++ b/gst/audioparsers/gstdcaparse.c @@ -474,6 +474,19 @@ gst_dca_parse_chain_priv (GstPad * pad, GstObject * parent, GstBuffer * buffer) return ret; } +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, "framed"); + } +} + static GstCaps * gst_dca_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -484,16 +497,9 @@ gst_dca_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the framed field */ 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, "framed"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index 875694217f..4a8794d4ce 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -1793,6 +1793,19 @@ gst_flac_parse_src_event (GstBaseParse * parse, GstEvent * event) return res; } +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, "framed"); + } +} + static GstCaps * gst_flac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -1803,16 +1816,9 @@ gst_flac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the framed field */ 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, "framed"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c index aaa9349435..8c63c04ff7 100644 --- a/gst/audioparsers/gstmpegaudioparse.c +++ b/gst/audioparsers/gstmpegaudioparse.c @@ -1398,6 +1398,19 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse, return GST_FLOW_OK; } +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, "parsed"); + } +} + static GstCaps * gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -1408,16 +1421,9 @@ gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the parsed field */ 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, "parsed"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstsbcparse.c b/gst/audioparsers/gstsbcparse.c index 5df456ae62..d3a900eaf0 100644 --- a/gst/audioparsers/gstsbcparse.c +++ b/gst/audioparsers/gstsbcparse.c @@ -299,6 +299,19 @@ need_more_data: } } +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, "parsed"); + } +} + static GstCaps * gst_sbc_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -309,16 +322,9 @@ gst_sbc_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the parsed field */ 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, "parsed"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps); diff --git a/gst/audioparsers/gstwavpackparse.c b/gst/audioparsers/gstwavpackparse.c index 8f124dd241..f2c67654d5 100644 --- a/gst/audioparsers/gstwavpackparse.c +++ b/gst/audioparsers/gstwavpackparse.c @@ -608,6 +608,19 @@ more: return GST_FLOW_OK; } +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, "framed"); + } +} + static GstCaps * gst_wavpack_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) { @@ -618,16 +631,9 @@ gst_wavpack_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter) peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter); if (peercaps) { - guint i, n; - /* Remove the framed field */ 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, "framed"); - } + remove_fields (peercaps); res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (peercaps);