libs: display: initialize value if they are not yet

This is a difference between the GObject API and the GstVaapi one: the
GValue passed to get a property value, in GObject has to be
initialized with g_value_init(), but in GstVaapi is has not.

In order to overcome this mismatch, this patch call g_value_init()
internally only in the passed one is not already initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=788058
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-09-22 18:59:49 +02:00
parent 6b35e00a28
commit b23ccc69b0

View file

@ -1002,14 +1002,16 @@ _get_property (GstVaapiDisplay * display, const GstVaapiProperty * prop,
GstVaapiRenderMode mode;
if (!gst_vaapi_display_get_render_mode (display, &mode))
return FALSE;
g_value_init (value, GST_VAAPI_TYPE_RENDER_MODE);
if (!G_IS_VALUE (value))
g_value_init (value, GST_VAAPI_TYPE_RENDER_MODE);
g_value_set_enum (value, mode);
break;
}
case VADisplayAttribRotation:{
GstVaapiRotation rotation;
rotation = gst_vaapi_display_get_rotation (display);
g_value_init (value, GST_VAAPI_TYPE_ROTATION);
if (!G_IS_VALUE (value))
g_value_init (value, GST_VAAPI_TYPE_ROTATION);
g_value_set_enum (value, rotation);
break;
}
@ -1020,7 +1022,8 @@ _get_property (GstVaapiDisplay * display, const GstVaapiProperty * prop,
gfloat val;
if (!get_color_balance (display, find_property_id (prop->name), &val))
return FALSE;
g_value_init (value, G_TYPE_FLOAT);
if (!G_IS_VALUE (value))
g_value_init (value, G_TYPE_FLOAT);
g_value_set_float (value, val);
break;
}