diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-04-04 12:47:44 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-10-15 06:37:43 +0000 |
commit | 7ea1b3472a61de4aa4d41b571e99418e4997ad41 (patch) | |
tree | fcf38bb7d5d1f770f1e4b8fea256fa6c45313add /libavcodec/mpegvideo_parser.c | |
parent | d565fef1b83b6c5f8afb32229260b79f67c68109 (diff) | |
download | ffmpeg-7ea1b3472a61de4aa4d41b571e99418e4997ad41.tar.gz |
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.
Diffstat (limited to 'libavcodec/mpegvideo_parser.c')
-rw-r--r-- | libavcodec/mpegvideo_parser.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index bec1b36975..d657818911 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -66,8 +66,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, did_set_size=1; } frame_rate_index = buf[3] & 0xf; - pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num; - pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den; + pc->frame_rate = avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_index]; avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400; avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; } @@ -91,8 +90,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, avctx->bit_rate += (bit_rate_ext << 18) * 400; if(did_set_size) ff_set_dimensions(avctx, pc->width, pc->height); - avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2; - avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); + avctx->framerate.num = pc->frame_rate.num * (frame_rate_ext_n + 1) * 2; + avctx->framerate.den = pc->frame_rate.den * (frame_rate_ext_d + 1); avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO; } break; @@ -139,6 +138,10 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, } } the_end: ; +#if FF_API_AVCTX_TIMEBASE + if (avctx->framerate.num) + avctx->time_base = av_inv_q(avctx->framerate); +#endif } static int mpegvideo_parse(AVCodecParserContext *s, |