diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-09-20 09:56:40 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-09-30 15:56:45 +0100 |
commit | 5a10950c1aa0e19150c5d29c71e7eb1060c33684 (patch) | |
tree | 0c471e1ee3f4b23d956847f2325cfac011410015 | |
parent | 1bdb6cc718815776e25bf913e410bce9d60681e1 (diff) |
decoder: don't reply src caps query with allowed if pad is fixed
If the pad is already fixed the caps query have to be reply with the
current fixed caps. Otherwise the query has to be replied with the
autogeneratd src caps.
This path fix this by falling back to the normal caps query processing
if the pad is already fixed. Otherwise it will fetch the allowed src
pad caps.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/399>
-rw-r--r-- | gst/vaapi/gstvaapidecode.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 9e8aa264..329c0e65 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1437,25 +1437,31 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) GstElement *const element = GST_ELEMENT (vdec); switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CONTEXT:{ + ret = gst_vaapi_handle_context_query (element, query); + break; + } case GST_QUERY_CAPS:{ GstCaps *caps, *filter = NULL; + gboolean fixed_caps; + + fixed_caps = GST_PAD_IS_FIXED_CAPS (GST_VIDEO_DECODER_SRC_PAD (vdec)); + if (!fixed_caps) { + gst_query_parse_caps (query, &filter); + caps = gst_vaapidecode_get_allowed_srcpad_caps (GST_VAAPIDECODE (vdec)); + + if (filter) { + GstCaps *tmp = caps; + caps = + gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (tmp); + } - gst_query_parse_caps (query, &filter); - caps = gst_vaapidecode_get_allowed_srcpad_caps (GST_VAAPIDECODE (vdec)); - - if (filter) { - GstCaps *tmp = caps; - caps = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (tmp); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + break; } - - gst_query_set_caps_result (query, caps); - gst_caps_unref (caps); - break; - } - case GST_QUERY_CONTEXT:{ - ret = gst_vaapi_handle_context_query (element, query); - break; + /* else jump to default */ } default:{ ret = GST_VIDEO_DECODER_CLASS (parent_class)->src_query (vdec, query); |