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