Commit e6a21299 authored by Sebastian Dröge's avatar Sebastian Dröge

dcaparse: Implement ::get_sink_caps vfunc to propagate downstream caps constraints upstream

parent c5b770df
......@@ -78,6 +78,7 @@ static gboolean gst_dca_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * size, gint * skipsize);
static GstFlowReturn gst_dca_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static GstCaps *gst_dca_parse_get_sink_caps (GstBaseParse * parse);
GST_BOILERPLATE (GstDcaParse, gst_dca_parse, GstBaseParse, GST_TYPE_BASE_PARSE);
......@@ -112,6 +113,7 @@ gst_dca_parse_class_init (GstDcaParseClass * klass)
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_dca_parse_check_valid_frame);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_dca_parse_parse_frame);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_dca_parse_get_sink_caps);
}
static void
......@@ -450,3 +452,36 @@ broken_header:
return GST_FLOW_ERROR;
}
}
static GstCaps *
gst_dca_parse_get_sink_caps (GstBaseParse * parse)
{
GstCaps *peercaps;
GstCaps *res;
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
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");
}
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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment