[cheese/three-point-oh] Reduced cpu usage by half. Reduced preview sizes as well.
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/three-point-oh] Reduced cpu usage by half. Reduced preview sizes as well.
- Date: Wed, 30 Jun 2010 09:22:54 +0000 (UTC)
commit 472c6d20514081f7cba12021d3f06ae005210331
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Wed Jun 30 14:52:04 2010 +0530
Reduced cpu usage by half. Reduced preview sizes as well.
libcheese/cheese-camera.c | 17 ++++++++++++++---
valasrc/cheese-window.vala | 10 +++++-----
2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 8a8a598..88fc8e7 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -822,23 +822,34 @@ void
cheese_camera_connect_effect_texture (CheeseCamera *camera, CheeseEffect *effect, ClutterTexture *texture)
{
CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
-
+
+ GstElement *downscaler;
GstElement *effect_filter;
GstElement *display_element;
GstElement *display_queue;
gboolean ok;
gboolean is_playing;
+ GError *err = NULL;
is_playing = priv->pipeline_is_playing;
cheese_camera_stop (camera);
display_queue = gst_element_factory_make ("queue", NULL);
+ downscaler = gst_parse_bin_from_description ("videoscale ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace", TRUE, &err);
effect_filter = cheese_camera_element_from_effect (camera, effect);
display_element = clutter_gst_video_sink_new (texture);
+
+ if (!downscaler || (err != NULL))
+ {
+ g_error_free (err);
+ g_error ("ERROR downscaling");
+ }
+
+ g_object_set_property (G_OBJECT (downscaler), "method", 0);
- 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);
+ gst_bin_add_many (GST_BIN (priv->pipeline), downscaler, effect_filter, display_queue, display_element, NULL);
+ ok = gst_element_link_many (priv->camera_tee, downscaler, 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 1cebfc2..8e0c273 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -446,9 +446,9 @@ public class Cheese.MainWindow : Gtk.Window
effects_grid.child_x_align = Mx.Align.MIDDLE;
effects_grid.child_y_align = Mx.Align.MIDDLE;
effects_grid.orientation = Mx.Orientation.VERTICAL;
- effects_grid.max_stride = 2;
- effects_grid.column_spacing = 50;
- effects_grid.row_spacing = 50;
+// effects_grid.max_stride = 2;
+ effects_grid.column_spacing = 20;
+ effects_grid.row_spacing = 20;
effects_manager = new EffectsManager();
effects_manager.load_effects();
@@ -458,8 +458,8 @@ public class Cheese.MainWindow : Gtk.Window
foreach (Effect effect in effects_manager.effects)
{
Clutter.Texture texture = new Clutter.Texture();
- texture.width = 480;
- texture.height = 360;
+ texture.width = 160;
+ texture.height = 120;
Mx.Button button = new Mx.Button();
button.add((Clutter.Actor)texture);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]