From 211ba463692247918c54e3ba569e26643258bcc6 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Mon, 27 Jun 2022 11:54:28 -0400 Subject: [PATCH] va: filter/postproc: move unconditional props to vavpp Only conditional/dynamic properties should be installed/handled by vafilter. Thus, move and install the unconditional/static properties in vavpp. Part-of: --- .../gst-plugins-bad/sys/va/gstvafilter.c | 31 -------- .../gst-plugins-bad/sys/va/gstvafilter.h | 2 - subprojects/gst-plugins-bad/sys/va/gstvavpp.c | 72 +++++++++++++++---- 3 files changed, 60 insertions(+), 45 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c index cb5c4d43cf..3eccaf0c36 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c @@ -683,37 +683,6 @@ gst_va_filter_install_properties (GstVaFilter * self, GObjectClass * klass) common_flags)); } - /** - * GstVaPostProc:disable-passthrough: - * - * If set to %TRUE the filter will not enable passthrough mode, thus - * each frame will be processed. It's useful for cropping, for - * example. - * - * Since: 1.20 - */ - g_object_class_install_property (klass, - GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH, - g_param_spec_boolean ("disable-passthrough", "Disable Passthrough", - "Forces passing buffers through the postprocessor", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | GST_PARAM_MUTABLE_READY)); - - /** - * GstVaPostProc:add-borders: - * - * If set to %TRUE the filter will add black borders if necessary to - * keep the display aspect ratio. - * - * Since: 1.20 - */ - g_object_class_install_property (klass, GST_VA_FILTER_PROP_ADD_BORDERS, - g_param_spec_boolean ("add-borders", "Add Borders", - "Add black borders if necessary to keep the display aspect ratio", - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | GST_PARAM_MUTABLE_PLAYING)); - - return TRUE; } diff --git a/subprojects/gst-plugins-bad/sys/va/gstvafilter.h b/subprojects/gst-plugins-bad/sys/va/gstvafilter.h index 6955242d4d..dab2244d46 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvafilter.h +++ b/subprojects/gst-plugins-bad/sys/va/gstvafilter.h @@ -50,9 +50,7 @@ enum { GST_VA_FILTER_PROP_AUTO_SATURATION, GST_VA_FILTER_PROP_AUTO_BRIGHTNESS, GST_VA_FILTER_PROP_AUTO_CONTRAST, - GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH, GST_VA_FILTER_PROP_DEINTERLACE_METHOD, - GST_VA_FILTER_PROP_ADD_BORDERS, GST_VA_FILTER_PROP_HDR, GST_VA_FILTER_PROP_LAST }; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavpp.c b/subprojects/gst-plugins-bad/sys/va/gstvavpp.c index bf0c54f73f..7c52570e2f 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvavpp.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvavpp.c @@ -129,6 +129,17 @@ struct CData gchar *description; }; +enum +{ + PROP_DISABLE_PASSTHROUGH = GST_VA_FILTER_PROP_LAST + 1, + PROP_ADD_BORDERS, + N_PROPERTIES +}; + +static GParamSpec *properties[N_PROPERTIES - GST_VA_FILTER_PROP_LAST]; + +#define PROPERTIES(idx) properties[idx - GST_VA_FILTER_PROP_LAST] + /* convertions that disable passthrough */ enum { @@ -290,7 +301,11 @@ gst_va_vpp_set_property (GObject * object, guint prop_id, self->auto_contrast = g_value_get_boolean (value); g_atomic_int_set (&self->rebuild_filters, TRUE); break; - case GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH:{ + case GST_VA_FILTER_PROP_HDR: + self->hdr_mapping = g_value_get_boolean (value); + g_atomic_int_set (&self->rebuild_filters, TRUE); + break; + case PROP_DISABLE_PASSTHROUGH:{ gboolean disable_passthrough = g_value_get_boolean (value); if (disable_passthrough) self->op_flags |= VPP_CONVERT_DUMMY; @@ -298,13 +313,9 @@ gst_va_vpp_set_property (GObject * object, guint prop_id, self->op_flags &= ~VPP_CONVERT_DUMMY; break; } - case GST_VA_FILTER_PROP_ADD_BORDERS: + case PROP_ADD_BORDERS: self->add_borders = g_value_get_boolean (value); break; - case GST_VA_FILTER_PROP_HDR: - self->hdr_mapping = g_value_get_boolean (value); - g_atomic_int_set (&self->rebuild_filters, TRUE); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -360,15 +371,15 @@ gst_va_vpp_get_property (GObject * object, guint prop_id, GValue * value, case GST_VA_FILTER_PROP_AUTO_CONTRAST: g_value_set_boolean (value, self->auto_contrast); break; - case GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH: - g_value_set_boolean (value, (self->op_flags & VPP_CONVERT_DUMMY)); - break; - case GST_VA_FILTER_PROP_ADD_BORDERS: - g_value_set_boolean (value, self->add_borders); - break; case GST_VA_FILTER_PROP_HDR: g_value_set_boolean (value, self->hdr_mapping); break; + case PROP_DISABLE_PASSTHROUGH: + g_value_set_boolean (value, (self->op_flags & VPP_CONVERT_DUMMY)); + break; + case PROP_ADD_BORDERS: + g_value_set_boolean (value, self->add_borders); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2024,6 +2035,41 @@ gst_va_vpp_sink_event (GstBaseTransform * trans, GstEvent * event) return GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (trans, event); } +static void +_install_static_properties (GObjectClass * klass) +{ + /** + * GstVaPostProc:disable-passthrough: + * + * If set to %TRUE the filter will not enable passthrough mode, thus + * each frame will be processed. It's useful for cropping, for + * example. + * + * Since: 1.20 + */ + PROPERTIES (PROP_DISABLE_PASSTHROUGH) = + g_param_spec_boolean ("disable-passthrough", "Disable Passthrough", + "Forces passing buffers through the postprocessor", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_READY); + g_object_class_install_property (klass, PROP_DISABLE_PASSTHROUGH, + PROPERTIES (PROP_DISABLE_PASSTHROUGH)); + + /** + * GstVaPostProc:add-borders: + * + * If set to %TRUE the filter will add black borders if necessary to + * keep the display aspect ratio. + * + * Since: 1.20 + */ + PROPERTIES (PROP_ADD_BORDERS) = g_param_spec_boolean ("add-borders", + "Add Borders", + "Add black borders if necessary to keep the display aspect ratio", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING); + g_object_class_install_property (klass, PROP_ADD_BORDERS, + PROPERTIES (PROP_ADD_BORDERS)); +} + static void gst_va_vpp_class_init (gpointer g_class, gpointer class_data) { @@ -2130,6 +2176,8 @@ gst_va_vpp_class_init (gpointer g_class, gpointer class_data) gst_va_filter_install_properties (filter, object_class); + _install_static_properties (object_class); + g_free (long_name); g_free (cdata->description); g_free (cdata->render_device_path);