diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-14 02:42:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-14 03:03:56 +0200 |
commit | 7b59217b60cc7133766ea33ee8519efda9ec4c5c (patch) | |
tree | f21017cdab258029829234f5d6471c8d87688eca /libavcodec | |
parent | ed488d1535d9e7b729dda2a6ffe8ecff481dad83 (diff) | |
download | ffmpeg-7b59217b60cc7133766ea33ee8519efda9ec4c5c.tar.gz |
Move WMA case from ff_get_audio_frame_size() to av_get_audio_frame_duration()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4531311f63..b3715a95de 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3310,6 +3310,13 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) if (avctx->frame_size > 1 && frame_bytes) return avctx->frame_size; + //For WMA we currently have no other means to calculate duration thus we + //do it here by assuming CBR, which is true for all known cases. + if (avctx->bit_rate>0 && frame_bytes>0 && avctx->sample_rate>0 && avctx->block_align>1) { + if (avctx->codec_id == AV_CODEC_ID_WMAV1 || avctx->codec_id == AV_CODEC_ID_WMAV2) + return (frame_bytes * 8LL * avctx->sample_rate) / avctx->bit_rate; + } + return 0; } |