qsvencoder: Move common property to baseclass
authorSeungha Yang <seungha@centricular.com>
Sun, 22 May 2022 12:38:34 +0000 (21:38 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 23 May 2022 13:28:11 +0000 (13:28 +0000)
adapter-luid and device-path are common for all codecs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2467>

subprojects/gst-plugins-bad/sys/qsv/gstqsvencoder.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp

index 3b6e7472be9852bfc24c6b798c18c4d3cf68f872..dbb82be9669632f3cf2c65ba39c8c1c59ead2353 100644 (file)
@@ -64,6 +64,8 @@ gst_qsv_coding_option_get_type (void)
 enum
 {
   PROP_0,
+  PROP_ADAPTER_LUID,
+  PROP_DEVICE_PATH,
   PROP_TARGET_USAGE,
   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->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_param_spec_uint ("target-usage", "Target Usage",
           "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);
   GstQsvEncoderPrivate *priv = self->priv;
+  GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
 
   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:
       g_value_set_uint (value, priv->target_usage);
       break;
index 5ebd0f2bd977af69d6eddb84fe30ae4c1c79e526..2f07fcddb8fef0ce1dd9ed7adf7f4722669fedf1 100644 (file)
@@ -124,8 +124,6 @@ gst_qsv_h264_enc_rc_lookahead_ds_get_type (void)
 enum
 {
   PROP_0,
-  PROP_ADAPTER_LUID,
-  PROP_DEVICE_PATH,
   PROP_CABAC,
   PROP_MIN_QP_I,
   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->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_param_spec_enum ("cabac", "Cabac", "Enables CABAC entropy coding",
           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)
 {
   GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
-  GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
 
   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:
       g_value_set_enum (value, self->cabac);
       break;
index a737006ef544e0e3c14070bdd5b3f7ccdac50514..443458920e6caf1f1be6f267fe05b44762827934 100644 (file)
@@ -94,8 +94,6 @@ gst_qsv_h265_enc_rate_control_get_type (void)
 enum
 {
   PROP_0,
-  PROP_ADAPTER_LUID,
-  PROP_DEVICE_PATH,
   PROP_MIN_QP_I,
   PROP_MIN_QP_P,
   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->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_param_spec_uint ("min-qp-i", "Min QP I",
           "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)
 {
   GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
-  GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
 
   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:
       g_value_set_uint (value, self->min_qp_i);
       break;
index 66e499bbf76f723c9bce9aef21af8aec0063d010..44a5ac6768e6f637e07e7281d35a2ad5c6a75f0a 100644 (file)
@@ -39,8 +39,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_qsv_jpeg_enc_debug);
 enum
 {
   PROP_0,
-  PROP_ADAPTER_LUID,
-  PROP_DEVICE_PATH,
   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->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_param_spec_uint ("quality", "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)
 {
   GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
-  GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
 
   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:
       g_value_set_uint (value, self->quality);
       break;
index 63ff0486dd7160559f23c2d7a1a4027c1ea8c216..a24244a85e9ad930ccec72b25d8af23625640a56 100644 (file)
@@ -61,8 +61,6 @@ gst_qsv_vp9_enc_rate_control_get_type (void)
 enum
 {
   PROP_0,
-  PROP_ADAPTER_LUID,
-  PROP_DEVICE_PATH,
   PROP_QP_I,
   PROP_QP_P,
   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->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_param_spec_uint ("qp-i", "QP I",
           "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)
 {
   GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
-  GstQsvEncoderClass *klass = GST_QSV_ENCODER_GET_CLASS (self);
 
   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:
       g_value_set_uint (value, self->qp_i);
       break;