diff options
author | wm4 <wm4@nowhere> | 2016-12-21 18:18:24 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-12-21 18:18:24 +0100 |
commit | b1c0bbe8b8b9d25c2682f29af66ad243e0072897 (patch) | |
tree | 73a024a69fdfa3707de4e18962e4e1af02226c6d /player/video.c | |
parent | 1ba352581687548ffc2664b94f831a3dd12d05fa (diff) | |
download | mpv-b1c0bbe8b8b9d25c2682f29af66ad243e0072897.tar.bz2 mpv-b1c0bbe8b8b9d25c2682f29af66ad243e0072897.tar.xz |
video: use demuxer-signaled duration for last video frame
Helps with gif, probably does unwanted things with other formats.
This doesn't handle --end quite correctly, but this could be added
later.
Fixes #3924.
Diffstat (limited to 'player/video.c')
-rw-r--r-- | player/video.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/player/video.c b/player/video.c index 03dd5aeabe..4621d19cb4 100644 --- a/player/video.c +++ b/player/video.c @@ -343,6 +343,7 @@ void reset_video_state(struct MPContext *mpctx) mpctx->delay = 0; mpctx->time_frame = 0; mpctx->video_pts = MP_NOPTS_VALUE; + mpctx->last_frame_duration = 0; mpctx->num_past_frames = 0; mpctx->total_avsync_change = 0; mpctx->last_av_difference = 0; @@ -1369,6 +1370,9 @@ void write_video(struct MPContext *mpctx) { MP_VERBOSE(mpctx, "assuming this is an image\n"); mpctx->time_frame += opts->image_display_duration; + } else if (mpctx->last_frame_duration > 0) { + MP_VERBOSE(mpctx, "using demuxer frame duration for last frame\n"); + mpctx->time_frame += mpctx->last_frame_duration; } else { mpctx->time_frame = 0; } @@ -1482,6 +1486,8 @@ void write_video(struct MPContext *mpctx) mpctx->video_pts = mpctx->next_frames[0]->pts; mpctx->last_vo_pts = mpctx->video_pts; + mpctx->last_frame_duration = + mpctx->next_frames[0]->pkt_duration / mpctx->video_speed; shift_frames(mpctx); |