mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
nvcodec: Add cuda-device-id read-only property to CUVID decoders
Similar to the other hardware decoder plugins, provides assigned device id via property Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2665>
This commit is contained in:
parent
0af4a53bc2
commit
1e11c05591
1 changed files with 21 additions and 3 deletions
|
@ -46,6 +46,7 @@ enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_MAX_DISPLAY_DELAY,
|
PROP_MAX_DISPLAY_DELAY,
|
||||||
|
PROP_CUDA_DEVICE_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_NVCODEC_GST_GL
|
||||||
|
@ -197,11 +198,15 @@ gst_nv_dec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
GParamSpec * pspec)
|
GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstNvDec *nvdec = GST_NVDEC (object);
|
GstNvDec *nvdec = GST_NVDEC (object);
|
||||||
|
GstNvDecClass *klass = GST_NVDEC_GET_CLASS (nvdec);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_MAX_DISPLAY_DELAY:
|
case PROP_MAX_DISPLAY_DELAY:
|
||||||
g_value_set_int (value, nvdec->max_display_delay);
|
g_value_set_int (value, nvdec->max_display_delay);
|
||||||
break;
|
break;
|
||||||
|
case PROP_CUDA_DEVICE_ID:
|
||||||
|
g_value_set_uint (value, klass->cuda_device_id);
|
||||||
|
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;
|
||||||
|
@ -247,6 +252,18 @@ gst_nvdec_class_init (GstNvDecClass * klass)
|
||||||
"(auto = -1)",
|
"(auto = -1)",
|
||||||
-1, G_MAXINT, DEFAULT_MAX_DISPLAY_DELAY,
|
-1, G_MAXINT, DEFAULT_MAX_DISPLAY_DELAY,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstNvDec:cuda-device-id:
|
||||||
|
*
|
||||||
|
* Assigned CUDA device id
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class, PROP_CUDA_DEVICE_ID,
|
||||||
|
g_param_spec_uint ("cuda-device-id", "CUDA device id",
|
||||||
|
"Assigned CUDA device id", 0, G_MAXINT, 0,
|
||||||
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2050,6 +2067,7 @@ gst_nvdec_subclass_register (GstPlugin * plugin, GType type,
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
GstNvDecClassData *cdata;
|
GstNvDecClassData *cdata;
|
||||||
gboolean is_default = TRUE;
|
gboolean is_default = TRUE;
|
||||||
|
gint index = 0;
|
||||||
|
|
||||||
cdata = g_new0 (GstNvDecClassData, 1);
|
cdata = g_new0 (GstNvDecClassData, 1);
|
||||||
cdata->sink_caps = gst_caps_ref (sink_caps);
|
cdata->sink_caps = gst_caps_ref (sink_caps);
|
||||||
|
@ -2066,10 +2084,10 @@ gst_nvdec_subclass_register (GstPlugin * plugin, GType type,
|
||||||
type_info.class_data = cdata;
|
type_info.class_data = cdata;
|
||||||
|
|
||||||
type_name = g_strdup_printf ("nv%sdec", codec);
|
type_name = g_strdup_printf ("nv%sdec", codec);
|
||||||
|
while (g_type_from_name (type_name)) {
|
||||||
if (g_type_from_name (type_name) != 0) {
|
index++;
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
type_name = g_strdup_printf ("nv%sdevice%ddec", codec, device_id);
|
type_name = g_strdup_printf ("nv%sdevice%ddec", codec, index);
|
||||||
is_default = FALSE;
|
is_default = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue