[cheese/wip/hans-fixes: 17/35] cheese-camera: Do not add videoconvert elements around the "no effect" effect



commit 56bb589166f3fb3ec19bcc8637b010bf850dc6b5
Author: Hans de Goede <hdegoede redhat com>
Date:   Tue Jun 11 09:05:51 2013 +0200

    cheese-camera: Do not add videoconvert elements around the "no effect" effect
    
    The "no effect" effect is our default value, and thus worth optimizing a bit
    for. Clearly in the "no effect" effect case adding a videoconvert element both
    before and after the element is not needed.
    
    Note we also don't add the videoconvert elements when creating the initial
    pipeline, so this also keeps the way the pipeline looks initially and when
    "no-effect" is selected consistent.
    
    When starting cheese with "no-effect" selected, this shaves of another 130ms
    of the initial pipeline creation time, for a total improvement for this patch
    set from aprox 1.1 sec to aprox 220 ms.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 libcheese/cheese-camera.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index eafc381..7b7fac5 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -888,12 +888,20 @@ void
 cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect)
 {
   GstElement *effect_filter;
+  gchar      *effect_desc;
 
   g_return_if_fail (CHEESE_IS_CAMERA (camera));
 
-  effect_filter = cheese_camera_element_from_effect (camera, effect);
+  g_object_get (G_OBJECT (effect), "pipeline-desc", &effect_desc, NULL);
+
+  if (strcmp(effect_desc, "identity") == 0)
+    effect_filter = gst_element_factory_make ("identity", "effect");
+  else
+    effect_filter = cheese_camera_element_from_effect (camera, effect);
   if (effect_filter != NULL)
     cheese_camera_change_effect_filter (camera, effect_filter);
+
+  g_free (effect_desc);
 }
 
 /**


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