From 14ff4cf318d2f01f98eab8f0541eabfbcf8f6943 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Sep 2014 00:25:59 +0200 Subject: [PATCH] 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. --- player/command.c | 18 +++++++++--------- player/core.h | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/player/command.c b/player/command.c index 66f12cd216..fb4b0a12df 100644 --- a/player/command.c +++ b/player/command.c @@ -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; } diff --git a/player/core.h b/player/core.h index d9d7798faf..11421ce485 100644 --- a/player/core.h +++ b/player/core.h @@ -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,