qsvencoder: Move common property to baseclass

adapter-luid and device-path are common for all codecs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2467>
This commit is contained in:
Seungha Yang 2022-05-22 21:38:34 +09:00 committed by GStreamer Marge Bot
parent fc75e38496
commit 8e665fa435
5 changed files with 24 additions and 96 deletions

View file

@ -64,6 +64,8 @@ gst_qsv_coding_option_get_type (void)
enum enum
{ {
PROP_0, PROP_0,
PROP_ADAPTER_LUID,
PROP_DEVICE_PATH,
PROP_TARGET_USAGE, PROP_TARGET_USAGE,
PROP_LOW_LATENCY, PROP_LOW_LATENCY,
}; };
@ -175,6 +177,21 @@ gst_qsv_encoder_class_init (GstQsvEncoderClass * klass)
object_class->set_property = gst_qsv_encoder_set_property; object_class->set_property = gst_qsv_encoder_set_property;
object_class->get_property = gst_qsv_encoder_get_property; object_class->get_property = gst_qsv_encoder_get_property;
#ifdef G_OS_WIN32
g_object_class_install_property (object_class, PROP_ADAPTER_LUID,
g_param_spec_int64 ("adapter-luid", "Adapter LUID",
"DXGI Adapter LUID (Locally Unique Identifier) of created device",
G_MININT64, G_MAXINT64, 0,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)));
#else
g_object_class_install_property (object_class, PROP_DEVICE_PATH,
g_param_spec_string ("device-path", "Device Path",
"DRM device path", NULL,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
#endif
g_object_class_install_property (object_class, PROP_TARGET_USAGE, g_object_class_install_property (object_class, PROP_TARGET_USAGE,
g_param_spec_uint ("target-usage", "Target Usage", g_param_spec_uint ("target-usage", "Target Usage",
"1: Best quality, 4: Balanced, 7: Best speed", "1: Best quality, 4: Balanced, 7: Best speed",
@ -277,8 +294,15 @@ gst_qsv_encoder_get_property (GObject * object, guint prop_id, GValue * value,
{ {
GstQsvEncoder *self = GST_QSV_ENCODER (object); GstQsvEncoder *self = GST_QSV_ENCODER (object);
GstQsvEncoderPrivate *priv = self->priv; GstQsvEncoderPrivate *priv = self->priv;
GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
switch (prop_id) { switch (prop_id) {
case PROP_ADAPTER_LUID:
g_value_set_int64 (value, klass->adapter_luid);
break;
case PROP_DEVICE_PATH:
g_value_set_string (value, klass->display_path);
break;
case PROP_TARGET_USAGE: case PROP_TARGET_USAGE:
g_value_set_uint (value, priv->target_usage); g_value_set_uint (value, priv->target_usage);
break; break;

View file

@ -124,8 +124,6 @@ gst_qsv_h264_enc_rc_lookahead_ds_get_type (void)
enum enum
{ {
PROP_0, PROP_0,
PROP_ADAPTER_LUID,
PROP_DEVICE_PATH,
PROP_CABAC, PROP_CABAC,
PROP_MIN_QP_I, PROP_MIN_QP_I,
PROP_MIN_QP_P, PROP_MIN_QP_P,
@ -282,21 +280,6 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data)
object_class->set_property = gst_qsv_h264_enc_set_property; object_class->set_property = gst_qsv_h264_enc_set_property;
object_class->get_property = gst_qsv_h264_enc_get_property; object_class->get_property = gst_qsv_h264_enc_get_property;
#ifdef G_OS_WIN32
g_object_class_install_property (object_class, PROP_ADAPTER_LUID,
g_param_spec_int64 ("adapter-luid", "Adapter LUID",
"DXGI Adapter LUID (Locally Unique Identifier) of created device",
G_MININT64, G_MAXINT64, qsvenc_class->adapter_luid,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)));
#else
g_object_class_install_property (object_class, PROP_DEVICE_PATH,
g_param_spec_string ("device-path", "Device Path",
"DRM device path", cdata->display_path,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
#endif
g_object_class_install_property (object_class, PROP_CABAC, g_object_class_install_property (object_class, PROP_CABAC,
g_param_spec_enum ("cabac", "Cabac", "Enables CABAC entropy coding", g_param_spec_enum ("cabac", "Cabac", "Enables CABAC entropy coding",
GST_TYPE_QSV_CODING_OPTION, DEFAULT_CABAC, GST_TYPE_QSV_CODING_OPTION, DEFAULT_CABAC,
@ -681,15 +664,8 @@ gst_qsv_h264_enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
{ {
GstQsvH264Enc *self = GST_QSV_H264_ENC (object); GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
switch (prop_id) { switch (prop_id) {
case PROP_ADAPTER_LUID:
g_value_set_int64 (value, klass->adapter_luid);
break;
case PROP_DEVICE_PATH:
g_value_set_string (value, klass->display_path);
break;
case PROP_CABAC: case PROP_CABAC:
g_value_set_enum (value, self->cabac); g_value_set_enum (value, self->cabac);
break; break;

View file

@ -94,8 +94,6 @@ gst_qsv_h265_enc_rate_control_get_type (void)
enum enum
{ {
PROP_0, PROP_0,
PROP_ADAPTER_LUID,
PROP_DEVICE_PATH,
PROP_MIN_QP_I, PROP_MIN_QP_I,
PROP_MIN_QP_P, PROP_MIN_QP_P,
PROP_MIN_QP_B, PROP_MIN_QP_B,
@ -239,21 +237,6 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data)
object_class->set_property = gst_qsv_h265_enc_set_property; object_class->set_property = gst_qsv_h265_enc_set_property;
object_class->get_property = gst_qsv_h265_enc_get_property; object_class->get_property = gst_qsv_h265_enc_get_property;
#ifdef G_OS_WIN32
g_object_class_install_property (object_class, PROP_ADAPTER_LUID,
g_param_spec_int64 ("adapter-luid", "Adapter LUID",
"DXGI Adapter LUID (Locally Unique Identifier) of created device",
G_MININT64, G_MAXINT64, qsvenc_class->adapter_luid,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)));
#else
g_object_class_install_property (object_class, PROP_DEVICE_PATH,
g_param_spec_string ("device-path", "Device Path",
"DRM device path", cdata->display_path,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
#endif
g_object_class_install_property (object_class, PROP_MIN_QP_I, g_object_class_install_property (object_class, PROP_MIN_QP_I,
g_param_spec_uint ("min-qp-i", "Min QP I", g_param_spec_uint ("min-qp-i", "Min QP I",
"Minimum allowed QP value for I-frame types (0: default)", "Minimum allowed QP value for I-frame types (0: default)",
@ -586,15 +569,8 @@ gst_qsv_h265_enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
{ {
GstQsvH265Enc *self = GST_QSV_H265_ENC (object); GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
switch (prop_id) { switch (prop_id) {
case PROP_ADAPTER_LUID:
g_value_set_int64 (value, klass->adapter_luid);
break;
case PROP_DEVICE_PATH:
g_value_set_string (value, klass->display_path);
break;
case PROP_MIN_QP_I: case PROP_MIN_QP_I:
g_value_set_uint (value, self->min_qp_i); g_value_set_uint (value, self->min_qp_i);
break; break;

View file

@ -39,8 +39,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_qsv_jpeg_enc_debug);
enum enum
{ {
PROP_0, PROP_0,
PROP_ADAPTER_LUID,
PROP_DEVICE_PATH,
PROP_QUALITY, PROP_QUALITY,
}; };
@ -113,21 +111,6 @@ gst_qsv_jpeg_enc_class_init (GstQsvJpegEncClass * klass, gpointer data)
object_class->set_property = gst_qsv_jpeg_enc_set_property; object_class->set_property = gst_qsv_jpeg_enc_set_property;
object_class->get_property = gst_qsv_jpeg_enc_get_property; object_class->get_property = gst_qsv_jpeg_enc_get_property;
#ifdef G_OS_WIN32
g_object_class_install_property (object_class, PROP_ADAPTER_LUID,
g_param_spec_int64 ("adapter-luid", "Adapter LUID",
"DXGI Adapter LUID (Locally Unique Identifier) of created device",
G_MININT64, G_MAXINT64, qsvenc_class->adapter_luid,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)));
#else
g_object_class_install_property (object_class, PROP_DEVICE_PATH,
g_param_spec_string ("device-path", "Device Path",
"DRM device path", cdata->display_path,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
#endif
g_object_class_install_property (object_class, PROP_QUALITY, g_object_class_install_property (object_class, PROP_QUALITY,
g_param_spec_uint ("quality", "Quality", g_param_spec_uint ("quality", "Quality",
"Encoding quality, 100 for best quality", "Encoding quality, 100 for best quality",
@ -226,15 +209,8 @@ gst_qsv_jpeg_enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
{ {
GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object); GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
switch (prop_id) { switch (prop_id) {
case PROP_ADAPTER_LUID:
g_value_set_int64 (value, klass->adapter_luid);
break;
case PROP_DEVICE_PATH:
g_value_set_string (value, klass->display_path);
break;
case PROP_QUALITY: case PROP_QUALITY:
g_value_set_uint (value, self->quality); g_value_set_uint (value, self->quality);
break; break;

View file

@ -61,8 +61,6 @@ gst_qsv_vp9_enc_rate_control_get_type (void)
enum enum
{ {
PROP_0, PROP_0,
PROP_ADAPTER_LUID,
PROP_DEVICE_PATH,
PROP_QP_I, PROP_QP_I,
PROP_QP_P, PROP_QP_P,
PROP_GOP_SIZE, PROP_GOP_SIZE,
@ -162,21 +160,6 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data)
object_class->set_property = gst_qsv_vp9_enc_set_property; object_class->set_property = gst_qsv_vp9_enc_set_property;
object_class->get_property = gst_qsv_vp9_enc_get_property; object_class->get_property = gst_qsv_vp9_enc_get_property;
#ifdef G_OS_WIN32
g_object_class_install_property (object_class, PROP_ADAPTER_LUID,
g_param_spec_int64 ("adapter-luid", "Adapter LUID",
"DXGI Adapter LUID (Locally Unique Identifier) of created device",
G_MININT64, G_MAXINT64, qsvenc_class->adapter_luid,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)));
#else
g_object_class_install_property (object_class, PROP_DEVICE_PATH,
g_param_spec_string ("device-path", "Device Path",
"DRM device path", cdata->display_path,
(GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
#endif
g_object_class_install_property (object_class, PROP_QP_I, g_object_class_install_property (object_class, PROP_QP_I,
g_param_spec_uint ("qp-i", "QP I", g_param_spec_uint ("qp-i", "QP I",
"Constant quantizer for I frames (0: default)", "Constant quantizer for I frames (0: default)",
@ -363,15 +346,8 @@ gst_qsv_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
{ {
GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object); GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
switch (prop_id) { switch (prop_id) {
case PROP_ADAPTER_LUID:
g_value_set_int64 (value, klass->adapter_luid);
break;
case PROP_DEVICE_PATH:
g_value_set_string (value, klass->display_path);
break;
case PROP_QP_I: case PROP_QP_I:
g_value_set_uint (value, self->qp_i); g_value_set_uint (value, self->qp_i);
break; break;