Move WMA case from ff_get_audio_frame_size() to av_get_audio_frame_duration()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
ed488d1535
commit
7b59217b60
2 changed files with 8 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue