qsv: Add GPU description to element long-name on Windows
authorSeungha Yang <seungha@centricular.com>
Wed, 20 Apr 2022 14:06:56 +0000 (23:06 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 20 Apr 2022 18:49:18 +0000 (18:49 +0000)
Would be useful for a multi-Intel-GPU system

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

subprojects/gst-plugins-bad/sys/qsv/gstqsvdecoder.h
subprojects/gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvh265dec.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 fa35694..19eb543 100644 (file)
@@ -43,6 +43,7 @@ typedef struct _GstQsvDecoderClassData
   guint impl_index;
   gint64 adapter_luid;
   gchar *display_path;
+  gchar *description;
 
   GstCaps *sink_caps;
   GstCaps *src_caps;
index 3b60276..2248249 100644 (file)
@@ -74,11 +74,21 @@ gst_qsv_h264_dec_class_init (GstQsvH264DecClass * klass, gpointer data)
 
   parent_class = (GTypeClass *) g_type_class_peek_parent (klass);
 
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " H.264 Decoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Decoder/Video/Hardware",
+      "Intel Quick Sync Video H.264 Decoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video H.264 Decoder",
       "Codec/Decoder/Video/Hardware",
       "Intel Quick Sync Video H.264 Decoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -101,6 +111,7 @@ gst_qsv_h264_dec_class_init (GstQsvH264DecClass * klass, gpointer data)
 
   gst_caps_unref (cdata->sink_caps);
   gst_caps_unref (cdata->src_caps);
+  g_free (cdata->description);
   g_free (cdata);
 }
 
@@ -524,13 +535,10 @@ gst_qsv_h264_dec_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->impl_index = impl_index;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;
index cb8433d..5ebd0f2 100644 (file)
@@ -178,6 +178,7 @@ typedef struct _GstQsvH264EncClassData
   guint impl_index;
   gint64 adapter_luid;
   gchar *display_path;
+  gchar *description;
 } GstQsvH264EncClassData;
 
 typedef struct _GstQsvH264Enc
@@ -429,11 +430,22 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data)
           (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
   parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
+
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " H.264 Encoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Encoder/Video/Hardware",
+      "Intel Quick Sync Video H.264 Encoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video H.264 Encoder",
       "Codec/Encoder/Video/Hardware",
       "Intel Quick Sync Video H.264 Encoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -459,6 +471,7 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data)
 
   gst_caps_unref (cdata->sink_caps);
   gst_caps_unref (cdata->src_caps);
+  g_free (cdata->description);
   g_free (cdata);
 }
 
@@ -1878,13 +1891,10 @@ gst_qsv_h264_enc_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->impl_index = impl_index;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;
index 6a16f11..bc9d54d 100644 (file)
@@ -76,11 +76,21 @@ gst_qsv_h265_dec_class_init (GstQsvH265DecClass * klass, gpointer data)
 
   parent_class = (GTypeClass *) g_type_class_peek_parent (klass);
 
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " H.265 Decoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Decoder/Video/Hardware",
+      "Intel Quick Sync Video H.265 Decoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video H.265 Decoder",
       "Codec/Decoder/Video/Hardware",
       "Intel Quick Sync Video H.265 Decoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -588,13 +598,10 @@ gst_qsv_h265_dec_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->impl_index = impl_index;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;
index 2bbe801..a737006 100644 (file)
@@ -138,6 +138,7 @@ typedef struct _GstQsvH265EncClassData
   guint impl_index;
   gint64 adapter_luid;
   gchar *display_path;
+  gchar *description;
   gboolean hdr10_aware;
 } GstQsvH265EncClassData;
 
@@ -361,11 +362,22 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data)
           (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
   parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
+
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " H.265 Encoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Encoder/Video/Hardware",
+      "Intel Quick Sync Video H.265 Encoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video H.265 Encoder",
       "Codec/Encoder/Video/Hardware",
       "Intel Quick Sync Video H.265 Encoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -393,6 +405,7 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data)
 
   gst_caps_unref (cdata->sink_caps);
   gst_caps_unref (cdata->src_caps);
+  g_free (cdata->description);
   g_free (cdata);
 }
 
@@ -1551,13 +1564,10 @@ gst_qsv_h265_enc_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->hdr10_aware = hdr10_aware;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;
index fe74e7f..66e499b 100644 (file)
@@ -53,6 +53,7 @@ typedef struct _GstQsvJpegEncClassData
   guint impl_index;
   gint64 adapter_luid;
   gchar *display_path;
+  gchar *description;
   gboolean interlaved;
 } GstQsvJpegEncClassData;
 
@@ -134,11 +135,22 @@ gst_qsv_jpeg_enc_class_init (GstQsvJpegEncClass * klass, gpointer data)
           (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
   parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
+
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " JPEG Encoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Encoder/Video/Hardware",
+      "Intel Quick Sync Video JPEG Encoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video JPEG Encoder",
       "Codec/Encoder/Video/Hardware",
       "Intel Quick Sync Video JPEG Encoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -157,6 +169,7 @@ gst_qsv_jpeg_enc_class_init (GstQsvJpegEncClass * klass, gpointer data)
 
   gst_caps_unref (cdata->sink_caps);
   gst_caps_unref (cdata->src_caps);
+  g_free (cdata->description);
   g_free (cdata);
 }
 
@@ -484,13 +497,10 @@ gst_qsv_jpeg_enc_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->interlaved = interlaved;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;
index 511143f..63ff048 100644 (file)
@@ -88,6 +88,7 @@ typedef struct _GstQsvVP9EncClassData
   guint impl_index;
   gint64 adapter_luid;
   gchar *display_path;
+  gchar *description;
 } GstQsvVP9EncClassData;
 
 typedef struct _GstQsvVP9Enc
@@ -220,11 +221,22 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data)
           (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
   parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
+
+#ifdef G_OS_WIN32
+  std::string long_name = "Intel Quick Sync Video " +
+      std::string (cdata->description) + " VP9 Encoder";
+
+  gst_element_class_set_metadata (element_class, long_name.c_str (),
+      "Codec/Encoder/Video/Hardware",
+      "Intel Quick Sync Video VP9 Encoder",
+      "Seungha Yang <seungha@centricular.com>");
+#else
   gst_element_class_set_static_metadata (element_class,
       "Intel Quick Sync Video VP9 Encoder",
       "Codec/Encoder/Video/Hardware",
       "Intel Quick Sync Video VP9 Encoder",
       "Seungha Yang <seungha@centricular.com>");
+#endif
 
   gst_element_class_add_pad_template (element_class,
       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
@@ -243,6 +255,7 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data)
 
   gst_caps_unref (cdata->sink_caps);
   gst_caps_unref (cdata->src_caps);
+  g_free (cdata->description);
   g_free (cdata);
 }
 
@@ -993,13 +1006,10 @@ gst_qsv_vp9_enc_register (GstPlugin * plugin, guint rank, guint impl_index,
   cdata->impl_index = impl_index;
 
 #ifdef G_OS_WIN32
-  gint64 device_luid;
-  g_object_get (device, "adapter-luid", &device_luid, nullptr);
-  cdata->adapter_luid = device_luid;
+  g_object_get (device, "adapter-luid", &cdata->adapter_luid,
+      "description", &cdata->description, nullptr);
 #else
-  gchar *display_path;
-  g_object_get (device, "path", &display_path, nullptr);
-  cdata->display_path = display_path;
+  g_object_get (device, "path", &cdata->display_path, nullptr);
 #endif
 
   GType type;