diff options
author | wm4 <wm4@nowhere> | 2013-02-06 21:38:53 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-02-06 23:03:39 +0100 |
commit | 74817a77d45c96d4107b1946d0f918a893c58cac (patch) | |
tree | c2d8ace45def32bcbb985a24f612faa0e0ba447b /core/command.c | |
parent | 314a07e787eac88486e5b3b5ed48aa37ae7cddfd (diff) | |
download | mpv-74817a77d45c96d4107b1946d0f918a893c58cac.tar.bz2 mpv-74817a77d45c96d4107b1946d0f918a893c58cac.tar.xz |
command: add command to show playlist on OSD
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/command.c b/core/command.c index 8331278148..4f304ded99 100644 --- a/core/command.c +++ b/core/command.c @@ -1739,6 +1739,23 @@ static void show_tracks_on_osd(MPContext *mpctx) talloc_free(res); } +static void show_playlist_on_osd(MPContext *mpctx) +{ + struct MPOpts *opts = &mpctx->opts; + char *res = NULL; + + for (struct playlist_entry *e = mpctx->playlist->first; e; e = e->next) { + if (mpctx->playlist->current == e) { + res = talloc_asprintf_append(res, "> %s <\n", e->filename); + } else { + res = talloc_asprintf_append(res, "%s\n", e->filename); + } + } + + set_osd_msg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration, "%s", res); + talloc_free(res); +} + void run_command(MPContext *mpctx, mp_cmd_t *cmd) { struct MPOpts *opts = &mpctx->opts; @@ -2308,6 +2325,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) case MP_CMD_SHOW_TRACKS: show_tracks_on_osd(mpctx); break; + case MP_CMD_SHOW_PLAYLIST: + show_playlist_on_osd(mpctx); + break; default: mp_msg(MSGT_CPLAYER, MSGL_V, |