camerabin: mode can be only image or video
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Tue, 28 Dec 2010 20:16:05 +0000 (17:16 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>
Tue, 28 Dec 2010 20:16:05 +0000 (17:16 -0300)
No need to check if camerabin is on video mode if it isn't on
image mode as those are the only 2 modes available.

Additionally, if mode gets corrupted somehow and would be neither
image or video it would cause a null pointer dereferencing some
lines of code below, so this is safer.

gst/camerabin/gstcamerabin.c

index f759923169039a04f190d2136ce7ab55cce82091..e7f13dae8f7762de244cf9cd5f5d8d2860723150 100644 (file)
@@ -3520,7 +3520,7 @@ gst_camerabin_set_property (GObject * object, guint prop_id,
         prev_pipe = &camera->preview_pipeline;
         preview_source_filter = &camera->app_preview_source_filter;
         prev_caps = &camera->preview_caps;
-      } else if (camera->mode == MODE_VIDEO) {
+      } else {                  /* MODE VIDEO */
         prev_pipe = &camera->video_preview_pipeline;
         preview_source_filter = &camera->app_video_preview_source_filter;
         prev_caps = &camera->video_preview_caps;
@@ -3562,7 +3562,7 @@ gst_camerabin_set_property (GObject * object, guint prop_id,
           preview_pipe = &camera->preview_pipeline;
           preview_source_filter = &camera->app_preview_source_filter;
           preview_caps = camera->preview_caps;
-        } else if (camera->mode == MODE_VIDEO) {
+        } else {                /* MODE VIDEO */
           preview_pipe = &camera->video_preview_pipeline;
           preview_source_filter = &camera->app_video_preview_source_filter;
           preview_caps = camera->video_preview_caps;