vaapidecodebin: has_vpp as a tri-state variable

has_vpp can be UNKNOWN while the context message hasn't being received.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749554
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-08-06 12:36:07 +02:00
parent f0d6b0ac3f
commit 0004301714
2 changed files with 13 additions and 6 deletions

View file

@ -51,6 +51,13 @@ enum
PROP_LAST PROP_LAST
}; };
enum
{
HAS_VPP_UNKNOWN,
HAS_VPP_NO,
HAS_VPP_YES
};
static GParamSpec *properties[PROP_LAST]; static GParamSpec *properties[PROP_LAST];
/* Default templates */ /* Default templates */
@ -122,7 +129,7 @@ activate_vpp (GstVaapiDecodeBin * vaapidecbin)
if (vaapidecbin->ghost_pad_src || vaapidecbin->postproc) if (vaapidecbin->ghost_pad_src || vaapidecbin->postproc)
return TRUE; return TRUE;
if (!vaapidecbin->has_vpp || vaapidecbin->disable_vpp) { if (vaapidecbin->has_vpp != HAS_VPP_YES || vaapidecbin->disable_vpp) {
src = vaapidecbin->queue; src = vaapidecbin->queue;
goto connect_src_ghost_pad; 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)) if (!gst_vaapi_video_context_get_display (context, &display))
goto bail; 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 /* the underlying VA driver implementation doesn't support video
* post-processing, hence we have to disable it */ * 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"); GST_WARNING_OBJECT (vaapidecbin, "VA driver doesn't support VPP");
if (!vaapidecbin->disable_vpp) { if (!vaapidecbin->disable_vpp) {
vaapidecbin->disable_vpp = TRUE; vaapidecbin->disable_vpp = TRUE;
@ -391,8 +399,7 @@ gst_vaapi_decode_bin_init (GstVaapiDecodeBin * vaapidecbin)
{ {
GstPad *element_pad, *ghost_pad; GstPad *element_pad, *ghost_pad;
/* let's assume we have VPP until we prove the opposite */ vaapidecbin->has_vpp = HAS_VPP_UNKNOWN;
vaapidecbin->has_vpp = TRUE;
if (!gst_vaapi_decode_bin_configure (vaapidecbin)) if (!gst_vaapi_decode_bin_configure (vaapidecbin))
return; return;

View file

@ -55,7 +55,7 @@ typedef struct _GstVaapiDecodeBin {
guint64 max_size_time; guint64 max_size_time;
GstVaapiDeinterlaceMethod deinterlace_method; GstVaapiDeinterlaceMethod deinterlace_method;
gboolean disable_vpp; gboolean disable_vpp;
gboolean has_vpp; guint has_vpp;
} GstVaapiDecodeBin; } GstVaapiDecodeBin;