From 7ea1b3472a61de4aa4d41b571e99418e4997ad41 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 4 Apr 2014 12:47:44 +0200 Subject: lavc: deprecate the use of AVCodecContext.time_base for decoding When decoding, this field holds the inverse of the framerate that can be written in the headers for some codecs. Using a field called 'time_base' for this is very misleading, as there are no timestamps associated with it. Furthermore, this field is used for a very different purpose during encoding. Add a new field, called 'framerate', to replace the use of time_base for decoding. --- libavcodec/utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libavcodec/utils.c') diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b28a659f0a..d500083bbf 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1262,6 +1262,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code ret = AVERROR(EINVAL); goto free_and_end; } + +#if FF_API_AVCTX_TIMEBASE + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) + avctx->time_base = av_inv_q(avctx->framerate); +#endif } end: entangled_thread_counter--; @@ -1674,6 +1679,11 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi } else ret = 0; +#if FF_API_AVCTX_TIMEBASE + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) + avctx->time_base = av_inv_q(avctx->framerate); +#endif + return ret; } -- cgit v1.2.3