diff options
author | Javier <dev.git@javispedro.com> | 2015-02-15 05:24:26 +0100 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2015-02-15 05:24:26 +0100 |
commit | b9f02485d40cae22849ba6ee106023f0f0541a95 (patch) | |
tree | 126175a1c8d340fe09a5e2b9b4b09a81da421f2b | |
parent | 11f4d0ee36b810276c445c3fd07a81b15f98c618 (diff) | |
download | gplay-b9f02485d40cae22849ba6ee106023f0f0541a95.tar.gz gplay-b9f02485d40cae22849ba6ee106023f0f0541a95.zip |
do not go back to READY state on EOS
-rw-r--r-- | gplay.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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) |