diff options
author | wm4 <wm4@nowhere> | 2013-02-03 20:49:35 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-02-03 21:08:26 +0100 |
commit | cd08785aab520dcdeb444998c404bd9e31ad6d07 (patch) | |
tree | 1dc098aa9d5f6149830200e8ae60ef8f1a665336 /core | |
parent | d302ac285f9c5ada104c23ba5c31ddc24f5ab560 (diff) | |
download | mpv-cd08785aab520dcdeb444998c404bd9e31ad6d07.tar.bz2 mpv-cd08785aab520dcdeb444998c404bd9e31ad6d07.tar.xz |
mplayer: properly handle framestep when showing last video frame
When doing a framestep while there is no more video, nothing happened,
and audio continued to play. When advancing to the next file, the player
was paused. Fix it so that it always pauses (except on very low frame
rate video, which is yet another corner case).
We also change the meaning of framestepping a bit: in audio only mode,
framstepping unpauses for a single playloop iteration. This is probably
not useful at all, but makes the code a bit more simpler/uniform.
Just like the previous commit, this matters most for audio files with
cover art, for which this special case is the normal case.
Diffstat (limited to 'core')
-rw-r--r-- | core/mplayer.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/mplayer.c b/core/mplayer.c index 6d0405620b..44bfc81e3b 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2741,6 +2741,7 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao, bool reset_ac) mpctx->hrseek_active = false; mpctx->hrseek_framedrop = false; mpctx->total_avsync_change = 0; + mpctx->step_frames = 0; drop_frame_cnt = 0; #ifdef CONFIG_ENCODING @@ -3200,6 +3201,7 @@ static void run_playloop(struct MPContext *mpctx) bool end_is_chapter = false; double sleeptime = get_wakeup_period(mpctx); bool was_restart = mpctx->restart_playback; + bool new_video_frame_shown = false; #ifdef CONFIG_ENCODING if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) { @@ -3226,11 +3228,6 @@ static void run_playloop(struct MPContext *mpctx) mpctx->stop_play = PT_NEXT_ENTRY; } - if (mpctx->step_frames && !mpctx->sh_video) { - mpctx->step_frames = 0; - pause_player(mpctx); - } - if (mpctx->sh_audio && !mpctx->restart_playback && !mpctx->ao->untimed) { int status = fill_audio_out_buffers(mpctx, endpts); full_audio_buffers = status >= 0; @@ -3394,20 +3391,25 @@ static void run_playloop(struct MPContext *mpctx) update_avsync(mpctx); print_status(mpctx); screenshot_flip(mpctx); + new_video_frame_shown = true; if (play_n_frames >= 0) { --play_n_frames; if (play_n_frames <= 0) mpctx->stop_play = PT_NEXT_ENTRY; } - if (mpctx->step_frames > 0) { - mpctx->step_frames--; - if (mpctx->step_frames == 0) - pause_player(mpctx); - } break; } // video + if (mpctx->step_frames > 0 && !mpctx->paused) { + // If no more video is available, one frame means one playloop iteration. + // Otherwise, one frame means one video frame. + if (!video_left || new_video_frame_shown) + mpctx->step_frames--; + if (mpctx->step_frames == 0) + pause_player(mpctx); + } + if (mpctx->sh_audio && (mpctx->restart_playback ? !video_left : mpctx->ao->untimed && (mpctx->delay <= 0 || !video_left))) { |