summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-25 13:58:14 +0100
committerwm4 <wm4@nowhere>2015-03-25 13:58:14 +0100
commit83476433b5e98282af170b0be59ed897ea6aedab (patch)
treee0825e59d25b7b86b92688b0239183a8f9cb58b9
parent7977961671dcec91fc69bc9dae4301d64901fb73 (diff)
downloadmpv-83476433b5e98282af170b0be59ed897ea6aedab.tar.bz2
mpv-83476433b5e98282af170b0be59ed897ea6aedab.tar.xz
video: make frame skipping code slightly more readable
-rw-r--r--player/video.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/player/video.c b/player/video.c
index a1cd0ca368..7e50c84513 100644
--- a/player/video.c
+++ b/player/video.c
@@ -639,24 +639,19 @@ static int video_output_image(struct MPContext *mpctx, double endpts)
// Always add these; they make backstepping after seeking faster.
add_frame_pts(mpctx, img->pts);
- bool drop = false;
- if ((endpts != MP_NOPTS_VALUE && img->pts >= endpts) ||
- mpctx->max_frames == 0)
- {
- drop = true;
+ if (endpts != MP_NOPTS_VALUE && img->pts >= endpts) {
r = VD_EOF;
- }
- if (!drop && hrseek && mpctx->hrseek_lastframe) {
+ } else if (mpctx->max_frames == 0) {
+ r = VD_EOF;
+ } else if (hrseek && mpctx->hrseek_lastframe) {
mp_image_setrefp(&mpctx->saved_frame, img);
- drop = true;
- }
- if (hrseek && img->pts < mpctx->hrseek_pts - .005)
- drop = true;
- if (drop) {
- talloc_free(img);
+ } else if (hrseek && img->pts < mpctx->hrseek_pts - .005) {
+ /* just skip */
} else {
add_new_frame(mpctx, img);
+ img = NULL;
}
+ talloc_free(img);
}
}