[snappy] ui: press '>' to play next uri in the list



commit 89ce61ba8de7f75a07063c7980fa33306e1a0840
Author: Luis de Bethencourt <luis debethencourt com>
Date:   Thu May 3 17:30:31 2012 +0100

    ui: press '>' to play next uri in the list

 docs/keyboard_controls |    2 ++
 src/gst_engine.c       |    3 +++
 src/user_interface.c   |   22 ++++++++++++++++++++++
 src/user_interface.h   |    3 +++
 4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/docs/keyboard_controls b/docs/keyboard_controls
index d2a9e9e..7ee2c4a 100644
--- a/docs/keyboard_controls
+++ b/docs/keyboard_controls
@@ -17,6 +17,8 @@ right      - seek 10 seconds foward
 9          - turn volume up
 0          - turn volume down
 
+>          - play next
+
 c          - show/hide visual controls
 
 v          - toggle subtitles
diff --git a/src/gst_engine.c b/src/gst_engine.c
index 76607c4..a9dd719 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -635,6 +635,9 @@ void
 engine_open_uri (GstEngine * engine, gchar * uri)
 {
   /* Need to set back to Ready state so Playbin2 loads uri */
+  engine->uri = uri;
+
+  g_print ("Open uri: %s\n", next_uri);
   gst_element_set_state (engine->player, GST_STATE_READY);
   g_object_set (G_OBJECT (engine->player), "uri", uri, NULL);
 
diff --git a/src/user_interface.c b/src/user_interface.c
index d5a1a6b..03eb722 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -267,6 +267,13 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
           break;
         }
 
+        case CLUTTER_greater:
+        {
+          interface_play_next (ui);
+
+          break;
+        }
+
         default:
         {
           handled = FALSE;
@@ -1022,6 +1029,21 @@ interface_load_uri (UserInterface * ui, gchar * uri)
 }
 
 void
+interface_play_next (UserInterface * ui)
+{
+  GList * next;
+  gchar * next_uri;
+
+  next = g_list_find (ui->uri_list, ui->engine->uri);
+  next = g_list_next (next);
+  next_uri = next->data;
+
+  engine_open_uri (ui->engine, next_uri);
+  interface_load_uri (ui, next_uri);
+  engine_play (ui->engine);
+}
+
+void
 interface_start (UserInterface * ui, gchar * uri)
 {
   ClutterColor stage_color = { 0x00, 0x00, 0x00, 0x00 };
diff --git a/src/user_interface.h b/src/user_interface.h
index 5f305d4..e8efa2e 100644
--- a/src/user_interface.h
+++ b/src/user_interface.h
@@ -92,6 +92,8 @@ struct _UserInterface
   gchar *video_stream_toggle_png, *audio_stream_toggle_png;
   gchar *duration_str;
 
+  GList *uri_list;
+
   ClutterColor stage_color, control_color1, control_color2;
 
   ClutterActor *stage;
@@ -115,6 +117,7 @@ struct _UserInterface
 // Declaration of non-static functions
 void interface_init (UserInterface * ui);
 gboolean interface_load_uri (UserInterface * ui, gchar * uri);
+void interface_play_next (UserInterface * ui);
 void interface_start (UserInterface * ui, gchar * uri);
 gboolean interface_update_controls (UserInterface * ui);
 



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