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 01:05:34 +0100 |
commit | 16b0b75327088ce26bb52931f0c25359b0c65c09 (patch) | |
tree | fa3f0eda5979af3f5564cd54c51801d9e530ab4a | |
parent | d338632e9f8a255e8fc4b6efec1e7f7b65255fd8 (diff) | |
download | ffmpeg-16b0b75327088ce26bb52931f0c25359b0c65c09.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)
-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 7c30fdf061..28ffaaa223 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -815,6 +815,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 == CODEC_ID_WMAV1 || enc->codec_id == CODEC_ID_WMAV2) + return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate; + } + return -1; } |