summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2021-08-10 17:55:43 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2021-09-10 14:45:00 +0200
commit0a7828e9ba931725d3f8a3a6c24d8f472dd9278b (patch)
tree8b006de46afa1381e27a396ff84c1a9ce7860035 /sys
parentece5feeb8d713acc633098ed1509c28c1f6ada18 (diff)
downloadgstreamer-plugins-bad-0a7828e9ba931725d3f8a3a6c24d8f472dd9278b.tar.gz
vapostproc: Move up color balance detection to plugin.
In order to install the color balance interface, a GstVaFilter is instantiated and queried to know if it supports color balance filter. It was done just after the GObject was registered. Now, it's done before. The reason of this change is that deinterlace element has to be registered only if deinterlace filter is available, using only one instantiate of GstVaFilter. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
Diffstat (limited to 'sys')
-rw-r--r--sys/va/gstvavpp.c14
-rw-r--r--sys/va/gstvavpp.h1
-rw-r--r--sys/va/plugin.c20
3 files changed, 24 insertions, 11 deletions
diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c
index 1e43bace3..b0ec392eb 100644
--- a/sys/va/gstvavpp.c
+++ b/sys/va/gstvavpp.c
@@ -1893,7 +1893,8 @@ _register_debug_category (gpointer data)
}
gboolean
-gst_va_vpp_register (GstPlugin * plugin, GstVaDevice * device, guint rank)
+gst_va_vpp_register (GstPlugin * plugin, GstVaDevice * device,
+ gboolean has_colorbalance, guint rank)
{
static GOnce debug_once = G_ONCE_INIT;
GType type;
@@ -1940,14 +1941,9 @@ gst_va_vpp_register (GstPlugin * plugin, GstVaDevice * device, guint rank)
type = g_type_register_static (GST_TYPE_VA_BASE_TRANSFORM, type_name,
&type_info, 0);
- {
- GstVaFilter *filter = gst_va_filter_new (device->display);
- if (gst_va_filter_open (filter)
- && gst_va_filter_has_filter (filter, VAProcFilterColorBalance)) {
- const GInterfaceInfo info = { gst_va_vpp_colorbalance_init, NULL, NULL };
- g_type_add_interface_static (type, GST_TYPE_COLOR_BALANCE, &info);
- }
- gst_object_unref (filter);
+ if (has_colorbalance) {
+ const GInterfaceInfo info = { gst_va_vpp_colorbalance_init, NULL, NULL };
+ g_type_add_interface_static (type, GST_TYPE_COLOR_BALANCE, &info);
}
ret = gst_element_register (plugin, feature_name, rank, type);
diff --git a/sys/va/gstvavpp.h b/sys/va/gstvavpp.h
index db9b3ee3b..68443283a 100644
--- a/sys/va/gstvavpp.h
+++ b/sys/va/gstvavpp.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
gboolean gst_va_vpp_register (GstPlugin * plugin,
GstVaDevice * device,
+ gboolean has_colorbalance,
guint rank);
G_END_DECLS
diff --git a/sys/va/plugin.c b/sys/va/plugin.c
index d8f5cbf3d..b78f7ef69 100644
--- a/sys/va/plugin.c
+++ b/sys/va/plugin.c
@@ -27,15 +27,16 @@
#include "config.h"
#endif
+#include "gstvaav1dec.h"
#include "gstvacaps.h"
#include "gstvadevice.h"
+#include "gstvafilter.h"
#include "gstvah264dec.h"
#include "gstvah265dec.h"
#include "gstvampeg2dec.h"
#include "gstvaprofile.h"
#include "gstvavp8dec.h"
#include "gstvavp9dec.h"
-#include "gstvaav1dec.h"
#include "gstvavpp.h"
#define GST_CAT_DEFAULT gstva_debug
@@ -188,7 +189,22 @@ plugin_register_encoders (GstPlugin * plugin, GstVaDevice * device,
static void
plugin_register_vpp (GstPlugin * plugin, GstVaDevice * device)
{
- if (!gst_va_vpp_register (plugin, device, GST_RANK_NONE))
+ GstVaFilter *filter;
+ gboolean has_colorbalance;
+
+ has_colorbalance = FALSE;
+ filter = gst_va_filter_new (device->display);
+ if (gst_va_filter_open (filter)) {
+ has_colorbalance =
+ gst_va_filter_has_filter (filter, VAProcFilterColorBalance);
+ } else {
+ GST_WARNING ("Failed open VA filter");
+ gst_object_unref (filter);
+ return;
+ }
+ gst_object_unref (filter);
+
+ if (!gst_va_vpp_register (plugin, device, has_colorbalance, GST_RANK_NONE))
GST_WARNING ("Failed to register postproc: %s", device->render_device_path);
}