[cheese/wip/hans-fixes: 18/35] cheese-camera: Check for the current effect being the same as the one set
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/wip/hans-fixes: 18/35] cheese-camera: Check for the current effect being the same as the one set
- Date: Fri, 14 Jun 2013 22:25:12 +0000 (UTC)
commit 4a8ef99d731e95f450d3f17d53ebfc829c94fb7c
Author: Hans de Goede <hdegoede redhat com>
Date: Tue Jun 11 09:35:14 2013 +0200
cheese-camera: Check for the current effect being the same as the one set
And if so, turn the cheese_camera_set_effect call into a nop.
Signed-off-by: Hans de Goede <hdegoede redhat com>
libcheese/cheese-camera.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 7b7fac5..9cfaf7e 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -80,6 +80,7 @@ struct _CheeseCameraPrivate
GstElement *video_balance;
GstElement *camera_tee, *effects_tee;
GstElement *main_valve, *effects_valve;
+ gchar *current_effect_desc;
gboolean is_recording;
gboolean pipeline_is_playing;
@@ -587,6 +588,7 @@ cheese_camera_create_video_filter_bin (CheeseCamera *camera, GError **error)
cheese_camera_set_error_element_not_found (error, "identity");
return FALSE;
}
+ priv->current_effect_desc = g_strdup("identity");
if ((priv->video_balance = gst_element_factory_make ("videobalance", "video_balance")) == NULL)
{
cheese_camera_set_error_element_not_found (error, "videobalance");
@@ -887,19 +889,36 @@ cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
void
cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect)
{
+ CheeseCameraPrivate *priv;
GstElement *effect_filter;
gchar *effect_desc;
g_return_if_fail (CHEESE_IS_CAMERA (camera));
+ priv = camera->priv;
+
g_object_get (G_OBJECT (effect), "pipeline-desc", &effect_desc, NULL);
+ if (strcmp(priv->current_effect_desc, effect_desc) == 0)
+ {
+ GST_INFO_OBJECT (camera, "Effect is: \"%s\", not updating", effect_desc);
+ g_free (effect_desc);
+ return;
+ }
+
+ GST_INFO_OBJECT (camera, "Changing effect to: \"%s\"", effect_desc);
+
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 (priv->current_effect_desc);
+ priv->current_effect_desc = effect_desc;
+ return;
+ }
g_free (effect_desc);
}
@@ -1202,6 +1221,7 @@ cheese_camera_finalize (GObject *object)
if (priv->photo_filename)
g_free (priv->photo_filename);
+ g_free (priv->current_effect_desc);
g_free (priv->device_node);
g_boxed_free (CHEESE_TYPE_VIDEO_FORMAT, priv->current_format);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]