videodecoder: accept-caps should only require fields from the template

With the new caps query results the caps returned might have extra fields
that are not required by the decoder (framerate for image decoders) and it
causes a regression making, for example, jpegdec reject caps that don't
have framerates.

The accept-caps implementation will do 2 checks:

1) Do subset check with the template caps, making sure all the required
fields that are present on the template are present on the received caps.
2) Do a intersection check with the result of a caps query, making sure
that downstream can accept the fields in the received caps.

https://bugzilla.gnome.org/show_bug.cgi?id=741263
This commit is contained in:
Thiago Santos 2014-12-15 18:46:21 -03:00
parent 00c2ce60c3
commit 4956800549

View File

@ -1627,6 +1627,31 @@ gst_video_decoder_sink_query_default (GstVideoDecoder * decoder,
res = TRUE;
break;
}
case GST_QUERY_ACCEPT_CAPS:{
GstCaps *caps;
GstCaps *allowed_caps;
GstCaps *template_caps;
gboolean accept;
gst_query_parse_accept_caps (query, &caps);
template_caps = gst_pad_get_pad_template_caps (pad);
accept = gst_caps_is_subset (caps, template_caps);
gst_caps_unref (template_caps);
if (accept) {
allowed_caps = gst_pad_query_caps (GST_VIDEO_DECODER_SINK_PAD (decoder),
caps);
accept = gst_caps_can_intersect (caps, allowed_caps);
gst_caps_unref (allowed_caps);
}
gst_query_set_accept_caps_result (query, accept);
res = TRUE;
break;
}
default:
res = gst_pad_query_default (pad, GST_OBJECT (decoder), query);
break;