summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-06 21:38:53 +0100
committerwm4 <wm4@nowhere>2013-02-06 23:03:39 +0100
commit74817a77d45c96d4107b1946d0f918a893c58cac (patch)
treec2d8ace45def32bcbb985a24f612faa0e0ba447b /core
parent314a07e787eac88486e5b3b5ed48aa37ae7cddfd (diff)
downloadmpv-74817a77d45c96d4107b1946d0f918a893c58cac.tar.bz2
mpv-74817a77d45c96d4107b1946d0f918a893c58cac.tar.xz
command: add command to show playlist on OSD
Diffstat (limited to 'core')
-rw-r--r--core/command.c20
-rw-r--r--core/input/input.c1
-rw-r--r--core/input/input.h1
3 files changed, 22 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,
diff --git a/core/input/input.c b/core/input/input.c
index 06966ce25c..a03acd8e76 100644
--- a/core/input/input.c
+++ b/core/input/input.c
@@ -198,6 +198,7 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_SHOW_CHAPTERS, "show_chapters", },
{ MP_CMD_SHOW_TRACKS, "show_tracks", },
+ { MP_CMD_SHOW_PLAYLIST, "show_playlist", },
{ MP_CMD_VO_CMDLINE, "vo_cmdline", { ARG_STRING } },
diff --git a/core/input/input.h b/core/input/input.h
index b86f51a1e7..86726719b1 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -79,6 +79,7 @@ enum mp_command_type {
MP_CMD_SHOW_CHAPTERS,
MP_CMD_SHOW_TRACKS,
+ MP_CMD_SHOW_PLAYLIST,
/// Video output commands
MP_CMD_VO_CMDLINE,