[MPlayer-dev-eng] [PATCH] libmenu with dvd and disabling special pause handling

Andreas Hess jaska at gmx.net
Thu Dec 26 14:42:08 CET 2002


Hi!

This patch fixes the reading of the menu.conf, because stream_open()
isn't a good idea, it messes with dvd playback. Further on it 
disables the buggy pause handling. (And yes, pause still works,
just better ;-))


Andreas
-------------- next part --------------
Index: libmenu/menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu.c,v
retrieving revision 1.5
diff -u -r1.5 menu.c
--- libmenu/menu.c	22 Nov 2002 12:01:59 -0000	1.5
+++ libmenu/menu.c	26 Dec 2002 13:32:13 -0000
@@ -4,6 +4,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "../libvo/osd.h"
 #include "../libvo/font_load.h"
@@ -115,8 +117,8 @@
   char* buffer = NULL;
   int bl = BUF_STEP, br = 0;
   int f;
-  stream_t* stream = open_stream(cfg_file,0,&f);
-  if(!stream) {
+  int fd = open(cfg_file, O_RDONLY);
+  if(fd < 0) {
     printf("Can't open menu config file: %s\n",cfg_file);
     return 0;
   }
@@ -126,14 +128,14 @@
     if(bl - br < BUF_MIN) {
       if(bl >= BUF_MAX) {
 	printf("Menu config file is too big (> %d KB)\n",BUF_MAX/1024);
-	free_stream(stream);
+	close(fd);
 	free(buffer);
 	return 0;
       }
       bl += BUF_STEP;
       buffer = realloc(buffer,bl);
     }
-    r = stream_read(stream,buffer+br,bl-br);
+    r = read(fd,buffer+br,bl-br);
     if(r == 0) break;
     br += r;
   }
@@ -142,6 +144,8 @@
     return 0;
   }
   buffer[br-1] = '\0';
+
+  close(fd);
 
   f = menu_parse_config(buffer);
   free(buffer);
Index: libmenu/vf_menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/vf_menu.c,v
retrieving revision 1.4
diff -u -r1.4 vf_menu.c
--- libmenu/vf_menu.c	22 Nov 2002 12:01:59 -0000	1.4
+++ libmenu/vf_menu.c	26 Dec 2002 13:32:13 -0000
@@ -25,7 +25,7 @@
 static struct vf_priv_s* st_priv = NULL;
 
 static mp_image_t* pause_mpi = NULL;
-static int go2pause = 0;
+//static int go2pause = 0;
 
 struct vf_priv_s {
   menu_t* root;
@@ -81,6 +81,11 @@
 static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
 
   switch(cmd->id) {
+/*
+ * Buggy!  Using pause in menu messes up pause handling with menu switched
+ * off.  For example you have to hit 'p' two times, and it displays an old
+ * frame, that was saved in the last menu-pause.
+ * 
   case MP_CMD_PAUSE :
     if(!paused && !go2pause) { // Initial pause cmd -> wait the next put_image
       go2pause = 1;
@@ -89,6 +94,7 @@
     if(go2pause == 2) // Msg resent by put_image after saving the image
       go2pause = 0;
     break;
+*/
   case MP_CMD_MENU : {  // Convert txt cmd from the users into libmenu stuff
     char* arg = cmd->args[0].v.s;
     
@@ -174,6 +180,11 @@
     menu_close(m);
   }
 
+/*
+ * Buggy!  Using pause in menu messes up pause handling with menu switched
+ * off.  For example you have to hit 'p' two times, and it displays an old
+ * frame, that was saved in the last menu-pause.
+ *
   // Step 1 : save the picture
   while(go2pause == 1) {
     static char delay = 0; // Hack : wait the 2 frame to be sure to show the right picture
@@ -192,6 +203,7 @@
     go2pause = 2;
     break;
   }
+*/
 
   // Grab // Ungrab the keys
   if(!mp_input_key_cb && vf->priv->current->show)
@@ -263,7 +275,7 @@
   vf->get_image = get_image;
   vf->uninit=uninit;
   vf->priv=st_priv;
-  go2pause=0;
+//  go2pause=0;
 
   return 1;
 }


More information about the MPlayer-dev-eng mailing list