mirror of https://github.com/mpv-player/mpv
video: make frame skipping code slightly more readable
This commit is contained in:
parent
7977961671
commit
83476433b5
|
@ -639,24 +639,19 @@ static int video_output_image(struct MPContext *mpctx, double endpts)
|
||||||
// Always add these; they make backstepping after seeking faster.
|
// Always add these; they make backstepping after seeking faster.
|
||||||
add_frame_pts(mpctx, img->pts);
|
add_frame_pts(mpctx, img->pts);
|
||||||
|
|
||||||
bool drop = false;
|
if (endpts != MP_NOPTS_VALUE && img->pts >= endpts) {
|
||||||
if ((endpts != MP_NOPTS_VALUE && img->pts >= endpts) ||
|
|
||||||
mpctx->max_frames == 0)
|
|
||||||
{
|
|
||||||
drop = true;
|
|
||||||
r = VD_EOF;
|
r = VD_EOF;
|
||||||
}
|
} else if (mpctx->max_frames == 0) {
|
||||||
if (!drop && hrseek && mpctx->hrseek_lastframe) {
|
r = VD_EOF;
|
||||||
|
} else if (hrseek && mpctx->hrseek_lastframe) {
|
||||||
mp_image_setrefp(&mpctx->saved_frame, img);
|
mp_image_setrefp(&mpctx->saved_frame, img);
|
||||||
drop = true;
|
} else if (hrseek && img->pts < mpctx->hrseek_pts - .005) {
|
||||||
}
|
/* just skip */
|
||||||
if (hrseek && img->pts < mpctx->hrseek_pts - .005)
|
|
||||||
drop = true;
|
|
||||||
if (drop) {
|
|
||||||
talloc_free(img);
|
|
||||||
} else {
|
} else {
|
||||||
add_new_frame(mpctx, img);
|
add_new_frame(mpctx, img);
|
||||||
|
img = NULL;
|
||||||
}
|
}
|
||||||
|
talloc_free(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue