vaapidecodebin: Register element if no VPP support is available too

VPP support is only needed for advanced deinterlacing, which is not
enabled by default either. Error out if it is selected but VPP is not
supported, and otherwise just work without VPP support.

https://bugzilla.gnome.org/show_bug.cgi?id=788758
This commit is contained in:
Sebastian Dröge 2017-10-10 11:35:24 +03:00
parent a6e191e09c
commit a8f2309595
3 changed files with 50 additions and 4 deletions

View file

@ -54,6 +54,8 @@
#endif #endif
gboolean _gst_vaapi_has_video_processing = FALSE;
#define PLUGIN_NAME "vaapi" #define PLUGIN_NAME "vaapi"
#define PLUGIN_DESC "VA-API based elements" #define PLUGIN_DESC "VA-API based elements"
#define PLUGIN_LICENSE "LGPL" #define PLUGIN_LICENSE "LGPL"
@ -217,6 +219,9 @@ plugin_init (GstPlugin * plugin)
if (!gst_vaapi_driver_is_whitelisted (display)) if (!gst_vaapi_driver_is_whitelisted (display))
goto unsupported_driver; goto unsupported_driver;
_gst_vaapi_has_video_processing =
gst_vaapi_display_has_video_processing (display);
decoders = display_get_decoder_codecs (display); decoders = display_get_decoder_codecs (display);
if (decoders) { if (decoders) {
gst_vaapidecode_register (plugin, decoders); gst_vaapidecode_register (plugin, decoders);
@ -226,10 +231,8 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, "vaapipostproc", gst_element_register (plugin, "vaapipostproc",
GST_RANK_PRIMARY, GST_TYPE_VAAPIPOSTPROC); GST_RANK_PRIMARY, GST_TYPE_VAAPIPOSTPROC);
if (gst_vaapi_display_has_video_processing (display)) {
gst_element_register (plugin, "vaapidecodebin", gst_element_register (plugin, "vaapidecodebin",
GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN); GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN);
}
gst_element_register (plugin, "vaapisink", gst_element_register (plugin, "vaapisink",
GST_RANK_PRIMARY, GST_TYPE_VAAPISINK); GST_RANK_PRIMARY, GST_TYPE_VAAPISINK);

30
gst/vaapi/gstvaapi.h Normal file
View file

@ -0,0 +1,30 @@
/*
* gstvaapi.h - VA-API element registration
*
* Copyright (C) 2011-2013 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* Copyright (C) 2011 Collabora Ltd.
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __GST_VAAPI_H__
#define __GST_VAAPI_H__
G_GNUC_INTERNAL extern gboolean _gst_vaapi_has_video_processing;
#endif /* __GST_VAAPI_H__ */

View file

@ -50,6 +50,7 @@
#include "gstvaapidecodebin.h" #include "gstvaapidecodebin.h"
#include "gstvaapivideocontext.h" #include "gstvaapivideocontext.h"
#include "gstvaapipluginbase.h" #include "gstvaapipluginbase.h"
#include "gstvaapi.h"
#define GST_PLUGIN_NAME "vaapidecodebin" #define GST_PLUGIN_NAME "vaapidecodebin"
#define GST_PLUGIN_DESC "A VA-API based bin with a decoder and a postprocessor" #define GST_PLUGIN_DESC "A VA-API based bin with a decoder and a postprocessor"
@ -296,6 +297,7 @@ gst_vaapi_decode_bin_configure (GstVaapiDecodeBin * vaapidecbin)
GstCaps *caps; GstCaps *caps;
GstPad *queue_srcpad, *bin_srcpad, *capsfilter_sinkpad, *vpp_srcpad; GstPad *queue_srcpad, *bin_srcpad, *capsfilter_sinkpad, *vpp_srcpad;
gboolean res; gboolean res;
gboolean has_vpp;
g_object_set (G_OBJECT (vaapidecbin->queue), g_object_set (G_OBJECT (vaapidecbin->queue),
"max-size-bytes", vaapidecbin->max_size_bytes, "max-size-bytes", vaapidecbin->max_size_bytes,
@ -305,6 +307,17 @@ gst_vaapi_decode_bin_configure (GstVaapiDecodeBin * vaapidecbin)
if (vaapidecbin->disable_vpp || vaapidecbin->configured) if (vaapidecbin->disable_vpp || vaapidecbin->configured)
return TRUE; return TRUE;
has_vpp = _gst_vaapi_has_video_processing;
if (!has_vpp && (vaapidecbin->deinterlace_method ==
GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE
|| vaapidecbin->deinterlace_method ==
GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED)) {
GST_ERROR_OBJECT (vaapidecbin,
"Don't have VPP support but advanced deinterlacing selected");
return FALSE;
}
GST_INFO_OBJECT (vaapidecbin, "enabling VPP"); GST_INFO_OBJECT (vaapidecbin, "enabling VPP");
/* capsfilter to avoid negotiation with vaapidecode */ /* capsfilter to avoid negotiation with vaapidecode */