vaapi: declare external dependencies

There are two main external dependencies that define the feature set of this
plugin: a) the kernel and b) the VA driver

This patch tracks both dependencies, if any of them change, GStreamer will
re-inspect the plugin.

The kernel is tracked through the device files /dev/dri/card*

The VA driver is tracked through the files VA_DRIVERS_PATH/*_drv_video.so,
where VA_DRIVERS_PATH is the one defined in libva package configuration. Also,
the environment variables LIBVA_DRIVERS_PATH and LIBVA_DRIVER_NAME are tracked
since they modify the driver lookup.

Additionally, the environment variable GST_VAAPI_ALL_DRIVERS is tracked too.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-06-28 11:33:18 +02:00
parent 024d540195
commit 1cba2f3633
2 changed files with 30 additions and 0 deletions

View file

@ -488,6 +488,9 @@ dnl ---------------------------------------------------------------------------
dnl Core API
PKG_CHECK_MODULES([LIBVA], [libva >= $VAAPI_REQ])
VA_VERSION_STR=`$PKG_CONFIG --modversion libva`
VA_DRIVERS_PATH=`$PKG_CONFIG --variable=driverdir libva`
AC_DEFINE_UNQUOTED([VA_DRIVERS_PATH], ["$VA_DRIVERS_PATH"],
[VA drivers path])
dnl VA/DRM API
if test $USE_DRM -eq 1; then

View file

@ -53,9 +53,36 @@
#define PLUGIN_DESC "VA-API based elements"
#define PLUGIN_LICENSE "LGPL"
static void
plugin_add_dependencies (GstPlugin * plugin)
{
const gchar *envvars[] = { "GST_VAAPI_ALL_DRIVERS", "LIBVA_DRIVER_NAME",
NULL
};
const gchar *kernel_paths[] = { "/dev/dri", NULL };
const gchar *kernel_names[] = { "card", "render" };
/* features get updated upon changes in /dev/dri/card* */
gst_plugin_add_dependency (plugin, NULL, kernel_paths, kernel_names,
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX);
/* features get updated upon changes in VA environment variables */
gst_plugin_add_dependency (plugin, envvars, NULL, NULL,
GST_PLUGIN_DEPENDENCY_FLAG_NONE);
/* features get updated upon changes in default VA drivers
* directory */
gst_plugin_add_dependency_simple (plugin, "LIBVA_DRIVERS_PATH",
VA_DRIVERS_PATH, "_drv_video.so",
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX |
GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
plugin_add_dependencies (plugin);
gst_vaapidecode_register (plugin);
gst_element_register (plugin, "vaapipostproc",