From a6a1f4b8336c0d18c0588922da6b786b6408209f Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 28 Jun 2013 22:16:29 +0200 Subject: command: add properties for playlist position playlist-pos can set/get the current playlist index. playlist-count returns the number of entries in the playlist. --- core/mplayer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/mplayer.c') diff --git a/core/mplayer.c b/core/mplayer.c index 4377f9f9bc..f12560b589 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -4521,6 +4521,16 @@ static void play_files(struct MPContext *mpctx) } } +// Abort current playback and set the given entry to play next. +// e must be on the mpctx->playlist. +void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e) +{ + assert(playlist_entry_to_index(mpctx->playlist, e) >= 0); + mpctx->playlist->current = e; + mpctx->playlist->current_was_replaced = false; + mpctx->stop_play = PT_CURRENT_ENTRY; +} + void mp_print_version(int always) { mp_msg(MSGT_CPLAYER, always ? MSGL_INFO : MSGL_V, -- cgit v1.2.3