From 05e4df3f0c7679e8ac3b32a1a414be751b6b6b37 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 19 Aug 2016 14:19:46 +0200 Subject: video/audio: always provide "proper" timestamps to libavcodec Instead of passing through double float timestamps opaquely, pass real timestamps. Do so by always setting a valid timebase on the AVCodecContext for audio and video decoding. Specifically try not to round timestamps to a too coarse timebase, which could round off small adjustments to timestamps (such as for start time rebasing or demux_timeline). If the timebase is considered too coarse, make it finer. This gets rid of the need to do this specifically for some hardware decoding wrapper. The old method of passing through double timestamps was also a bit questionable. While libavcodec is not supposed to interpret timestamps at all if no timebase is provided, it was needlessly tricky. Also, it actually does compare them with AV_NOPTS_VALUE. This change will probably also reduce confusion in the future. --- common/av_common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'common/av_common.h') diff --git a/common/av_common.h b/common/av_common.h index e2b86bfe40..4b13dcdd0c 100644 --- a/common/av_common.h +++ b/common/av_common.h @@ -33,6 +33,7 @@ struct mp_log; int mp_lavc_set_extradata(AVCodecContext *avctx, void *ptr, int size); void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st); void mp_set_lav_codec_headers(AVCodecContext *avctx, struct mp_codec_params *c); +AVRational mp_get_codec_timebase(struct mp_codec_params *c); void mp_set_av_packet(AVPacket *dst, struct demux_packet *mpkt, AVRational *tb); int64_t mp_pts_to_av(double mp_pts, AVRational *tb); double mp_pts_from_av(int64_t av_pts, AVRational *tb); -- cgit v1.2.3