changeset 6818:b9a6817d9ff3

Add loadfile and loadlist commands. May be buggy if the filename contain some spaces.
author albeu
date Fri, 26 Jul 2002 21:26:39 +0000
parents 3e62e9cd1816
children 8c97eacc383c
files input/input.c input/input.h mplayer.c
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Fri Jul 26 12:42:43 2002 +0000
+++ b/input/input.c	Fri Jul 26 21:26:39 2002 +0000
@@ -68,6 +68,8 @@
   { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
   { MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },
   { MP_CMD_PANSCAN, "panscan",1,  { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+  { MP_CMD_LOADFILE, "loadfile", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
+  { MP_CMD_LOADLIST, "loadlist", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
 
 #ifdef HAVE_NEW_GUI  
   { MP_CMD_GUI_LOADFILE, "gui_loadfile", 0, { {-1,{0}} } },
--- a/input/input.h	Fri Jul 26 12:42:43 2002 +0000
+++ b/input/input.h	Fri Jul 26 21:26:39 2002 +0000
@@ -28,6 +28,8 @@
 #define MP_CMD_SCREENSHOT 23
 #define MP_CMD_PANSCAN 24
 #define MP_CMD_MUTE 25
+#define MP_CMD_LOADFILE 26
+#define MP_CMD_LOADLIST 27
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
--- a/mplayer.c	Fri Jul 26 12:42:43 2002 +0000
+++ b/mplayer.c	Fri Jul 26 21:26:39 2002 +0000
@@ -2393,7 +2393,31 @@
     case MP_CMD_MUTE: {
      mixer_mute();
     }
-    case MP_CMD_MIXER_USEMASTER :  {
+    case MP_CMD_LOADFILE : {
+      play_tree_t* e = play_tree_new();
+      play_tree_add_file(e,cmd->args[0].v.s);
+
+      // Go back to the start point
+      while(play_tree_iter_up_step(playtree_iter,0,1) != PLAY_TREE_ITER_END)
+	/* NOP */;
+      play_tree_free_list(playtree->child,1);
+      play_tree_set_child(playtree,e);
+      play_tree_iter_step(playtree_iter,0,0);
+      eof = PT_NEXT_SRC;
+    } break;
+    case MP_CMD_LOADLIST : {
+      play_tree_t* e = parse_playlist_file(cmd->args[0].v.s);
+      if(!e)
+	mp_msg(MSGT_CPLAYER,MSGL_ERR,"\nUnable to load playlist %s\n",cmd->args[0].v.s);
+      else {
+	// Go back to the start point
+	while(play_tree_iter_up_step(playtree_iter,0,1) != PLAY_TREE_ITER_END)
+	  /* NOP */;
+	play_tree_free_list(playtree->child,1);
+	play_tree_set_child(playtree,e);
+	play_tree_iter_step(playtree_iter,0,0);
+	eof = PT_NEXT_SRC;	
+      }
     } break;
     case MP_CMD_BRIGHTNESS :  {
       int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;