From 00043017149264642b82559c28880543b1032731 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 6 Aug 2015 12:36:07 +0200 Subject: [PATCH] vaapidecodebin: has_vpp as a tri-state variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit has_vpp can be UNKNOWN while the context message hasn't being received. Signed-off-by: Víctor Manuel Jáquez Leal https://bugzilla.gnome.org/show_bug.cgi?id=749554 --- gst/vaapi/gstvaapidecodebin.c | 17 ++++++++++++----- gst/vaapi/gstvaapidecodebin.h | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gst/vaapi/gstvaapidecodebin.c b/gst/vaapi/gstvaapidecodebin.c index 03f34ac..85ab5ec 100644 --- a/gst/vaapi/gstvaapidecodebin.c +++ b/gst/vaapi/gstvaapidecodebin.c @@ -51,6 +51,13 @@ enum PROP_LAST }; +enum +{ + HAS_VPP_UNKNOWN, + HAS_VPP_NO, + HAS_VPP_YES +}; + static GParamSpec *properties[PROP_LAST]; /* Default templates */ @@ -122,7 +129,7 @@ activate_vpp (GstVaapiDecodeBin * vaapidecbin) if (vaapidecbin->ghost_pad_src || vaapidecbin->postproc) return TRUE; - if (!vaapidecbin->has_vpp || vaapidecbin->disable_vpp) { + if (vaapidecbin->has_vpp != HAS_VPP_YES || vaapidecbin->disable_vpp) { src = vaapidecbin->queue; goto connect_src_ghost_pad; } @@ -265,11 +272,12 @@ gst_vaapi_decode_bin_handle_message (GstBin * bin, GstMessage * message) if (!gst_vaapi_video_context_get_display (context, &display)) goto bail; - vaapidecbin->has_vpp = gst_vaapi_display_has_video_processing (display); + vaapidecbin->has_vpp = gst_vaapi_display_has_video_processing (display) ? + HAS_VPP_YES : HAS_VPP_NO; /* the underlying VA driver implementation doesn't support video * post-processing, hence we have to disable it */ - if (!vaapidecbin->has_vpp) { + if (vaapidecbin->has_vpp != HAS_VPP_YES) { GST_WARNING_OBJECT (vaapidecbin, "VA driver doesn't support VPP"); if (!vaapidecbin->disable_vpp) { vaapidecbin->disable_vpp = TRUE; @@ -391,8 +399,7 @@ gst_vaapi_decode_bin_init (GstVaapiDecodeBin * vaapidecbin) { GstPad *element_pad, *ghost_pad; - /* let's assume we have VPP until we prove the opposite */ - vaapidecbin->has_vpp = TRUE; + vaapidecbin->has_vpp = HAS_VPP_UNKNOWN; if (!gst_vaapi_decode_bin_configure (vaapidecbin)) return; diff --git a/gst/vaapi/gstvaapidecodebin.h b/gst/vaapi/gstvaapidecodebin.h index 0f3fb6c..18685fe 100644 --- a/gst/vaapi/gstvaapidecodebin.h +++ b/gst/vaapi/gstvaapidecodebin.h @@ -55,7 +55,7 @@ typedef struct _GstVaapiDecodeBin { guint64 max_size_time; GstVaapiDeinterlaceMethod deinterlace_method; gboolean disable_vpp; - gboolean has_vpp; + guint has_vpp; } GstVaapiDecodeBin; -- 2.7.4