Blame SOURCES/0003-camerabin-Add-gst_camerabin_get_video_source_propert.patch

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