[clutter-gst] ClutterGstPlayback: implement a method to get position in seconds
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst] ClutterGstPlayback: implement a method to get position in seconds
- Date: Tue, 19 Nov 2013 12:21:28 +0000 (UTC)
commit 37889b48957d1476f9f1a7641e72e1fec1f8025b
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date: Fri Aug 2 16:46:20 2013 +0200
ClutterGstPlayback: implement a method to get position in seconds
clutter-gst/clutter-gst-playback.c | 30 ++++++++++++++++++++++++++++++
clutter-gst/clutter-gst-playback.h | 1 +
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-playback.c b/clutter-gst/clutter-gst-playback.c
index 1aa4163..209ba76 100644
--- a/clutter-gst/clutter-gst-playback.c
+++ b/clutter-gst/clutter-gst-playback.c
@@ -812,6 +812,21 @@ set_subtitle_font_name (ClutterGstPlayback *self,
g_object_set (priv->pipeline, "subtitle-font-desc", font_name, NULL);
}
+static gdouble
+get_position (ClutterGstPlayback *self)
+{
+ ClutterGstPlaybackPrivate *priv = self->priv;
+ gboolean success;
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 position;
+
+ success = gst_element_query_position (priv->pipeline, format, &position);
+ if (G_UNLIKELY (success != TRUE))
+ return 0.0;
+
+ return (gdouble) position / GST_SECOND;
+}
+
static gboolean
player_buffering_timeout (gpointer data)
{
@@ -2764,6 +2779,21 @@ clutter_gst_playback_get_progress (ClutterGstPlayback *self)
return get_progress (self);
}
+/**
+ * clutter_gst_playback_get_position:
+ * @self: a #ClutterGstPlayback
+ *
+ * Retrieves the position in the media stream that @self represents.
+ *
+ * Return value: the position in the media stream, in seconds
+ */
+gdouble
+clutter_gst_playback_get_position (ClutterGstPlayback *self)
+{
+ g_return_val_if_fail (CLUTTER_GST_IS_PLAYBACK (self), 0);
+
+ return get_position (self);
+}
/**
* clutter_gst_playback_get_duration:
diff --git a/clutter-gst/clutter-gst-playback.h b/clutter-gst/clutter-gst-playback.h
index ba8ae3e..d92905b 100644
--- a/clutter-gst/clutter-gst-playback.h
+++ b/clutter-gst/clutter-gst-playback.h
@@ -159,6 +159,7 @@ gboolean clutter_gst_playback_get_in_seek (ClutterGstPl
void clutter_gst_playback_set_progress (ClutterGstPlayback *self,
gdouble progress);
gdouble clutter_gst_playback_get_progress (ClutterGstPlayback *self);
+gdouble clutter_gst_playback_get_position (ClutterGstPlayback *self);
gdouble clutter_gst_playback_get_duration (ClutterGstPlayback *self);
gboolean clutter_gst_playback_is_live_media (ClutterGstPlayback *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]