[snappy] engine: play next uri at segment done



commit 31d56d8cfe7e6adbde4f47f198cd189e034e241c
Author: Luis de Bethencourt <luis debethencourt com>
Date:   Fri May 4 09:58:54 2012 +0100

    engine: play next uri at segment done

 src/gst_engine.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index 183d396..2162260 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -59,6 +59,7 @@ gint64 is_uri_unfinished_playback (GstEngine * engine, gchar * uri);
 static void print_tag (const GstTagList * list, const gchar * tag,
     gpointer unused);
 void remove_uri_unfinished_playback (GstEngine * engine, gchar * uri);
+void stream_done (GstEngine * engine, UserInterface *ui);
 
 /* -------------------- static functions --------------------- */
 
@@ -356,6 +357,19 @@ remove_uri_unfinished_playback (GstEngine * engine, gchar * uri)
   return;
 }
 
+/*    When Stream or segment is done play next or loop     */
+void stream_done (GstEngine * engine, UserInterface *ui)
+{
+      /* When URI is done or looping remove from unfinished list */
+      remove_uri_unfinished_playback (engine, engine->uri);
+
+      if (engine->loop) {
+        engine_seek (engine, 0, TRUE);
+      } else {
+        interface_play_next (ui);
+      }
+}
+
 /* -------------------- non-static functions --------------------- */
 
 
@@ -399,14 +413,7 @@ bus_call (GstBus * bus, GstMessage * msg, gpointer data)
     case GST_MESSAGE_EOS:
     {
       g_debug ("End-of-stream");
-      /* When URI is finished remove from unfinished list */
-      remove_uri_unfinished_playback (engine, engine->uri);
-
-      if (engine->loop) {
-        engine_seek (engine, 0, TRUE);
-      } else {
-        interface_play_next (ui);
-      }
+      stream_done (engine, ui);
 
       break;
     }
@@ -466,8 +473,9 @@ bus_call (GstBus * bus, GstMessage * msg, gpointer data)
 
     case GST_MESSAGE_SEGMENT_DONE:
     {
-      if (engine->loop)
-        engine_seek (engine, 0, TRUE);
+      g_debug ("Segment-done");
+      stream_done (engine, ui);
+
       break;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]