[FFmpeg-cvslog] ff_get_audio_frame_size: try to fix wma in wav
Michael Niedermayer
git at videolan.org
Sun Jan 6 19:47:46 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 6 19:15:16 2013 +0100| [2713e43ac85245805db95048493dde121a20aee7] | committer: Michael Niedermayer
ff_get_audio_frame_size: try to fix wma in wav
Fixes Ticket1905, Ticket2114
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2713e43ac85245805db95048493dde121a20aee7
---
libavformat/utils.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cd9ddfe..5cbf7ca 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -831,6 +831,13 @@ int ff_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;
}
More information about the ffmpeg-cvslog
mailing list