changeset 8198:1935017c0f71

Experimantal OSD menu
author albeu
date Thu, 14 Nov 2002 23:49:05 +0000
parents b31caec933e9
children 6fe1bb505027
files Makefile cfg-mplayer.h configure mplayer.c
diffstat 4 files changed, 101 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Nov 14 23:47:11 2002 +0000
+++ b/Makefile	Thu Nov 14 23:49:05 2002 +0000
@@ -64,6 +64,9 @@
 ifneq ($(W32_LIB),)
 PARTS += loader loader/dshow
 endif
+ifeq ($(LIBMENU),yes)
+PARTS += libmenu
+endif
 
 ALL_PRG = $(PRG)
 ifeq ($(MENCODER),yes)
@@ -175,7 +178,19 @@
 input/libinput.a:
 	$(MAKE) -C input
 
+libmenu/libmenu.a:
+	$(MAKE) -C libmenu
+
 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
+
+ifeq ($(LIBMENU),yes)
+MPLAYER_DEP += libmenu/libmenu.a
+MENU_LIBS = libmenu/libmenu.a
+PARTS += libmenu
+else
+MENU_LIBS =
+endif
+
 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS)
 
 ifeq ($(VIDIX),yes)
@@ -186,7 +201,7 @@
 
 $(PRG):	$(MPLAYER_DEP)
 	./darwinfixlib.sh $(MPLAYER_DEP)
-	$(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lm 
+	$(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lm
 
 mplayer.exe.spec.c: libmpcodecs/libmpcodecs.a
 	winebuild -fPIC -o mplayer.exe.spec.c -exe mplayer.exe -mcui \
--- a/cfg-mplayer.h	Thu Nov 14 23:47:11 2002 +0000
+++ b/cfg-mplayer.h	Thu Nov 14 23:49:05 2002 +0000
@@ -335,6 +335,14 @@
 //---------------------- mplayer-only options ------------------------
 
 	{"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL},
+#ifdef HAVE_MENU
+	{"menu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+	{"nomenu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
+	{"menu-root", &menu_root, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
+	{"menu-cfg", &menu_cfg, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
+#else
+	{"menu", "OSD menu support was not compiled in\n", CONF_TYPE_PRINT,0, 0, 0, NULL},
+#endif
 
 	// these should be moved to -common, and suppot in mencoder too
 	{"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
--- a/configure	Thu Nov 14 23:47:11 2002 +0000
+++ b/configure	Thu Nov 14 23:49:05 2002 +0000
@@ -152,6 +152,7 @@
   --enable-freetype      Enable freetype2 font rendering support [disabled]
   --disable-unrarlib     Disable Unique RAR File Library [enabled]
   --enable-new-conf      Enable new config stuff [disabled]
+  --enable-menu          Enable osd menu support (need new config) [disabled]
 
 Codecs:
   --enable-gif		 enable gif89a output support [autodetect]
@@ -1015,6 +1016,7 @@
 _freetype=no
 _shared_pp=no
 _new_conf=no
+_menu=no
 
 for ac_option do
   case "$ac_option" in
@@ -1198,6 +1200,9 @@
   --enable-new-conf) _new_conf=yes ;;
   --disable-new-conf) _new_conf=no ;;
 
+  --enable-menu) _menu=yes ;;
+  --disable-menu) _menu=no ;;
+
   --language=*)
     LINGUAS=`echo $ac_option | cut -d '=' -f 2`
     ;;
@@ -4248,6 +4253,15 @@
 fi
 echores "$_new_conf"
 
+echocheck "OSD menu"
+if test "$_menu" = yes ; then
+    test "$_new_conf" != yes && die "New config support needed for the OSD menu (--enable-new-conf)."
+    _def_menu='#define HAVE_MENU 1'
+else
+_def_menu='#undef HAVE_MENU'
+fi
+echores "$_menu"
+
 # --------------- GUI specific tests begin -------------------
 echocheck "GUI"
 echo "$_gui"
@@ -4517,6 +4531,7 @@
 VIDIX = $_vidix
 PP_LIB = $_ld_pp
 SHARED_PP = $_shared_pp
+LIBMENU = $_menu
 
 OPENDIVX = $_opendivx
 
@@ -4985,6 +5000,9 @@
 /* enables / disables new config */
 $_def_new_conf
 
+/* enables / disables osd menu */
+$_def_menu
+
 /* Extension defines */
 $_def_3dnow	// only define if you have 3DNOW (AMD k6-2, AMD Athlon, iDT WinChip, etc.)
 $_def_3dnowex	// only define if you have 3DNOWEX (AMD Athlon, etc.)
--- 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) {