diff options
author | Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com> | 2011-03-29 10:00:53 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2011-03-29 10:00:53 +0100 |
commit | 2ecf993e146f0968a046f8fc9302c5fd9ee10be0 (patch) | |
tree | ea7eac656409c998a82f5d11e8bbf3bde700d551 /clutter-gst/clutter-gst-video-texture.c | |
parent | ee3c0d66cb7731d318375f5307fc46240f1f38f3 (diff) | |
download | clutter-gst-2ecf993e146f0968a046f8fc9302c5fd9ee10be0.tar.gz |
video-texture: introduce change_uri internal state
This allows to manage the set_progress call right after/before a set_uri
call.
Diffstat (limited to 'clutter-gst/clutter-gst-video-texture.c')
-rw-r--r-- | clutter-gst/clutter-gst-video-texture.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c index cbc3111..f932390 100644 --- a/clutter-gst/clutter-gst-video-texture.c +++ b/clutter-gst/clutter-gst-video-texture.c @@ -62,6 +62,7 @@ struct _ClutterGstVideoTexturePrivate guint can_seek : 1; guint in_seek : 1; guint is_idle : 1; + guint is_changing_uri : 1; gdouble stacked_progress; gdouble target_progress; @@ -358,6 +359,8 @@ set_uri (ClutterGstVideoTexture *video_texture, GObject *self = G_OBJECT (video_texture); GstState state, pending; + CLUTTER_GST_NOTE (MEDIA, "setting uri %s", uri); + if (!priv->pipeline) return; @@ -394,6 +397,8 @@ set_uri (ClutterGstVideoTexture *video_texture, priv->can_seek = FALSE; priv->duration = 0.0; + priv->stacked_progress = 0.0; + priv->target_progress = 0.0; CLUTTER_GST_NOTE (MEDIA, "setting URI: %s", uri); @@ -408,6 +413,8 @@ set_uri (ClutterGstVideoTexture *video_texture, g_object_set (priv->pipeline, "uri", uri, NULL); gst_element_set_state (priv->pipeline, state); + + priv->is_changing_uri = TRUE; } else { @@ -495,9 +502,12 @@ set_progress (ClutterGstVideoTexture *video_texture, priv->target_progress = progress; - if (priv->in_seek || priv->is_idle) + if (priv->in_seek || priv->is_idle || priv->is_changing_uri) { - CLUTTER_GST_NOTE (MEDIA, "already seeking/idleing. stacking progress point."); + /* We can't seek right now, let's save the position where we + want to seek and do that later. */ + CLUTTER_GST_NOTE (MEDIA, + "already seeking/idleing. stacking progress point."); priv->stacked_progress = progress; return; } @@ -527,6 +537,8 @@ set_progress (ClutterGstVideoTexture *video_texture, priv->in_seek = TRUE; priv->stacked_progress = 0.0; + + CLUTTER_GST_NOTE (MEDIA, "set progress (seeked): %.02f", progress); } static gdouble @@ -542,7 +554,7 @@ get_progress (ClutterGstVideoTexture *video_texture) /* When seeking, the progress returned by playbin2 is 0.0. We want that to be * the last known position instead as returning 0.0 will have some ugly * effects, say on a progress bar getting updated from the progress tick. */ - if (priv->in_seek) + if (priv->in_seek || priv->is_changing_uri) { CLUTTER_GST_NOTE (MEDIA, "get progress (target): %.02f", priv->target_progress); @@ -1273,7 +1285,10 @@ bus_message_state_change_cb (GstBus *bus, if (new_state == GST_STATE_NULL) priv->is_idle = TRUE; else if (new_state == GST_STATE_PLAYING) - priv->is_idle = FALSE; + { + priv->is_idle = FALSE; + priv->is_changing_uri = FALSE; + } if (!priv->is_idle) { @@ -1409,6 +1424,7 @@ clutter_gst_video_texture_init (ClutterGstVideoTexture *video_texture) priv->is_idle = TRUE; priv->in_seek = FALSE; + priv->is_changing_uri = FALSE; priv->par_n = priv->par_d = 1; |