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.
This commit is contained in:
wm4 2014-11-11 22:07:16 +01:00
parent d4cc41bbcd
commit 88762cd6a7
4 changed files with 10 additions and 1 deletions

View File

@ -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;
}

View File

@ -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,
};

View File

@ -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++) {

View File

@ -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;
}