From d49dbefd6c49193073c6334fd493f6899bf237d2 Mon Sep 17 00:00:00 2001 From: Mohammed Hassan Date: Fri, 6 Mar 2015 14:49:20 +0200 Subject: [PATCH] camerabin: update zoom param spec if video source changes its max-zoom If the video source happens to allow max-zoom to be greater than our maximum hard coded value of 10 then the user cannot set anything greater than our maximum specified in the param spec. We have to update our param spec to prevent glib from capping the value https://bugzilla.gnome.org/show_bug.cgi?id=745740 --- gst/camerabin2/gstcamerabin2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index e4926446f2..5e8681f510 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -1338,10 +1338,18 @@ static void gst_camera_bin_src_notify_max_zoom_cb (GObject * self, GParamSpec * pspec, gpointer user_data) { + GParamSpecFloat *zoom_pspec; GstCameraBin2 *camera = (GstCameraBin2 *) user_data; g_object_get (self, "max-zoom", &camera->max_zoom, NULL); GST_DEBUG_OBJECT (camera, "Max zoom updated to %f", camera->max_zoom); + + /* update zoom pspec */ + zoom_pspec = + G_PARAM_SPEC_FLOAT (g_object_class_find_property (G_OBJECT_GET_CLASS + (G_OBJECT (camera)), "zoom")); + zoom_pspec->maximum = camera->max_zoom; + g_object_notify (G_OBJECT (camera), "max-zoom"); }