Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 1780:cc4c1eb18eec libavcodec
fixes by Gildas Bazin <gbazin at altern dot org>
author | michael |
---|---|
date | Wed, 04 Feb 2004 15:49:55 +0000 |
parents | 1532ff770277 |
children | 5cde80c5d929 |
comparison
equal
deleted
inserted
replaced
1779:9848ca4ad861 | 1780:cc4c1eb18eec |
---|---|
1229 /* useful helper to get mpeg audio stream infos. Return -1 if error in | 1229 /* useful helper to get mpeg audio stream infos. Return -1 if error in |
1230 header, otherwise the coded frame size in bytes */ | 1230 header, otherwise the coded frame size in bytes */ |
1231 int mpa_decode_header(AVCodecContext *avctx, uint32_t head) | 1231 int mpa_decode_header(AVCodecContext *avctx, uint32_t head) |
1232 { | 1232 { |
1233 MPADecodeContext s1, *s = &s1; | 1233 MPADecodeContext s1, *s = &s1; |
1234 memset( s, 0, sizeof(MPADecodeContext) ); | |
1234 | 1235 |
1235 if (check_header(head) != 0) | 1236 if (check_header(head) != 0) |
1236 return -1; | 1237 return -1; |
1237 | 1238 |
1238 if (decode_header(s, head) != 0) { | 1239 if (decode_header(s, head) != 0) { |
1371 bound = (s->mode_ext + 1) * 4; | 1372 bound = (s->mode_ext + 1) * 4; |
1372 else | 1373 else |
1373 bound = sblimit; | 1374 bound = sblimit; |
1374 | 1375 |
1375 dprintf("bound=%d sblimit=%d\n", bound, sblimit); | 1376 dprintf("bound=%d sblimit=%d\n", bound, sblimit); |
1377 | |
1378 /* sanity check */ | |
1379 if( bound > sblimit ) bound = sblimit; | |
1380 | |
1376 /* parse bit allocation */ | 1381 /* parse bit allocation */ |
1377 j = 0; | 1382 j = 0; |
1378 for(i=0;i<bound;i++) { | 1383 for(i=0;i<bound;i++) { |
1379 bit_alloc_bits = alloc_table[j]; | 1384 bit_alloc_bits = alloc_table[j]; |
1380 for(ch=0;ch<s->nb_channels;ch++) { | 1385 for(ch=0;ch<s->nb_channels;ch++) { |