aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-06 19:15:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-06 19:46:04 +0100
commit2713e43ac85245805db95048493dde121a20aee7 (patch)
tree4b1bbb03e56b202a1bb519e99094ec573eb0de29 /libavformat
parentb3d814753c25892e63954ca782883feebf1d3877 (diff)
downloadffmpeg-2713e43ac85245805db95048493dde121a20aee7.tar.gz
ff_get_audio_frame_size: try to fix wma in wav
Fixes Ticket1905, Ticket2114 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cd9ddfe5a7..5cbf7ca7af 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;
}