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/mpeg4videodec.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/mpeg4videodec.c')
-rw-r--r-- | libavcodec/mpeg4videodec.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 3adf0cf44e..ff3782647d 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1722,23 +1722,22 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) check_marker(gb, "before time_increment_resolution"); - s->avctx->time_base.den = get_bits(gb, 16); - if (!s->avctx->time_base.den) { - av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n"); - s->avctx->time_base.num = 0; + s->avctx->framerate.num = get_bits(gb, 16); + if (!s->avctx->framerate.num) { + av_log(s->avctx, AV_LOG_ERROR, "framerate==0\n"); return -1; } - ctx->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; + ctx->time_increment_bits = av_log2(s->avctx->framerate.num - 1) + 1; if (ctx->time_increment_bits < 1) ctx->time_increment_bits = 1; check_marker(gb, "before fixed_vop_rate"); if (get_bits1(gb) != 0) /* fixed_vop_rate */ - s->avctx->time_base.num = get_bits(gb, ctx->time_increment_bits); + s->avctx->framerate.den = get_bits(gb, ctx->time_increment_bits); else - s->avctx->time_base.num = 1; + s->avctx->framerate.den = 1; ctx->t_frame = 0; @@ -2126,19 +2125,19 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) if (s->pict_type != AV_PICTURE_TYPE_B) { s->last_time_base = s->time_base; s->time_base += time_incr; - s->time = s->time_base * s->avctx->time_base.den + time_increment; + s->time = s->time_base * s->avctx->framerate.num + time_increment; if (s->workaround_bugs & FF_BUG_UMP4) { if (s->time < s->last_non_b_time) { /* header is not mpeg-4-compatible, broken encoder, * trying to workaround */ s->time_base++; - s->time += s->avctx->time_base.den; + s->time += s->avctx->framerate.num; } } s->pp_time = s->time - s->last_non_b_time; s->last_non_b_time = s->time; } else { - s->time = (s->last_time_base + time_incr) * s->avctx->time_base.den + time_increment; + s->time = (s->last_time_base + time_incr) * s->avctx->framerate.num + time_increment; s->pb_time = s->pp_time - (s->last_non_b_time - s->time); if (s->pp_time <= s->pb_time || s->pp_time <= s->pp_time - s->pb_time || |