diff options
-rw-r--r-- | player/playloop.c | 5 | ||||
-rw-r--r-- | player/video.c | 32 | ||||
-rw-r--r-- | video/out/vo.c | 5 | ||||
-rw-r--r-- | video/out/vo.h | 1 |
4 files changed, 26 insertions, 17 deletions
diff --git a/player/playloop.c b/player/playloop.c index 56ad70c484..e7637b07f5 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -736,6 +736,8 @@ void add_frame_pts(struct MPContext *mpctx, double pts) mpctx->vo_pts_history_seek_ts++; // mark discontinuity return; } + if (mpctx->vo_pts_history_pts[0] == pts) // may be called multiple times + return; for (int n = MAX_NUM_VO_PTS - 1; n >= 1; n--) { mpctx->vo_pts_history_seek[n] = mpctx->vo_pts_history_seek[n - 1]; mpctx->vo_pts_history_pts[n] = mpctx->vo_pts_history_pts[n - 1]; @@ -1021,9 +1023,6 @@ void run_playloop(struct MPContext *mpctx) video_left = r > 0; - if (mpctx->video_next_pts != MP_NOPTS_VALUE && endpts != MP_NOPTS_VALUE) - video_left &= mpctx->video_next_pts < endpts; - if (r == 2) MP_VERBOSE(mpctx, "frametime=%5.3f\n", frame_time); diff --git a/player/video.c b/player/video.c index 35ad3e7b39..957d4d86ac 100644 --- a/player/video.c +++ b/player/video.c @@ -424,7 +424,8 @@ static void init_vo(struct MPContext *mpctx) // Fill the VO buffer with a newly filtered or decoded image. // Returns: -1: error, 0: EOF, 1: ok or progress was made -static int video_output_image(struct MPContext *mpctx, bool reconfig_ok) +static int video_output_image(struct MPContext *mpctx, double endpts, + bool reconfig_ok) { struct vf_chain *vf = mpctx->d_video->vfilter; struct vo *vo = mpctx->video_out; @@ -439,6 +440,27 @@ static int video_output_image(struct MPContext *mpctx, bool reconfig_ok) if (r < 0) return r; // error + vf_output_frame(vf, false); + if (vf->output) { + double pts = vf->output->pts; + + // Always add these; they make backstepping after seeking faster. + add_frame_pts(mpctx, pts); + + bool drop = false; + if (mpctx->hrseek_active && pts < mpctx->hrseek_pts - .005) + drop = true; + if (endpts != MP_NOPTS_VALUE && pts >= endpts) { + drop = true; + r = 0; // EOF + } + if (drop) { + talloc_free(vf->output); + vf->output = NULL; + return r; + } + } + // Filter output is different from VO input? bool need_vo_reconfig = !vo->params || !mp_image_params_equals(&vf->output_params, vo->params); @@ -496,7 +518,7 @@ int update_video(struct MPContext *mpctx, double endpts, bool reconfig_ok, return 0; } - int r = video_output_image(mpctx, reconfig_ok); + int r = video_output_image(mpctx, endpts, reconfig_ok); if (r < 0) return r; @@ -512,12 +534,6 @@ int update_video(struct MPContext *mpctx, double endpts, bool reconfig_ok, } double pts = vo_get_next_pts(video_out, 0); - if (endpts == MP_NOPTS_VALUE || pts < endpts) - add_frame_pts(mpctx, pts); - if (mpctx->hrseek_active && pts < mpctx->hrseek_pts - .005) { - vo_skip_frame(video_out); - return 1; - } mpctx->hrseek_active = false; double last_pts = mpctx->video_next_pts; if (last_pts == MP_NOPTS_VALUE) diff --git a/video/out/vo.c b/video/out/vo.c index 61143ea340..8cf867ef3b 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -354,11 +354,6 @@ static void shift_queue(struct vo *vo) vo->video_queue[n] = vo->video_queue[n + 1]; } -void vo_skip_frame(struct vo *vo) -{ - shift_queue(vo); -} - void vo_new_frame_imminent(struct vo *vo) { assert(vo->num_video_queue > 0); diff --git a/video/out/vo.h b/video/out/vo.h index fe7fd151e8..1a7fdb4901 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -279,7 +279,6 @@ bool vo_get_want_redraw(struct vo *vo); bool vo_has_next_frame(struct vo *vo, bool eof); double vo_get_next_pts(struct vo *vo, int index); bool vo_needs_new_image(struct vo *vo); -void vo_skip_frame(struct vo *vo); void vo_new_frame_imminent(struct vo *vo); void vo_draw_osd(struct vo *vo, struct osd_state *osd); void vo_flip_page(struct vo *vo, int64_t pts_us, int duration); |