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.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17022 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2005-11-20 23:44:46 +00:00
parent 56770b6eef
commit 364ebd2a6f
1 changed files with 14 additions and 7 deletions

View File

@ -225,6 +225,7 @@ int enqueue=0;
#endif #endif
#define MAX_OSD_LEVEL 3 #define MAX_OSD_LEVEL 3
#define MAX_TERM_OSD_LEVEL 1
int osd_level=1; int osd_level=1;
int osd_level_saved=-1; int osd_level_saved=-1;
@ -1150,6 +1151,14 @@ static mp_osd_msg_t* get_osd_msg(void) {
return NULL; 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. * \brief Display the OSD bar.
* *
@ -2966,11 +2975,7 @@ if(auto_quality>0){
// small hack to display the pause message in the osd line // small hack to display the pause message in the osd line
// The pause string is: "\n == PAUSE == \r" so we need to // The pause string is: "\n == PAUSE == \r" so we need to
// take the first and the last char out // take the first and the last char out
#ifdef USE_OSD if(use_term_osd) {
if(term_osd && !sh_video) {
#else
if(term_osd) {
#endif
char msg[128] = MSGTR_Paused; char msg[128] = MSGTR_Paused;
int mlen = strlen(msg); int mlen = strlen(msg);
msg[mlen-1] = '\0'; msg[mlen-1] = '\0';
@ -3232,10 +3237,12 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
} break; } break;
case MP_CMD_OSD : { case MP_CMD_OSD : {
int v = cmd->args[0].v.i; 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) if(v < 0)
osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1); osd_level=(osd_level+1)%(max+1);
else 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 /* Show OSD state when disabled, but not when an explicit
argument is given to the osd command, i.e. in slave mode. */ argument is given to the osd command, i.e. in slave mode. */
if (v == -1 && osd_level <= 1) if (v == -1 && osd_level <= 1)