diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-06 19:15:16 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-01-07 00:55:00 +0100 |
commit | 302d2591dc6bab2561c7fe63e545c7909fecee5f (patch) | |
tree | 1f6f5f9217c27f3bd5ccb1f22cceca742ff4152a /libavformat/utils.c | |
parent | 10ac44198d83dc77d0078af78c0615441c9ce3c2 (diff) | |
download | ffmpeg-302d2591dc6bab2561c7fe63e545c7909fecee5f.tar.gz |
ff_get_audio_frame_size: try to fix wma in wav
Fixes Ticket1905, Ticket2114
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2713e43ac85245805db95048493dde121a20aee7)
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 38be37e779..21f2a0ebb8 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -846,6 +846,13 @@ static int get_audio_frame_size(AVCodecContext *enc, int size, int mux) if (enc->frame_size > 1) return enc->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(!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) { + if (enc->codec_id == AV_CODEC_ID_WMAV1 || enc->codec_id == AV_CODEC_ID_WMAV2) + return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate; + } + return -1; } |