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
pull/126/head
Fabrice Bellard 22 years ago
parent 0bfacb95de
commit 4707cb07e1
  1. 15
      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 */

Loading…
Cancel
Save