summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-17 23:55:04 +0200
committerwm4 <wm4@nowhere>2014-04-17 23:55:42 +0200
commit1b398e99f735e141d88186d4e1a722b9a00f4b9a (patch)
treed7a4fdcba5071b020ac7038ba40bc67af1973a2f /player
parent5059039c95f51cfe33f828a66d55b1255ab1626d (diff)
downloadmpv-1b398e99f735e141d88186d4e1a722b9a00f4b9a.tar.bz2
mpv-1b398e99f735e141d88186d4e1a722b9a00f4b9a.tar.xz
player: add a --loop-file option
Unlike --loop, loops a file instead of the playlist.
Diffstat (limited to 'player')
-rw-r--r--player/command.c1
-rw-r--r--player/playloop.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 9834b97b8a..c20e33167a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2205,6 +2205,7 @@ static const m_option_t mp_properties[] = {
M_OPTION_PROPERTY("osd-level"),
M_OPTION_PROPERTY_CUSTOM("osd-scale", property_osd_helper),
M_OPTION_PROPERTY("loop"),
+ M_OPTION_PROPERTY("loop-file"),
M_OPTION_PROPERTY_CUSTOM("speed", mp_property_playback_speed),
{ "filename", mp_property_filename, CONF_TYPE_STRING,
0, 0, 0, NULL },
diff --git a/player/playloop.c b/player/playloop.c
index 9ad9debfe1..31e8570589 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -825,6 +825,15 @@ static void handle_sstep(struct MPContext *mpctx)
}
}
+static void handle_loop_file(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = mpctx->opts;
+ if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
+ set_osd_function(mpctx, OSD_FFW);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, get_start_time(mpctx), 0, true);
+ }
+}
+
static void handle_keep_open(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
@@ -1282,6 +1291,8 @@ void run_playloop(struct MPContext *mpctx)
handle_sstep(mpctx);
+ handle_loop_file(mpctx);
+
handle_keep_open(mpctx);
handle_force_window(mpctx, false);