mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 21:12:26 +00:00
vaapidecode: intersect filter from query caps
According to documentation[1] when receiving a GST_QUERY_CAPS the return value should be all formats that this elements supports, taking into account limitations of peer elements further downstream or upstream, sorted by order of preference, highest preference first. This patch add those limitations intersecting with the received filter in the query. Also takes into account the already negotiated caps. Also adds the processing of the query on the SRC pad. 1. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-getcaps.html https://bugzilla.gnome.org/show_bug.cgi?id=744406
This commit is contained in:
parent
671b1ea305
commit
7ca0591759
1 changed files with 52 additions and 4 deletions
|
@ -990,7 +990,24 @@ gst_vaapidecode_query(GST_PAD_QUERY_FUNCTION_ARGS)
|
|||
switch (GST_QUERY_TYPE(query)) {
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
case GST_QUERY_CAPS: {
|
||||
GstCaps * const caps = gst_vaapidecode_get_caps(pad);
|
||||
GstCaps *filter, *caps = NULL;
|
||||
|
||||
gst_query_parse_caps(query, &filter);
|
||||
if (!decode->sinkpad_caps)
|
||||
caps = gst_vaapidecode_get_caps(pad);
|
||||
else
|
||||
caps = gst_caps_ref(decode->sinkpad_caps);
|
||||
|
||||
if (filter) {
|
||||
GstCaps *tmp = caps;
|
||||
caps = gst_caps_intersect_full(filter, tmp,
|
||||
GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref(tmp);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT(decode, "Returning sink caps %" GST_PTR_FORMAT,
|
||||
caps);
|
||||
|
||||
gst_query_set_caps_result(query, caps);
|
||||
gst_caps_unref(caps);
|
||||
res = TRUE;
|
||||
|
@ -1003,9 +1020,40 @@ gst_vaapidecode_query(GST_PAD_QUERY_FUNCTION_ARGS)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (GST_QUERY_TYPE(query)) {
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
case GST_QUERY_CAPS: {
|
||||
GstCaps *filter, *caps = NULL;
|
||||
|
||||
gst_query_parse_caps(query, &filter);
|
||||
if (!decode->srcpad_caps)
|
||||
caps = gst_pad_get_pad_template_caps(pad);
|
||||
else
|
||||
caps = gst_caps_ref(decode->srcpad_caps);
|
||||
|
||||
if (filter) {
|
||||
GstCaps *tmp = caps;
|
||||
caps = gst_caps_intersect_full(filter, tmp,
|
||||
GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref(tmp);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT(decode, "Returning src caps %" GST_PTR_FORMAT,
|
||||
caps);
|
||||
|
||||
gst_query_set_caps_result(query, caps);
|
||||
gst_caps_unref(caps);
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
res = GST_PAD_QUERY_FUNCTION_CALL(plugin->srcpad_query, pad,
|
||||
parent, query);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gst_object_unref(decode);
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue