summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-01-09 12:47:28 +0100
committerWim Taymans <wim.taymans@gmail.com>2011-01-09 12:47:28 +0100
commit0e0bc0a55eda4c4cc5b6d12ff8aa36775dbb6a76 (patch)
treeb226f555a2ae6d919261c564147182ac1ee6a293
parent562f70dfacf20aa0873f240f1c7968347d5ab9c6 (diff)
video-texture: factor out start and stop buffering
Put the logic to start and stop buffering in separate functions to prepare for different buffering methods.
-rw-r--r--clutter-gst/clutter-gst-video-texture.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c
index 1864722..b4a58b2 100644
--- a/clutter-gst/clutter-gst-video-texture.c
+++ b/clutter-gst/clutter-gst-video-texture.c
@@ -1180,6 +1180,34 @@ bus_message_eos_cb (GstBus *bus,
}
static void
+start_buffering (ClutterGstVideoTexture *video_texture)
+{
+ ClutterGstVideoTexturePrivate *priv = video_texture->priv;
+
+ priv->is_buffering = TRUE;
+
+ if (!priv->is_live)
+ {
+ /* keep pipeline paused */
+ gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ }
+}
+
+static void
+stop_buffering (ClutterGstVideoTexture *video_texture)
+{
+ ClutterGstVideoTexturePrivate *priv = video_texture->priv;
+
+ priv->is_buffering = FALSE;
+
+ if (!priv->is_live)
+ {
+ /* continue pipeline target state */
+ gst_element_set_state (priv->pipeline, priv->target_state);
+ }
+}
+
+static void
bus_message_buffering_cb (GstBus *bus,
GstMessage *message,
ClutterGstVideoTexture *video_texture)
@@ -1197,36 +1225,18 @@ bus_message_buffering_cb (GstBus *bus,
g_object_notify (G_OBJECT (video_texture), "buffer-fill");
- g_print ("buffering %d\r", buffer_percent);
-
if (buffer_percent == 100)
{
if (priv->is_buffering)
{
- /* buffering done */
- priv->is_buffering = FALSE;
-
- if (!priv->is_live)
- {
- /* continue pipeline target state */
- g_print ("\nplay\n");
- gst_element_set_state (priv->pipeline, priv->target_state);
- }
+ stop_buffering (video_texture);
}
}
else
{
if (!priv->is_buffering)
{
- /* buffering started */
- priv->is_buffering = TRUE;
-
- if (!priv->is_live)
- {
- /* keep pipeline paused */
- g_print ("\npause\n");
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
- }
+ start_buffering (video_texture);
}
}
}