summaryrefslogtreecommitdiff
path: root/libavcodec/wmadec.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-10-31 00:07:13 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-10-31 00:07:13 +0000
commit4707cb07e1ceb0d1a518eda08fbf0d4035ea7745 (patch)
tree222acca06d13cf1710e0b39f83e31534a27d392a /libavcodec/wmadec.c
parent0bfacb95dea6a04e4c10a24b9d90c14a401ade67 (diff)
fixed nb_block_sizes detection - fixed codec_id test (avctx->codec_id does not need to be initialized)
Originally committed as revision 1121 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/wmadec.c')
-rw-r--r--libavcodec/wmadec.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index f48f097273..b2288cedca 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -245,7 +245,7 @@ static int wma_decode_init(AVCodecContext * avctx)
s->bit_rate = avctx->bit_rate;
s->block_align = avctx->block_align;
- if (avctx->codec_id == CODEC_ID_WMAV1) {
+ if (avctx->codec->id == CODEC_ID_WMAV1) {
s->version = 1;
} else {
s->version = 2;
@@ -278,7 +278,14 @@ static int wma_decode_init(AVCodecContext * avctx)
}
s->frame_len = 1 << s->frame_len_bits;
if (s->use_variable_block_len) {
- s->nb_block_sizes = s->frame_len_bits - BLOCK_MIN_BITS + 1;
+ int nb_max, nb;
+ nb = ((flags2 >> 3) & 3) + 1;
+ if ((s->bit_rate / s->nb_channels) >= 32000)
+ nb += 2;
+ nb_max = s->frame_len_bits - BLOCK_MIN_BITS;
+ if (nb > nb_max)
+ nb = nb_max;
+ s->nb_block_sizes = nb + 1;
} else {
s->nb_block_sizes = 1;
}
@@ -353,8 +360,8 @@ static int wma_decode_init(AVCodecContext * avctx)
s->block_align);
printf("bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
bps, bps1, high_freq, s->byte_offset_bits);
- printf("use_noise_coding=%d use_exp_vlc=%d\n",
- s->use_noise_coding, s->use_exp_vlc);
+ printf("use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
+ s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes);
#endif
/* compute the scale factor band sizes for each MDCT block size */