summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-10-28 13:01:04 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-11-09 16:18:19 +0100
commit75e7a0a36ce5288cb1d6c24f0c8a97aae33c546d (patch)
treeb3cdb44390b4638a957238c6cae8c9db00823e8a
parentd69f747d0949bc87816bb74ac33135b618296c45 (diff)
vaapidecode: return pad's template caps if no display
A caps query can occur before the element has a display. In that case, the element can return its pad's template. But when the element already has a display, and the caps probe fails, the element shall return an empty caps, so the auto-plug could try with another decoder. If the element has a display and the caps probe works, then the computed caps should be returned. Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> https://bugzilla.gnome.org/show_bug.cgi?id=757598
-rw-r--r--gst/vaapi/gstvaapidecode.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c
index 5fc2592b..fdd1acc1 100644
--- a/gst/vaapi/gstvaapidecode.c
+++ b/gst/vaapi/gstvaapidecode.c
@@ -954,12 +954,6 @@ gst_vaapidecode_ensure_allowed_caps (GstVaapiDecode * decode)
GArray *profiles;
guint i;
- if (decode->allowed_caps)
- return TRUE;
-
- if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (decode))
- goto error_no_display;
-
profiles =
gst_vaapi_display_get_decode_profiles (GST_VAAPI_PLUGIN_BASE_DISPLAY
(decode));
@@ -999,11 +993,6 @@ gst_vaapidecode_ensure_allowed_caps (GstVaapiDecode * decode)
return TRUE;
/* ERRORS */
-error_no_display:
- {
- GST_INFO_OBJECT (decode, "no VA display shared yet");
- return FALSE;
- }
error_no_profiles:
{
GST_ERROR ("failed to retrieve VA decode profiles");
@@ -1022,9 +1011,19 @@ gst_vaapidecode_get_caps (GstPad * pad)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (GST_OBJECT_PARENT (pad));
+ if (decode->allowed_caps)
+ goto bail;
+
+ /* if we haven't a display yet, return our pad's template caps */
+ if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (decode))
+ return gst_pad_get_pad_template_caps (pad);
+
+ /* if the allowed caps calculation fails, return an empty caps, so
+ * the auto-plug can try other decoder */
if (!gst_vaapidecode_ensure_allowed_caps (decode))
return gst_caps_new_empty ();
+bail:
return gst_caps_ref (decode->allowed_caps);
}