va: postproc: add scale-method property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2654>
This commit is contained in:
U. Artie Eoff 2022-06-27 12:06:50 -04:00
parent 211ba46369
commit c4a9a96a15

View file

@ -113,6 +113,7 @@ struct _GstVaVpp
gboolean add_borders; gboolean add_borders;
gint borders_h; gint borders_h;
gint borders_w; gint borders_w;
guint32 scale_method;
gboolean hdr_mapping; gboolean hdr_mapping;
gboolean has_hdr_meta; gboolean has_hdr_meta;
@ -133,6 +134,7 @@ enum
{ {
PROP_DISABLE_PASSTHROUGH = GST_VA_FILTER_PROP_LAST + 1, PROP_DISABLE_PASSTHROUGH = GST_VA_FILTER_PROP_LAST + 1,
PROP_ADD_BORDERS, PROP_ADD_BORDERS,
PROP_SCALE_METHOD,
N_PROPERTIES N_PROPERTIES
}; };
@ -241,6 +243,9 @@ _update_properties_unlocked (GstVaVpp * self)
} else { } else {
self->op_flags &= ~VPP_CONVERT_DIRECTION; self->op_flags &= ~VPP_CONVERT_DIRECTION;
} }
if (!gst_va_filter_set_scale_method (btrans->filter, self->scale_method))
GST_WARNING_OBJECT (self, "could not set the filter scale method.");
} }
static void static void
@ -316,6 +321,9 @@ gst_va_vpp_set_property (GObject * object, guint prop_id,
case PROP_ADD_BORDERS: case PROP_ADD_BORDERS:
self->add_borders = g_value_get_boolean (value); self->add_borders = g_value_get_boolean (value);
break; break;
case PROP_SCALE_METHOD:
self->scale_method = g_value_get_enum (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -380,6 +388,9 @@ gst_va_vpp_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_ADD_BORDERS: case PROP_ADD_BORDERS:
g_value_set_boolean (value, self->add_borders); g_value_set_boolean (value, self->add_borders);
break; break;
case PROP_SCALE_METHOD:
g_value_set_enum (value, self->scale_method);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -2067,7 +2078,21 @@ _install_static_properties (GObjectClass * klass)
"Add black borders if necessary to keep the display aspect ratio", FALSE, "Add black borders if necessary to keep the display aspect ratio", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING);
g_object_class_install_property (klass, PROP_ADD_BORDERS, g_object_class_install_property (klass, PROP_ADD_BORDERS,
PROPERTIES (PROP_ADD_BORDERS)); PROPERTIES (PROP_ADD_BORDERS));
/**
* GstVaPostProc:scale-method
*
* Sets the scale method algorithm to use when resizing.
*
* Since: 1.22
*/
PROPERTIES (PROP_SCALE_METHOD) = g_param_spec_enum ("scale-method",
"Scale Method", "Scale method to use", GST_TYPE_VA_SCALE_METHOD,
VA_FILTER_SCALING_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| GST_PARAM_MUTABLE_PLAYING);
g_object_class_install_property (klass, PROP_SCALE_METHOD,
PROPERTIES (PROP_SCALE_METHOD));
} }
static void static void