camerabin: code cleanups
authorStefan Kost <ensonic@users.sf.net>
Thu, 15 Oct 2009 14:17:41 +0000 (17:17 +0300)
committerStefan Kost <ensonic@users.sf.net>
Sat, 24 Oct 2009 12:14:26 +0000 (15:14 +0300)
Align element initialisation. This should be re-thought, g_object_new zeros things already.
Harmonize the element getters for the src/sinks to return what we actualy use.

gst/camerabin/gstcamerabin.c

index 8890026d3d8e33edcc0a5d10f5dac1fce2f76125..395f8a64db89035bbc896a1515dd7f4169c9e85a 100644 (file)
@@ -840,17 +840,19 @@ camerabin_destroy_elements (GstCameraBin * camera)
     camera->pad_src_queue = NULL;
   }
 
-  camera->view_sink = NULL;
-  camera->aspect_filter = NULL;
-  camera->view_scale = NULL;
+  /* view finder elements */
   camera->view_in_sel = NULL;
+  camera->view_scale = NULL;
+  camera->aspect_filter = NULL;
+  camera->view_sink = NULL;
 
-  camera->src_out_sel = NULL;
+  /* source elements */
+  camera->src_vid_src = NULL;
   camera->src_filter = NULL;
   camera->src_zoom_crop = NULL;
   camera->src_zoom_scale = NULL;
   camera->src_zoom_filter = NULL;
-  camera->src_vid_src = NULL;
+  camera->src_out_sel = NULL;
 
   camera->active_bin = NULL;
 
@@ -2737,16 +2739,6 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass)
 
   camera->video_preview_buffer = NULL;
 
-  /* source elements */
-  camera->src_vid_src = NULL;
-  camera->src_filter = NULL;
-  camera->src_zoom_crop = NULL;
-  camera->src_zoom_scale = NULL;
-  camera->src_zoom_filter = NULL;
-  camera->src_out_sel = NULL;
-
-  camera->user_vf_sink = NULL;
-
   /* image capture bin */
   camera->imgbin = g_object_new (GST_TYPE_CAMERABIN_IMAGE, NULL);
   gst_object_ref (camera->imgbin);
@@ -2755,14 +2747,26 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass)
   camera->vidbin = g_object_new (GST_TYPE_CAMERABIN_VIDEO, NULL);
   gst_object_ref (camera->vidbin);
 
-  camera->active_bin = NULL;
-
   /* view finder elements */
   camera->view_in_sel = NULL;
   camera->view_scale = NULL;
   camera->aspect_filter = NULL;
   camera->view_sink = NULL;
 
+  camera->user_vf_sink = NULL;
+
+  /* source elements */
+  camera->src_vid_src = NULL;
+  camera->src_filter = NULL;
+  camera->src_zoom_crop = NULL;
+  camera->src_zoom_scale = NULL;
+  camera->src_zoom_filter = NULL;
+  camera->src_out_sel = NULL;
+
+  camera->user_vid_src = NULL;
+
+  camera->active_bin = NULL;
+
   memset (&camera->photo_settings, 0, sizeof (GstPhotoSettings));
 }
 
@@ -3002,10 +3006,16 @@ gst_camerabin_get_property (GObject * object, guint prop_id,
           gst_camerabin_video_get_muxer (GST_CAMERABIN_VIDEO (camera->vidbin)));
       break;
     case ARG_VF_SINK:
-      g_value_set_object (value, camera->user_vf_sink);
+      if (camera->view_sink)
+        g_value_set_object (value, camera->view_sink);
+      else
+        g_value_set_object (value, camera->user_vf_sink);
       break;
     case ARG_VIDEO_SRC:
-      g_value_set_object (value, camera->src_vid_src);
+      if (camera->src_vid_src)
+        g_value_set_object (value, camera->src_vid_src);
+      else
+        g_value_set_object (value, camera->user_vid_src);
       break;
     case ARG_AUDIO_SRC:
       g_value_set_object (value,