summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-02-15 05:24:26 +0100
committerJavier <dev.git@javispedro.com>2015-02-15 05:24:26 +0100
commitb9f02485d40cae22849ba6ee106023f0f0541a95 (patch)
tree126175a1c8d340fe09a5e2b9b4b09a81da421f2b
parent11f4d0ee36b810276c445c3fd07a81b15f98c618 (diff)
downloadgplay-b9f02485d40cae22849ba6ee106023f0f0541a95.tar.gz
gplay-b9f02485d40cae22849ba6ee106023f0f0541a95.zip
do not go back to READY state on EOS
-rw-r--r--gplay.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gplay.c b/gplay.c
index 26d5f96..5659ee8 100644
--- a/gplay.c
+++ b/gplay.c
@@ -63,6 +63,8 @@ static void update_position_ui()
{
gint64 current;
+ g_return_if_fail(play_state >= GST_STATE_PAUSED);
+
if (!GST_CLOCK_TIME_IS_VALID(media_duration)) {
if (gst_element_query_duration(playbin, GST_FORMAT_TIME, &media_duration)) {
const gdouble seconds = (gdouble)media_duration / GST_SECOND;
@@ -92,6 +94,7 @@ static void reset_position_ui()
gtk_widget_set_sensitive(GTK_WIDGET(slider_widget), FALSE);
gtk_range_set_range(GTK_RANGE(slider_widget), 0.0, 1.0);
gtk_range_set_value(GTK_RANGE(slider_widget), 0.0);
+ media_duration = GST_CLOCK_TIME_NONE;
}
static void open_icon_ready(GObject *source, GAsyncResult *res, gpointer user_data)
@@ -262,7 +265,11 @@ static void bus_handle_error(GstBus *bus, GstMessage *msg, gpointer user_data)
static void bus_handle_eos(GstBus *bus, GstMessage *msg, gpointer user_data)
{
g_debug("End-Of-Stream reached");
- gst_element_set_state(playbin, GST_STATE_READY);
+ // Go back to the initial position
+ gst_element_set_state(playbin, GST_STATE_PAUSED);
+ gst_element_seek_simple(playbin, GST_FORMAT_TIME,
+ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
+ 0);
}
static void bus_handle_state_changed(GstBus *bus, GstMessage *msg, gpointer user_data)