mirror of
https://github.com/mpv-player/mpv
synced 2025-02-18 13:47:04 +00:00
video: if hr-seek goes past last frame, seek to last frame
This gives much better behavior in general, and is what we want if video somehow ends earlier than audio. A common special is using an audio file with an external image file. This commit makes things like switching aspect ratio work (provided the demuxer for the image behaves correctly, which currently isn't the case with demux_mf.c). Since the image file had timestamp 0, it was usually skipped by hr-seek, and changed properties weren't applied to it at the start of the filter chain.
This commit is contained in:
parent
ba6ba32825
commit
6bcda94cbc
@ -494,12 +494,11 @@ static int video_output_image(struct MPContext *mpctx)
|
||||
mp_pin_out_unread(vo_c->filter->f->pins[1], frame);
|
||||
img = NULL;
|
||||
r = VD_EOF;
|
||||
} else if (hrseek && mpctx->hrseek_lastframe) {
|
||||
} else if (hrseek && (img->pts < mpctx->hrseek_pts - .005 ||
|
||||
mpctx->hrseek_lastframe))
|
||||
{
|
||||
/* just skip - but save in case it was the last frame */
|
||||
mp_image_setrefp(&mpctx->saved_frame, img);
|
||||
} else if (hrseek && img->pts < mpctx->hrseek_pts - .005) {
|
||||
/* just skip - but save if backstep active */
|
||||
if (mpctx->hrseek_backstep)
|
||||
mp_image_setrefp(&mpctx->saved_frame, img);
|
||||
} else if (mpctx->video_status == STATUS_SYNCING &&
|
||||
mpctx->playback_pts != MP_NOPTS_VALUE &&
|
||||
img->pts < mpctx->playback_pts && !vo_c->is_coverart)
|
||||
@ -522,8 +521,8 @@ static int video_output_image(struct MPContext *mpctx)
|
||||
}
|
||||
}
|
||||
|
||||
// Last-frame seek
|
||||
if (r <= 0 && hrseek && mpctx->hrseek_lastframe && mpctx->saved_frame) {
|
||||
// If hr-seek went past EOF, use the last frame.
|
||||
if (r <= 0 && hrseek && mpctx->saved_frame && r == VD_EOF) {
|
||||
add_new_frame(mpctx, mpctx->saved_frame);
|
||||
mpctx->saved_frame = NULL;
|
||||
r = VD_PROGRESS;
|
||||
|
Loading…
Reference in New Issue
Block a user