mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 11:42:04 +00:00
command: improve "osd" command
Be less annoying, print the actual OSD level instead of something meaningless, but still clear the OSD if OSD level 0 (no OSD) is set. Remove the special handling for terminal OSD, that was just dumb.
This commit is contained in:
parent
709002a3b2
commit
14ff4cf318
@ -3689,17 +3689,17 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
|
||||
case MP_CMD_OSD: {
|
||||
int v = cmd->args[0].v.i;
|
||||
int max = (opts->term_osd && !mpctx->video_out) ? MAX_TERM_OSD_LEVEL
|
||||
: MAX_OSD_LEVEL;
|
||||
if (opts->osd_level > max)
|
||||
opts->osd_level = max;
|
||||
if (opts->osd_level > MAX_OSD_LEVEL)
|
||||
opts->osd_level = MAX_OSD_LEVEL;
|
||||
if (v < 0)
|
||||
opts->osd_level = (opts->osd_level + 1) % (max + 1);
|
||||
opts->osd_level = (opts->osd_level + 1) % (MAX_OSD_LEVEL + 1);
|
||||
else
|
||||
opts->osd_level = v > max ? max : v;
|
||||
if (msg_osd && opts->osd_level <= 1)
|
||||
set_osd_msg(mpctx, 0, osd_duration,
|
||||
"OSD: %s", opts->osd_level ? "yes" : "no");
|
||||
opts->osd_level = MPCLAMP(v, 0, MAX_OSD_LEVEL);
|
||||
if (opts->osd_level > 0) {
|
||||
set_osd_msg(mpctx, osdl, osd_duration, "OSD level: %d", opts->osd_level);
|
||||
} else {
|
||||
set_osd_msg(mpctx, 0, 0, "%s", "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,6 @@ enum mp_osd_seek_info {
|
||||
enum {
|
||||
// other constants
|
||||
MAX_OSD_LEVEL = 3,
|
||||
MAX_TERM_OSD_LEVEL = 1,
|
||||
OSD_LEVEL_INVISIBLE = 4,
|
||||
OSD_BAR_SEEK = 256,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user