diff mplayer.c @ 8198:1935017c0f71

Experimantal OSD menu
author albeu
date Thu, 14 Nov 2002 23:49:05 +0000
parents 487cfc28525d
children ae5a2ae1c349
line wrap: on
line diff
--- a/mplayer.c	Thu Nov 14 23:47:11 2002 +0000
+++ b/mplayer.c	Thu Nov 14 23:49:05 2002 +0000
@@ -92,6 +92,7 @@
 #include "playtree.h"
 
 play_tree_t* playtree;
+play_tree_iter_t* playtree_iter = NULL;
 
 #define PT_NEXT_ENTRY 1
 #define PT_PREV_ENTRY -1
@@ -139,7 +140,8 @@
 
 #include "libmpcodecs/dec_audio.h"
 #include "libmpcodecs/dec_video.h"
-//#include "libmpcodecs/vf.h"
+#include "libmpcodecs/mp_image.h"
+#include "libmpcodecs/vf.h"
 
 extern void vf_list_plugins();
 
@@ -275,6 +277,22 @@
 
 // ---
 
+#ifdef HAVE_MENU
+#include "m_struct.h"
+#include "libmenu/menu.h"
+extern void vf_menu_pause_update(struct vf_instance_s* vf);
+extern vf_info_t vf_info_menu;
+static vf_info_t* libmenu_vfs[] = {
+  &vf_info_menu,
+  NULL
+};
+static vf_instance_t* vf_menu = NULL;
+static int use_menu = 0;
+static char* menu_cfg = NULL;
+static char* menu_root = "main";
+#endif
+
+
 #ifdef HAVE_RTC
 static int nortc;
 #endif
@@ -310,6 +328,9 @@
     current_module="uninit_vcodec";
     if(sh_video) uninit_video(sh_video);
     sh_video=NULL;
+#ifdef HAVE_MENU
+    vf_menu=NULL;
+#endif
   }
  
   if(mask&INITED_DEMUXER){
@@ -507,6 +528,8 @@
   return eof;
 }
 
+static int play_tree_step = 1;
+
 /*
  * In Mac OS X the SDL-lib is built upon Cocoa. The easiest way to
  * make it all work is to use the builtin SDL-bootstrap code, which 
@@ -524,9 +547,6 @@
 static demux_stream_t *d_video=NULL;
 static demux_stream_t *d_dvdsub=NULL;
 
-// for multifile support:
-play_tree_iter_t* playtree_iter = NULL;
-
 int file_format=DEMUXER_TYPE_UNKNOWN;
 
 int delay_corrected=1;
@@ -789,6 +809,19 @@
 inited_flags|=INITED_INPUT;
 current_module = NULL;
 
+#ifdef HAVE_MENU
+ if(use_menu) {
+   if(!menu_cfg) menu_cfg = get_path("menu.conf");
+   if(menu_init(menu_cfg))
+     mp_msg(MSGT_CPLAYER,MSGL_INFO,"Menu inited\n");
+   else {
+     mp_msg(MSGT_CPLAYER,MSGL_INFO,"Menu init failed\n");
+     use_menu = 0;
+   }
+ }
+#endif
+  
+
 
   //========= Catch terminate signals: ================
   // terminate requests:
@@ -1228,6 +1261,18 @@
 current_module="init_video_filters";
 
 sh_video->vfilter=(void*)vf_open_filter(NULL,"vo",video_out);
+#ifdef HAVE_MENU
+if(use_menu) {
+  vf_menu = vf_open_plugin(libmenu_vfs,sh_video->vfilter,"menu",menu_root);
+  if(!vf_menu) {
+    mp_msg(MSGT_CPLAYER,MSGL_ERR,"Can't open libmenu video filter with root menu %s\n",menu_root);
+    use_menu = 0;
+  }
+}
+if(vf_menu)
+  sh_video->vfilter=(void*)append_filters(vf_menu);
+else
+#endif
 sh_video->vfilter=(void*)append_filters(sh_video->vfilter);
 
 current_module="init_video_codec";
@@ -1865,6 +1910,10 @@
 		if(guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) break;
              }
 #endif
+#ifdef HAVE_MENU
+	     if(vf_menu)
+	       vf_menu_pause_update(vf_menu);
+#endif
              usleep(20000);
          }
       mp_cmd_free(cmd);
@@ -1939,7 +1988,7 @@
       grab_frames=2;
     } break;
     case MP_CMD_PLAY_TREE_STEP : {
-      int n = cmd->args[0].v.i > 0 ? 1 : -1;
+      int n = cmd->args[0].v.i == 0 ? 1 : cmd->args[0].v.i;
       int force = cmd->args[1].v.i;
 
       if(!force) {
@@ -1950,6 +1999,8 @@
 	play_tree_iter_free(i);
       } else
 	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;
@@ -2539,7 +2590,7 @@
 
     if(loop_times>1) loop_times--; else
     if(loop_times==1) loop_times=-1;
-
+    play_n_frames=play_n_frames_mf;
     eof=0;
     abs_seek_pos=3; rel_seek_secs=0; // seek to start of movie (0%)
 
@@ -2783,12 +2834,13 @@
 
 if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) {
   eof = eof == PT_NEXT_ENTRY ? 1 : -1;
-  if(play_tree_iter_step(playtree_iter,eof,0) == PLAY_TREE_ITER_ENTRY) {
+  if(play_tree_iter_step(playtree_iter,play_tree_step,0) == PLAY_TREE_ITER_ENTRY) {
     eof = 1;
   } else {
     play_tree_iter_free(playtree_iter);
     playtree_iter = NULL;
   }
+  play_tree_step = 1;
 } else if (eof == PT_UP_NEXT || eof == PT_UP_PREV) {
   eof = eof == PT_UP_NEXT ? 1 : -1;
   if(play_tree_iter_up_step(playtree_iter,eof,0) == PLAY_TREE_ITER_ENTRY) {