mirror of https://github.com/mpv-player/mpv
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: {
|
case MP_CMD_OSD: {
|
||||||
int v = cmd->args[0].v.i;
|
int v = cmd->args[0].v.i;
|
||||||
int max = (opts->term_osd && !mpctx->video_out) ? MAX_TERM_OSD_LEVEL
|
if (opts->osd_level > MAX_OSD_LEVEL)
|
||||||
: MAX_OSD_LEVEL;
|
opts->osd_level = MAX_OSD_LEVEL;
|
||||||
if (opts->osd_level > max)
|
|
||||||
opts->osd_level = max;
|
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
opts->osd_level = (opts->osd_level + 1) % (max + 1);
|
opts->osd_level = (opts->osd_level + 1) % (MAX_OSD_LEVEL + 1);
|
||||||
else
|
else
|
||||||
opts->osd_level = v > max ? max : v;
|
opts->osd_level = MPCLAMP(v, 0, MAX_OSD_LEVEL);
|
||||||
if (msg_osd && opts->osd_level <= 1)
|
if (opts->osd_level > 0) {
|
||||||
set_osd_msg(mpctx, 0, osd_duration,
|
set_osd_msg(mpctx, osdl, osd_duration, "OSD level: %d", opts->osd_level);
|
||||||
"OSD: %s", opts->osd_level ? "yes" : "no");
|
} else {
|
||||||
|
set_osd_msg(mpctx, 0, 0, "%s", "");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ enum mp_osd_seek_info {
|
||||||
enum {
|
enum {
|
||||||
// other constants
|
// other constants
|
||||||
MAX_OSD_LEVEL = 3,
|
MAX_OSD_LEVEL = 3,
|
||||||
MAX_TERM_OSD_LEVEL = 1,
|
|
||||||
OSD_LEVEL_INVISIBLE = 4,
|
OSD_LEVEL_INVISIBLE = 4,
|
||||||
OSD_BAR_SEEK = 256,
|
OSD_BAR_SEEK = 256,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue