From 88762cd6a7adfe3c9fb70fb3fcdb85b254119bf9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 11 Nov 2014 22:07:16 +0100 Subject: player: make the osd-msg prefix work for playlist_next/prev If input.conf e.g. contains "n osd-msg playlist_next", then pressing the n key will switch to the next file, and display the filename on OSD. --- player/command.c | 2 ++ player/core.h | 1 + player/loadfile.c | 2 +- player/osd.c | 6 ++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/player/command.c b/player/command.c index 3513d99afc..4bbb46860d 100644 --- a/player/command.c +++ b/player/command.c @@ -4060,6 +4060,8 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mpctx->playlist->current = e; mpctx->playlist->current_was_replaced = false; mpctx->stop_play = PT_CURRENT_ENTRY; + if (on_osd & MP_ON_OSD_MSG) + mpctx->add_osd_seek_info |= OSD_SEEK_INFO_CURRENT_FILE; break; } diff --git a/player/core.h b/player/core.h index ae0a5c5dbb..32239f28e3 100644 --- a/player/core.h +++ b/player/core.h @@ -52,6 +52,7 @@ enum mp_osd_seek_info { OSD_SEEK_INFO_TEXT = 2, OSD_SEEK_INFO_CHAPTER_TEXT = 4, OSD_SEEK_INFO_EDITION = 8, + OSD_SEEK_INFO_CURRENT_FILE = 16, }; diff --git a/player/loadfile.c b/player/loadfile.c index 476461c969..2cdcc599c1 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -917,7 +917,7 @@ static void play_current_file(struct MPContext *mpctx) mpctx->filename = talloc_strdup(tmp, mpctx->playing->filename); mpctx->stream_open_filename = mpctx->filename; - mpctx->add_osd_seek_info &= OSD_SEEK_INFO_EDITION; + mpctx->add_osd_seek_info &= OSD_SEEK_INFO_EDITION | OSD_SEEK_INFO_CURRENT_FILE; if (opts->reset_options) { for (int n = 0; opts->reset_options[n]; n++) { diff --git a/player/osd.c b/player/osd.c index e59920dd03..7e099e2d0c 100644 --- a/player/osd.c +++ b/player/osd.c @@ -452,6 +452,12 @@ static void add_seek_osd_messages(struct MPContext *mpctx) mpctx->master_demuxer->edition + 1, mpctx->master_demuxer->num_editions); } + if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CURRENT_FILE) { + if (mpctx->filename) { + set_osd_msg(mpctx, 1, mpctx->opts->osd_duration, "%s", + mpctx->filename); + } + } mpctx->add_osd_seek_info = 0; } -- cgit v1.2.3