mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
d302ac285f
commit
cd08785aab
|
@ -2741,6 +2741,7 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao, bool reset_ac)
|
||||||
mpctx->hrseek_active = false;
|
mpctx->hrseek_active = false;
|
||||||
mpctx->hrseek_framedrop = false;
|
mpctx->hrseek_framedrop = false;
|
||||||
mpctx->total_avsync_change = 0;
|
mpctx->total_avsync_change = 0;
|
||||||
|
mpctx->step_frames = 0;
|
||||||
drop_frame_cnt = 0;
|
drop_frame_cnt = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_ENCODING
|
#ifdef CONFIG_ENCODING
|
||||||
|
@ -3200,6 +3201,7 @@ static void run_playloop(struct MPContext *mpctx)
|
||||||
bool end_is_chapter = false;
|
bool end_is_chapter = false;
|
||||||
double sleeptime = get_wakeup_period(mpctx);
|
double sleeptime = get_wakeup_period(mpctx);
|
||||||
bool was_restart = mpctx->restart_playback;
|
bool was_restart = mpctx->restart_playback;
|
||||||
|
bool new_video_frame_shown = false;
|
||||||
|
|
||||||
#ifdef CONFIG_ENCODING
|
#ifdef CONFIG_ENCODING
|
||||||
if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) {
|
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;
|
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) {
|
if (mpctx->sh_audio && !mpctx->restart_playback && !mpctx->ao->untimed) {
|
||||||
int status = fill_audio_out_buffers(mpctx, endpts);
|
int status = fill_audio_out_buffers(mpctx, endpts);
|
||||||
full_audio_buffers = status >= 0;
|
full_audio_buffers = status >= 0;
|
||||||
|
@ -3394,20 +3391,25 @@ static void run_playloop(struct MPContext *mpctx)
|
||||||
update_avsync(mpctx);
|
update_avsync(mpctx);
|
||||||
print_status(mpctx);
|
print_status(mpctx);
|
||||||
screenshot_flip(mpctx);
|
screenshot_flip(mpctx);
|
||||||
|
new_video_frame_shown = true;
|
||||||
|
|
||||||
if (play_n_frames >= 0) {
|
if (play_n_frames >= 0) {
|
||||||
--play_n_frames;
|
--play_n_frames;
|
||||||
if (play_n_frames <= 0)
|
if (play_n_frames <= 0)
|
||||||
mpctx->stop_play = PT_NEXT_ENTRY;
|
mpctx->stop_play = PT_NEXT_ENTRY;
|
||||||
}
|
}
|
||||||
if (mpctx->step_frames > 0) {
|
|
||||||
mpctx->step_frames--;
|
|
||||||
if (mpctx->step_frames == 0)
|
|
||||||
pause_player(mpctx);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
} // video
|
} // 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 :
|
if (mpctx->sh_audio && (mpctx->restart_playback ? !video_left :
|
||||||
mpctx->ao->untimed && (mpctx->delay <= 0 ||
|
mpctx->ao->untimed && (mpctx->delay <= 0 ||
|
||||||
!video_left))) {
|
!video_left))) {
|
||||||
|
|
Loading…
Reference in New Issue