|
|
9ac2ee |
From 1ef6977002ef18631f81646f198ef6a667ef8f73 Mon Sep 17 00:00:00 2001
|
|
|
9ac2ee |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ac2ee |
Date: Fri, 8 Jun 2012 11:41:17 +0200
|
|
|
9ac2ee |
Subject: [PATCH 3/4] camerabin: Add
|
|
|
9ac2ee |
gst_camerabin_get_video_source_properties() helper
|
|
|
9ac2ee |
function
|
|
|
9ac2ee |
|
|
|
9ac2ee |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ac2ee |
---
|
|
|
9ac2ee |
gst/camerabin/gstcamerabin.c | 31 +++++++++++++++++++++++++------
|
|
|
9ac2ee |
1 file changed, 25 insertions(+), 6 deletions(-)
|
|
|
9ac2ee |
|
|
|
9ac2ee |
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
|
|
|
9ac2ee |
index 3f87ff9..a36d5b5 100644
|
|
|
9ac2ee |
--- a/gst/camerabin/gstcamerabin.c
|
|
|
9ac2ee |
+++ b/gst/camerabin/gstcamerabin.c
|
|
|
9ac2ee |
@@ -347,6 +347,7 @@ static void gst_camerabin_scene_mode_notify_cb (GObject * video_source,
|
|
|
9ac2ee |
GParamSpec * pspec, gpointer user_data);
|
|
|
9ac2ee |
static void gst_camerabin_zoom_notify_cb (GObject * video_source,
|
|
|
9ac2ee |
GParamSpec * pspec, gpointer user_data);
|
|
|
9ac2ee |
+static void gst_camerabin_get_video_source_properties (GstCameraBin * camera);
|
|
|
9ac2ee |
static void gst_camerabin_monitor_video_source_properties (GstCameraBin *
|
|
|
9ac2ee |
camera);
|
|
|
9ac2ee |
static void gst_camerabin_configure_format (GstCameraBin * camera,
|
|
|
9ac2ee |
@@ -528,6 +529,8 @@ static GstCaps *camerabin_create_view_finder_caps (GstCameraBin * camera)
|
|
|
9ac2ee |
"height", G_TYPE_INT, camera->app_height, NULL);
|
|
|
9ac2ee |
}
|
|
|
9ac2ee |
|
|
|
9ac2ee |
+ gst_camerabin_get_video_source_properties (camera);
|
|
|
9ac2ee |
+
|
|
|
9ac2ee |
if (!camera->night_mode && camera->app_fps_n > 0 && camera->app_fps_d > 0) {
|
|
|
9ac2ee |
gst_structure_set (st,
|
|
|
9ac2ee |
"framerate", GST_TYPE_FRACTION, camera->app_fps_n,
|
|
|
9ac2ee |
@@ -559,8 +562,6 @@ camerabin_setup_src_elements (GstCameraBin * camera)
|
|
|
9ac2ee |
/* clear video update status */
|
|
|
9ac2ee |
camera->video_capture_caps_update = FALSE;
|
|
|
9ac2ee |
|
|
|
9ac2ee |
- gst_camerabin_monitor_video_source_properties (camera);
|
|
|
9ac2ee |
-
|
|
|
9ac2ee |
new_caps = camerabin_create_view_finder_caps (camera);
|
|
|
9ac2ee |
|
|
|
9ac2ee |
if (camera->night_mode || camera->app_fps_n <= 0 || camera->app_fps_d <= 0) {
|
|
|
9ac2ee |
@@ -574,6 +575,8 @@ camerabin_setup_src_elements (GstCameraBin * camera)
|
|
|
9ac2ee |
gst_camerabin_set_allowed_framerate (camera, new_caps);
|
|
|
9ac2ee |
}
|
|
|
9ac2ee |
|
|
|
9ac2ee |
+ gst_camerabin_monitor_video_source_properties (camera);
|
|
|
9ac2ee |
+
|
|
|
9ac2ee |
/* Set default zoom method */
|
|
|
9ac2ee |
if (camera->src_zoom_scale) {
|
|
|
9ac2ee |
g_object_set (camera->src_zoom_scale, "method",
|
|
|
9ac2ee |
@@ -2660,6 +2663,26 @@ gst_camerabin_zoom_notify_cb (GObject * video_source, GParamSpec * pspec,
|
|
|
9ac2ee |
}
|
|
|
9ac2ee |
|
|
|
9ac2ee |
/*
|
|
|
9ac2ee |
+ * gst_camerabin_monitor_get_video_source_properties:
|
|
|
9ac2ee |
+ * @camera: camerabin object
|
|
|
9ac2ee |
+ *
|
|
|
9ac2ee |
+ * Get properties from video source photography interface property scene mode.
|
|
|
9ac2ee |
+ *
|
|
|
9ac2ee |
+ */
|
|
|
9ac2ee |
+static void
|
|
|
9ac2ee |
+gst_camerabin_get_video_source_properties (GstCameraBin * camera)
|
|
|
9ac2ee |
+{
|
|
|
9ac2ee |
+ if (GST_IS_ELEMENT (camera->src_vid_src) &&
|
|
|
9ac2ee |
+ gst_element_implements_interface (camera->src_vid_src,
|
|
|
9ac2ee |
+ GST_TYPE_PHOTOGRAPHY)) {
|
|
|
9ac2ee |
+ gint scene_mode;
|
|
|
9ac2ee |
+ g_object_get (G_OBJECT (camera->src_vid_src), "scene-mode", &scene_mode,
|
|
|
9ac2ee |
+ NULL);
|
|
|
9ac2ee |
+ camera->night_mode = scene_mode == GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
|
|
|
9ac2ee |
+ }
|
|
|
9ac2ee |
+}
|
|
|
9ac2ee |
+
|
|
|
9ac2ee |
+/*
|
|
|
9ac2ee |
* gst_camerabin_monitor_video_source_properties:
|
|
|
9ac2ee |
* @camera: camerabin object
|
|
|
9ac2ee |
*
|
|
|
9ac2ee |
@@ -2674,15 +2697,11 @@ gst_camerabin_monitor_video_source_properties (GstCameraBin * camera)
|
|
|
9ac2ee |
if (GST_IS_ELEMENT (camera->src_vid_src) &&
|
|
|
9ac2ee |
gst_element_implements_interface (camera->src_vid_src,
|
|
|
9ac2ee |
GST_TYPE_PHOTOGRAPHY)) {
|
|
|
9ac2ee |
- gint scene_mode;
|
|
|
9ac2ee |
GST_DEBUG_OBJECT (camera,
|
|
|
9ac2ee |
"connecting to %" GST_PTR_FORMAT " - notify::scene-mode",
|
|
|
9ac2ee |
camera->src_vid_src);
|
|
|
9ac2ee |
g_signal_connect (G_OBJECT (camera->src_vid_src), "notify::scene-mode",
|
|
|
9ac2ee |
(GCallback) gst_camerabin_scene_mode_notify_cb, camera);
|
|
|
9ac2ee |
- g_object_get (G_OBJECT (camera->src_vid_src), "scene-mode", &scene_mode,
|
|
|
9ac2ee |
- NULL);
|
|
|
9ac2ee |
- camera->night_mode = scene_mode == GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
|
|
|
9ac2ee |
|
|
|
9ac2ee |
GST_DEBUG_OBJECT (camera,
|
|
|
9ac2ee |
"connecting to %" GST_PTR_FORMAT " - notify::zoom",
|
|
|
9ac2ee |
--
|
|
|
9ac2ee |
1.7.10.2
|
|
|
9ac2ee |
|