[cheese/three-point-oh] Fixed awkward lag when using Effects Selector



commit 1ba4c2b1cf80b52bdde5564853855fadf589578f
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Wed Jun 30 02:04:15 2010 +0530

    Fixed awkward lag when using Effects Selector

 libcheese/cheese-camera.c  |   11 ++++++++++-
 valasrc/cheese-window.vala |   13 ++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index d5186f8..8a8a598 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -827,13 +827,22 @@ cheese_camera_connect_effect_texture (CheeseCamera *camera, CheeseEffect *effect
   GstElement *display_element;
   GstElement *display_queue;
   gboolean ok;
+  gboolean is_playing;
+
+  is_playing = priv->pipeline_is_playing;
+  
+  cheese_camera_stop (camera);
 
   display_queue = gst_element_factory_make ("queue", NULL);
   effect_filter = cheese_camera_element_from_effect (camera, effect);
   display_element = clutter_gst_video_sink_new (texture);
   
   gst_bin_add_many (GST_BIN (priv->pipeline), effect_filter, display_queue, display_element, NULL);
-  ok = gst_element_link_many (priv->camera_tee, effect_filter, display_queue, display_element, NULL);  
+  ok = gst_element_link_many (priv->camera_tee, effect_filter, display_queue, display_element, NULL);
+
+  if (is_playing)
+    cheese_camera_play (camera);
+  
 }
 
 
diff --git a/valasrc/cheese-window.vala b/valasrc/cheese-window.vala
index 910a971..1cebfc2 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -423,26 +423,18 @@ public class Cheese.MainWindow : Gtk.Window
   internal void on_selected_effect_change(Mx.Button button)
   {	  
 	  selected_effect = button.get_data("effect");
-	  effects_toggle_action.set_active(false);
-	  camera.stop();
 	  camera.set_effect(selected_effect);
-	  camera.play();
+	  effects_toggle_action.set_active(false);
   }
   
   private void teardown_effects_selector()
   {
-	  camera.stop();
-	  viewport_layout.remove((Clutter.Actor)effects_scroller);
-	  camera.play();
-	  effects_scroller = null;
-	  effects_grid = null;
 	  video_preview.show();
+	  viewport_layout.remove((Clutter.Actor)effects_scroller);
   }
   
   private void setup_effects_selector()
   {
-	  camera.stop();
-
 	  video_preview.hide();
 	  
 	  effects_grid = new Mx.Grid();
@@ -480,7 +472,6 @@ public class Cheese.MainWindow : Gtk.Window
 	
 	  viewport_layout.add((Clutter.Actor)effects_scroller);
 	  this.effects_scroller.set_size (viewport.width, viewport.height);
-	  camera.play();
   }
   
   public void setup_ui ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]