mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
camerabin2: Check zoom notify callback from camera-source
Camerabin2 has a zoom property that is simply proxied to its internal camera-source element. This patch makes camerabin2 listen to 'notify' signals from it so it can update its zoom property value when camera-source changes its zoom as a side-effect of another operation or because the user set the zoom directly to it, instead of doing it from camerabin2.
This commit is contained in:
parent
f33b78abd1
commit
00e635e786
1 changed files with 13 additions and 0 deletions
|
@ -1152,6 +1152,17 @@ gst_camera_bin_src_notify_max_zoom_cb (GObject * self, GParamSpec * pspec,
|
||||||
g_object_notify (G_OBJECT (camera), "max-zoom");
|
g_object_notify (G_OBJECT (camera), "max-zoom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_camera_bin_src_notify_zoom_cb (GObject * self, GParamSpec * pspec,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GstCameraBin2 *camera = (GstCameraBin2 *) user_data;
|
||||||
|
|
||||||
|
g_object_get (self, "zoom", &camera->zoom, NULL);
|
||||||
|
GST_DEBUG_OBJECT (camera, "Zoom updated to %f", camera->zoom);
|
||||||
|
g_object_notify (G_OBJECT (camera), "zoom");
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstBuffer * buf,
|
gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstBuffer * buf,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -1495,6 +1506,8 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
||||||
"preview-caps", camera->preview_caps, "preview-filter",
|
"preview-caps", camera->preview_caps, "preview-filter",
|
||||||
camera->preview_filter, NULL);
|
camera->preview_filter, NULL);
|
||||||
}
|
}
|
||||||
|
g_signal_connect (G_OBJECT (camera->src), "notify::zoom",
|
||||||
|
(GCallback) gst_camera_bin_src_notify_zoom_cb, camera);
|
||||||
g_object_set (camera->src, "zoom", camera->zoom, NULL);
|
g_object_set (camera->src, "zoom", camera->zoom, NULL);
|
||||||
g_signal_connect (G_OBJECT (camera->src), "notify::max-zoom",
|
g_signal_connect (G_OBJECT (camera->src), "notify::max-zoom",
|
||||||
(GCallback) gst_camera_bin_src_notify_max_zoom_cb, camera);
|
(GCallback) gst_camera_bin_src_notify_max_zoom_cb, camera);
|
||||||
|
|
Loading…
Reference in a new issue