diff mplayer.c @ 9291:64b8c5a07c2c

- It adds an option enqueue/noenqueue, so users can choose if they want to have playlist overwritten by files on commandline or just enqueue them at the end ... - Playtree is finally cleared, as such gui has total control! - Autoplay if files are available on commandline and -enqueue is not set! - Fallback on Playlists finally does work with Gui and even with streaming Playlists! [ Before gui was broken as mplayer.c:playtree tried to have control] patch by Fabian Franz <FabianFranz@gmx.de>
author arpi
date Wed, 05 Feb 2003 23:02:35 +0000
parents 420e2b2f8e5a
children 7841308ad250
line wrap: on
line diff
--- a/mplayer.c	Wed Feb 05 23:02:05 2003 +0000
+++ b/mplayer.c	Wed Feb 05 23:02:35 2003 +0000
@@ -181,6 +181,11 @@
 float playback_speed=1.0;
 
 int use_gui=0;
+
+#ifdef HAVE_NEW_GUI
+int enqueue=0;
+#endif
+
 #define MAX_OSD_LEVEL 3
 
 int osd_level=1;
@@ -577,6 +582,15 @@
 
 int playtree_add_playlist(play_tree_t* entry)
 {
+#ifdef HAVE_NEW_GUI
+  if (use_gui) {
+    if (entry) {
+      import_playtree_playlist_into_gui(entry, mconfig);
+      play_tree_free_list(entry,1);
+    }
+  } else
+#endif
+  {
   if(!entry) {      
     entry = playtree_iter->tree;
     if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
@@ -597,6 +611,7 @@
     return PT_NEXT_ENTRY;
   }      
   play_tree_remove(entry,1,1);
+  }
   return PT_NEXT_SRC;
 }
 
@@ -743,6 +758,13 @@
       mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_GuiNeedsX);
       use_gui=0;
     }
+    if (use_gui && playtree_iter){
+      // Remove Playtree and Playtree-Iter from memory as its not used by gui
+      play_tree_iter_free(playtree_iter);
+      playtree_iter=NULL;
+      // Import initital playtree into gui
+      import_initial_playtree_into_gui(playtree, mconfig, enqueue);
+    }
 #endif
 
     if(vo_plugin_args && vo_plugin_args[0] && strcmp(vo_plugin_args[0],"help")==0){
@@ -2303,7 +2325,19 @@
       int n = cmd->args[0].v.i == 0 ? 1 : cmd->args[0].v.i;
       int force = cmd->args[1].v.i;
 
-      if(!force) {
+#ifdef HAVE_NEW_GUI
+     if (use_gui) {
+	int i=0;
+        if (n>0)
+	  for (i=0;i<n;i++)
+	    mplNext();
+        else
+	  for (i=0;i<-1*n;i++)
+	    mplPrev();
+     } else
+#endif
+     {
+      if(!force && playtree_iter) {
 	play_tree_iter_t* i = play_tree_iter_new_copy(playtree_iter);
 	
 	if(play_tree_iter_step(i,n,0) == PLAY_TREE_ITER_ENTRY)
@@ -2313,12 +2347,13 @@
 	eof = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
       if(eof)
 	play_tree_step = n;
+     }
     } break;
     case MP_CMD_PLAY_TREE_UP_STEP : {
       int n = cmd->args[0].v.i > 0 ? 1 : -1;
       int force = cmd->args[1].v.i;
 
-      if(!force) {
+      if(!force && playtree_iter) {
 	play_tree_iter_t* i = play_tree_iter_new_copy(playtree_iter);
 	if(play_tree_iter_up_step(i,n,0) == PLAY_TREE_ITER_ENTRY)
 	  eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV;