mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
va: Return default device from device-path property getter
Otherwise application would not be able to know matching element for wanted device. Typical use case of the read-only device path (DXGI Adapter LUID, CUDA device index, etc) property is that application enumerates physical devices and then selects matching GStreamer element (in null state) via device path property. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4220>
This commit is contained in:
parent
47b8618b2d
commit
3bbfab1cf3
4 changed files with 32 additions and 20 deletions
|
@ -34,14 +34,17 @@ gst_va_base_dec_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVaBaseDec *self = GST_VA_BASE_DEC (object);
|
||||
GstVaBaseDecClass *klass = GST_VA_BASE_DEC_GET_CLASS (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case GST_VA_DEC_PROP_DEVICE_PATH:{
|
||||
if (!(self->display && GST_IS_VA_DISPLAY_PLATFORM (self->display))) {
|
||||
g_value_set_string (value, NULL);
|
||||
return;
|
||||
}
|
||||
if (!self->display)
|
||||
g_value_set_string (value, klass->render_device_path);
|
||||
else if (GST_IS_VA_DISPLAY_PLATFORM (self->display))
|
||||
g_object_get_property (G_OBJECT (self->display), "path", value);
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -748,7 +751,7 @@ gst_va_base_dec_class_init (GstVaBaseDecClass * klass, GstVaCodecs codec,
|
|||
|
||||
g_object_class_install_property (object_class, GST_VA_DEC_PROP_DEVICE_PATH,
|
||||
g_param_spec_string ("device-path", "Device Path",
|
||||
GST_VA_DEVICE_PATH_PROP_DESC, NULL,
|
||||
GST_VA_DEVICE_PATH_PROP_DESC, NULL, GST_PARAM_DOC_SHOW_DEFAULT |
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
|
|
|
@ -849,14 +849,17 @@ gst_va_base_enc_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVaBaseEnc *base = GST_VA_BASE_ENC (object);
|
||||
GstVaBaseEncClass *klass = GST_VA_BASE_ENC_GET_CLASS (base);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE_PATH:{
|
||||
if (!(base->display && GST_IS_VA_DISPLAY_PLATFORM (base->display))) {
|
||||
g_value_set_string (value, NULL);
|
||||
return;
|
||||
}
|
||||
if (!base->display)
|
||||
g_value_set_string (value, klass->render_device_path);
|
||||
else if (GST_IS_VA_DISPLAY_PLATFORM (base->display))
|
||||
g_object_get_property (G_OBJECT (base->display), "path", value);
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -919,7 +922,7 @@ gst_va_base_enc_class_init (GstVaBaseEncClass * klass)
|
|||
*/
|
||||
properties[PROP_DEVICE_PATH] = g_param_spec_string ("device-path",
|
||||
"Device Path", GST_VA_DEVICE_PATH_PROP_DESC, NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
GST_PARAM_DOC_SHOW_DEFAULT | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPERTIES, properties);
|
||||
|
||||
|
|
|
@ -74,14 +74,17 @@ gst_va_base_transform_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVaBaseTransform *self = GST_VA_BASE_TRANSFORM (object);
|
||||
GstVaBaseTransformClass *klass = GST_VA_BASE_TRANSFORM_GET_CLASS (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE_PATH:{
|
||||
if (!(self->display && GST_IS_VA_DISPLAY_PLATFORM (self->display))) {
|
||||
g_value_set_string (value, NULL);
|
||||
return;
|
||||
}
|
||||
if (!self->display)
|
||||
g_value_set_string (value, klass->render_device_path);
|
||||
else if (GST_IS_VA_DISPLAY_PLATFORM (self->display))
|
||||
g_object_get_property (G_OBJECT (self->display), "path", value);
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -649,7 +652,7 @@ gst_va_base_transform_class_init (GstVaBaseTransformClass * klass)
|
|||
*/
|
||||
properties[PROP_DEVICE_PATH] = g_param_spec_string ("device-path",
|
||||
"Device Path", GST_VA_DEVICE_PATH_PROP_DESC, NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
GST_PARAM_DOC_SHOW_DEFAULT | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPERTIES, properties);
|
||||
|
||||
|
|
|
@ -288,15 +288,18 @@ gst_va_compositor_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVaCompositor *self = GST_VA_COMPOSITOR (object);
|
||||
GstVaCompositorClass *klass = GST_VA_COMPOSITOR_GET_CLASS (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE_PATH:
|
||||
{
|
||||
if (!(self->display && GST_IS_VA_DISPLAY_PLATFORM (self->display))) {
|
||||
g_value_set_string (value, NULL);
|
||||
return;
|
||||
}
|
||||
if (!self->display)
|
||||
g_value_set_string (value, klass->render_device_path);
|
||||
else if (GST_IS_VA_DISPLAY_PLATFORM (self->display))
|
||||
g_object_get_property (G_OBJECT (self->display), "path", value);
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case PROP_SCALE_METHOD:
|
||||
|
@ -1408,7 +1411,7 @@ gst_va_compositor_class_init (gpointer g_class, gpointer class_data)
|
|||
*/
|
||||
properties[PROP_DEVICE_PATH] = g_param_spec_string ("device-path",
|
||||
"Device Path", GST_VA_DEVICE_PATH_PROP_DESC, NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
GST_PARAM_DOC_SHOW_DEFAULT | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GstVaCompositor:scale-method:
|
||||
|
|
Loading…
Reference in a new issue