mirror of https://github.com/mpv-player/mpv
Add a function to remove osd msg and use it to remove the "OSD: enabled"
msg when switching the OSD to a level above 1. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17058 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f5373be10e
commit
575dc26398
25
mplayer.c
25
mplayer.c
|
@ -1103,6 +1103,29 @@ static void set_osd_msg(int id, int level, int time, char* fmt, ...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Remove a message from the OSD stack
|
||||||
|
*
|
||||||
|
* This function can be used to get rid of a message right away.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void rm_osd_msg(int id) {
|
||||||
|
mp_osd_msg_t *msg,*last=NULL;
|
||||||
|
|
||||||
|
// Search for the msg
|
||||||
|
for(msg = osd_msg_stack ; msg && msg->id != id ;
|
||||||
|
last = msg, msg = msg->prev);
|
||||||
|
if(!msg) return;
|
||||||
|
|
||||||
|
// Detach it from the stack and free it
|
||||||
|
if(last)
|
||||||
|
last->prev = msg->prev;
|
||||||
|
else
|
||||||
|
osd_msg_stack = msg->prev;
|
||||||
|
free(msg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the current message fron the OSD stack
|
* \brief Get the current message fron the OSD stack
|
||||||
*
|
*
|
||||||
|
@ -3248,6 +3271,8 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
||||||
if (v == -1 && osd_level <= 1)
|
if (v == -1 && osd_level <= 1)
|
||||||
set_osd_msg(OSD_MSG_OSD_STATUS,0,osd_duration,
|
set_osd_msg(OSD_MSG_OSD_STATUS,0,osd_duration,
|
||||||
MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled : MSGTR_OSDdisabled);
|
MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled : MSGTR_OSDdisabled);
|
||||||
|
else
|
||||||
|
rm_osd_msg(OSD_MSG_OSD_STATUS);
|
||||||
} break;
|
} break;
|
||||||
case MP_CMD_OSD_SHOW_TEXT : {
|
case MP_CMD_OSD_SHOW_TEXT : {
|
||||||
set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%64s",cmd->args[0].v.s);
|
set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%64s",cmd->args[0].v.s);
|
||||||
|
|
Loading…
Reference in New Issue