[cheese] Set all valves open on play
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Set all valves open on play
- Date: Mon, 24 Jun 2013 20:43:09 +0000 (UTC)
commit 412db29f799dbd4a8a3898a5a975046ae2fcf1a7
Author: Hans de Goede <hdegoede redhat com>
Date: Mon Jun 17 21:00:45 2013 +0200
Set all valves open on play
If some valves are closed on play, GStreamer will wait for the valves to
open before moving from paused to playing, and a frozen image is shown.
This does not happen on startup since on startup all valves are open,
nor does it happen when changing video-format directly after startup,
since all valves will still be open. As soon as
cheese_camera_toggle_effects_pipeline() has been called once, any
subsequent attempt to change the video format (and thus stopping and
re-starting the pipeline) will result in a frozen image.
This patch fixes this by opening all valves on play, and calling
cheese_camera_toggle_effects_pipeline() with the last active value after
the pipeline transitions to the playing state.
This has the added advantage that unlike before the effects valve will
be closed on startup, rather then staying open till the first call to
cheese_camera_toggle_effects_pipeline().
Signed-off-by: Hans de Goede <hdegoede redhat com>
libcheese/cheese-camera.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 4597294..a103ba3 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -84,6 +84,7 @@ struct _CheeseCameraPrivate
gboolean is_recording;
gboolean pipeline_is_playing;
+ gboolean effect_pipeline_is_playing;
gchar *photo_filename;
guint num_camera_devices;
@@ -231,7 +232,11 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca
GstState old, new;
gst_message_parse_state_changed (message, &old, &new, NULL);
if (new == GST_STATE_PLAYING)
+ {
g_signal_emit (camera, camera_signals[STATE_FLAGS_CHANGED], 0, new);
+ cheese_camera_toggle_effects_pipeline (camera,
+ priv->effect_pipeline_is_playing);
+ }
}
break;
}
@@ -784,6 +789,8 @@ cheese_camera_play (CheeseCamera *camera)
CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
cheese_camera_set_new_caps (camera);
g_object_set (priv->camera_source, "video-source", priv->video_source, NULL);
+ g_object_set (priv->main_valve, "drop", FALSE, NULL);
+ g_object_set (priv->effects_valve, "drop", FALSE, NULL);
gst_element_set_state (priv->camerabin, GST_STATE_PLAYING);
priv->pipeline_is_playing = TRUE;
}
@@ -969,6 +976,7 @@ cheese_camera_toggle_effects_pipeline (CheeseCamera *camera, gboolean active)
g_object_set (G_OBJECT (priv->effects_valve), "drop", TRUE, NULL);
g_object_set (G_OBJECT (priv->main_valve), "drop", FALSE, NULL);
}
+ priv->effect_pipeline_is_playing = active;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]