From b23ccc69b035dc4d79b7411570debfe538928745 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 22 Sep 2017 18:59:49 +0200 Subject: [PATCH] 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 --- gst-libs/gst/vaapi/gstvaapidisplay.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c index de31e01..1d34434 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay.c +++ b/gst-libs/gst/vaapi/gstvaapidisplay.c @@ -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; } -- 2.7.4