[MPlayer-cvslog] CVS: main mplayer.c,1.888,1.889

Alban Bedel CVS syncmail at mplayerhq.hu
Mon Nov 21 00:44:49 CET 2005


CVS change done by Alban Bedel CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv26418

Modified Files:
	mplayer.c 
Log Message:
Make the osd command only switch between enabled/disabled when
using the term osd.
Also put a define to test for the term osd without #ifdef.


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.888
retrieving revision 1.889
diff -u -r1.888 -r1.889
--- mplayer.c	16 Nov 2005 16:51:48 -0000	1.888
+++ mplayer.c	20 Nov 2005 23:44:46 -0000	1.889
@@ -225,6 +225,7 @@
 #endif
 
 #define MAX_OSD_LEVEL 3
+#define MAX_TERM_OSD_LEVEL 1
 
 int osd_level=1;
 int osd_level_saved=-1;
@@ -1150,6 +1151,14 @@
     return NULL;
 }
 
+// Make a define to test if we are using the term osd without having
+// to #ifdef USE_OSD all the time.
+#ifdef USE_OSD
+#define use_term_osd (term_osd && !sh_video)
+#else
+#define use_term_osd (term_osd)
+#endif
+
 /**
  * \brief Display the OSD bar.
  *
@@ -2966,11 +2975,7 @@
         // small hack to display the pause message in the osd line
         // The pause string is: "\n == PAUSE == \r" so we need to
         // take the first and the last char out
-#ifdef USE_OSD
-	if(term_osd && !sh_video) {
-#else
-	if(term_osd) {
-#endif
+	if(use_term_osd) {
 	  char msg[128] = MSGTR_Paused;
 	  int mlen = strlen(msg);
 	  msg[mlen-1] = '\0';
@@ -3232,10 +3237,12 @@
     } break;
     case MP_CMD_OSD :  {
 	int v = cmd->args[0].v.i;
+	int max = use_term_osd ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL;
+	if(osd_level > max) osd_level = max;
 	if(v < 0)
-	  osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1);
+	  osd_level=(osd_level+1)%(max+1);
 	else
-	  osd_level= v > MAX_OSD_LEVEL ? MAX_OSD_LEVEL : v;
+	  osd_level= v > max ? max : v;
 	/* Show OSD state when disabled, but not when an explicit
 	   argument is given to the osd command, i.e. in slave mode. */
 	if (v == -1 && osd_level <= 1)




More information about the MPlayer-cvslog mailing list