summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-28 11:39:43 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-29 05:50:38 +0300
commitf25accbc510b641ac75a1f274376616417763ae5 (patch)
tree8ef7aa6cc1470fb61f2cd46a3b82aec6cc06ead3 /mplayer.c
parente873d703e956d3e2e68b9e18562983b029b5c7a8 (diff)
downloadmpv-f25accbc510b641ac75a1f274376616417763ae5.tar.bz2
mpv-f25accbc510b641ac75a1f274376616417763ae5.tar.xz
core: improve --loop handling
Make per-file loop option start from --ss position, not always 0. Do looping in more cases; before looping was only done when encountering real end of file, now it also happens for example at --endpos or --frames limits. Also move the --ss option to the option struct.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mplayer.c b/mplayer.c
index 0f36247c16..b0c49fcc14 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -282,7 +282,6 @@ static int drop_frame_cnt=0; // total number of dropped frames
static int output_quality=0;
// seek:
-static double seek_to_sec;
static off_t seek_to_byte=0;
static off_t step_sec=0;
@@ -3711,7 +3710,8 @@ static void run_playloop(struct MPContext *mpctx)
edl_update(mpctx);
/* Looping. */
- if (mpctx->stop_play==AT_END_OF_FILE && opts->loop_times>=0) {
+ if (opts->loop_times >= 0 && (mpctx->stop_play == AT_END_OF_FILE ||
+ mpctx->stop_play == PT_NEXT_ENTRY)) {
mp_msg(MSGT_CPLAYER, MSGL_V, "loop_times = %d\n", opts->loop_times);
if (opts->loop_times>1)
@@ -3720,7 +3720,7 @@ static void run_playloop(struct MPContext *mpctx)
opts->loop_times = -1;
play_n_frames = play_n_frames_mf;
mpctx->stop_play = 0;
- queue_seek(mpctx, MPSEEK_ABSOLUTE, 0, 0);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, opts->seek_to_sec, 0);
}
if (mpctx->seek.type) {
@@ -4792,10 +4792,10 @@ if(play_n_frames==0){
mpctx->last_chapter_seek = -1;
// If there's a timeline force an absolute seek to initialize state
-if (seek_to_sec || mpctx->timeline) {
- queue_seek(mpctx, MPSEEK_ABSOLUTE, seek_to_sec, 0);
+if (opts->seek_to_sec || mpctx->timeline) {
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, opts->seek_to_sec, 0);
seek(mpctx, mpctx->seek, false);
- end_at.pos += seek_to_sec;
+ end_at.pos += opts->seek_to_sec;
}
if (opts->chapterrange[0] > 0) {
double pts;