From 6a3776c5271869467e3c1a406e6500ab8b79c64d Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 20 Apr 2022 23:06:56 +0900 Subject: [PATCH] qsv: Add GPU description to element long-name on Windows Would be useful for a multi-Intel-GPU system Part-of: --- .../gst-plugins-bad/sys/qsv/gstqsvdecoder.h | 1 + .../gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp | 20 ++++++++++++----- .../gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp | 22 ++++++++++++++----- .../gst-plugins-bad/sys/qsv/gstqsvh265dec.cpp | 19 +++++++++++----- .../gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp | 22 ++++++++++++++----- .../gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp | 22 ++++++++++++++----- .../gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp | 22 ++++++++++++++----- 7 files changed, 92 insertions(+), 36 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvdecoder.h b/subprojects/gst-plugins-bad/sys/qsv/gstqsvdecoder.h index fa35694be5..19eb543d3d 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvdecoder.h +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvdecoder.h @@ -43,6 +43,7 @@ typedef struct _GstQsvDecoderClassData guint impl_index; gint64 adapter_luid; gchar *display_path; + gchar *description; GstCaps *sink_caps; GstCaps *src_caps; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp index 3b60276900..2248249979 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264dec.cpp @@ -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 "); +#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 "); +#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; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp index cb8433d88d..5ebd0f2bd9 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp @@ -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 "); +#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 "); +#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; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265dec.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265dec.cpp index 6a16f1127f..bc9d54de6d 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265dec.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265dec.cpp @@ -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 "); +#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 "); +#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; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp index 2bbe801e24..a737006ef5 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp @@ -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 "); +#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 "); +#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; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp index fe74e7f96c..66e499bbf7 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvjpegenc.cpp @@ -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 "); +#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 "); +#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; diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp index 511143f07c..63ff0486dd 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp @@ -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 "); +#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 "); +#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;