Commit 364fb931 authored by Laura Lucas Alday's avatar Laura Lucas Alday Committed by Luciana Fujii Pontello

svg overlay effects can now be added

parent 467ec12c
......@@ -624,16 +624,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);
......@@ -642,6 +645,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;
}
......
......@@ -1081,6 +1081,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);
}
}
......@@ -1232,7 +1236,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)
......@@ -1258,10 +1261,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment