[cheese/camerabin] svg overlay effects can now be added
- From: Laura Lucas Alday <lauralucas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/camerabin] svg overlay effects can now be added
- Date: Tue, 25 Jan 2011 22:30:52 +0000 (UTC)
commit 4422a419236a553c542f19df6d72d9e161d76040
Author: Laura Lucas Alday <lauralucasalday gmail com>
Date: Tue Jan 25 19:06:20 2011 -0300
svg overlay effects can now be added
libcheese/cheese-camera.c | 21 ++++++++++++++++++---
src/cheese-window.vala | 9 ++++-----
2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 324483b..04cdc66 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -603,16 +603,19 @@ cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
GstElement *effect_filter;
GError *err = NULL;
char *effect_desc;
+ GstElement *colorspace1;
+ GstElement *colorspace2;
+ GstPad *pad;
g_object_get (G_OBJECT (effect),
"pipeline_desc", &effect_desc,
"name", &name, NULL);
- effects_pipeline_desc = g_strconcat ("ffmpegcolorspace ! ",
+ effects_pipeline_desc = g_strconcat ("ffmpegcolorspace name=colorspace1 ! ",
effect_desc,
- " ! ffmpegcolorspace",
+ " ! ffmpegcolorspace name=colorspace2",
NULL);
- effect_filter = gst_parse_bin_from_description (effects_pipeline_desc, TRUE, &err);
+ effect_filter = gst_parse_bin_from_description (effects_pipeline_desc, FALSE, &err);
if (!effect_filter || (err != NULL))
{
g_error_free (err);
@@ -621,6 +624,18 @@ cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
}
g_free (effects_pipeline_desc);
+ /* Add ghost pads to effect_filter bin */
+ colorspace1 = gst_bin_get_by_name (GST_BIN (effect_filter), "colorspace1");
+ colorspace2 = gst_bin_get_by_name (GST_BIN (effect_filter), "colorspace2");
+
+ pad = gst_element_get_static_pad (colorspace1, "sink");
+ gst_element_add_pad (effect_filter, gst_ghost_pad_new ("sink", pad));
+ gst_object_unref (GST_OBJECT (pad));
+
+ pad = gst_element_get_static_pad (colorspace2, "src");
+ gst_element_add_pad (effect_filter, gst_ghost_pad_new ("src", pad));
+ gst_object_unref (GST_OBJECT (pad));
+
return effect_filter;
}
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index abc9f69..d1b7f6a 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -1080,6 +1080,10 @@ public class Cheese.MainWindow : Gtk.Window
{
if (!is_camera_actions_sensitive)
toggle_camera_actions_sensitivities (true);
+
+ Effect effect = effects_manager.get_effect (settings.get_string ("selected-effect"));
+ if (effect != null)
+ camera.set_effect (effect);
}
}
@@ -1215,7 +1219,6 @@ public class Cheese.MainWindow : Gtk.Window
public void setup_camera (string ? uri)
{
string device;
- Effect effect;
double value;
if (uri != null && uri.length > 0)
@@ -1241,10 +1244,6 @@ public class Cheese.MainWindow : Gtk.Window
return;
}
- effect = effects_manager.get_effect (settings.get_string ("selected-effect"));
- if (effect != null)
- camera.set_effect (effect);
-
value = settings.get_double ("brightness");
if (value != 0.0)
camera.set_balance_property ("brightness", value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]