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 /video | |
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 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 5 | ||||
-rw-r--r-- | video/mp_image.c | 1 | ||||
-rw-r--r-- | video/mp_image.h | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index cd3c611ebd..78d34bbb47 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -859,6 +859,11 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, mpi->pts = mp_pts_from_av(ctx->pic->pts, &ctx->codec_timebase); mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase); +#if LIBAVCODEC_VERSION_MICRO >= 100 + mpi->pkt_duration = + mp_pts_from_av(av_frame_get_pkt_duration(ctx->pic), &ctx->codec_timebase); +#endif + struct mp_image_params params; update_image_params(vd, ctx->pic, ¶ms); mp_image_set_params(mpi, ¶ms); diff --git a/video/mp_image.c b/video/mp_image.c index ee1ab4104e..2c4627c33e 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -386,6 +386,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src) dst->fields = src->fields; dst->pts = src->pts; dst->dts = src->dts; + dst->pkt_duration = src->pkt_duration; dst->params.rotate = src->params.rotate; dst->params.stereo_in = src->params.stereo_in; dst->params.stereo_out = src->params.stereo_out; diff --git a/video/mp_image.h b/video/mp_image.h index 7c0f7bad7e..6606f19c90 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -85,7 +85,7 @@ typedef struct mp_image { /* only inside filter chain */ double pts; /* only after decoder */ - double dts; + double dts, pkt_duration; /* for private use */ void* priv; |