comparison alsdec.c @ 11071:327019a2d156 libavcodec

Remove unnecessary fields in ALSSpecificConfig.
author thilo.borgmann
date Mon, 01 Feb 2010 09:53:37 +0000
parents 61bf5a551856
children 2d2780630361
comparison
equal deleted inserted replaced
11070:b28afc181754 11071:327019a2d156
146 int chan_config; ///< indicates that a chan_config_info field is present 146 int chan_config; ///< indicates that a chan_config_info field is present
147 int chan_sort; ///< channel rearrangement: 1 = on, 0 = off 147 int chan_sort; ///< channel rearrangement: 1 = on, 0 = off
148 int rlslms; ///< use "Recursive Least Square-Least Mean Square" predictor: 1 = on, 0 = off 148 int rlslms; ///< use "Recursive Least Square-Least Mean Square" predictor: 1 = on, 0 = off
149 int chan_config_info; ///< mapping of channels to loudspeaker locations. Unused until setting channel configuration is implemented. 149 int chan_config_info; ///< mapping of channels to loudspeaker locations. Unused until setting channel configuration is implemented.
150 int *chan_pos; ///< original channel positions 150 int *chan_pos; ///< original channel positions
151 uint32_t header_size; ///< header size of original audio file in bytes, provided for debugging
152 uint32_t trailer_size; ///< trailer size of original audio file in bytes, provided for debugging
153 } ALSSpecificConfig; 151 } ALSSpecificConfig;
154 152
155 153
156 typedef struct { 154 typedef struct {
157 int stop_flag; 155 int stop_flag;
232 dprintf(avctx, "mc_coding = %i\n", sconf->mc_coding); 230 dprintf(avctx, "mc_coding = %i\n", sconf->mc_coding);
233 dprintf(avctx, "chan_config = %i\n", sconf->chan_config); 231 dprintf(avctx, "chan_config = %i\n", sconf->chan_config);
234 dprintf(avctx, "chan_sort = %i\n", sconf->chan_sort); 232 dprintf(avctx, "chan_sort = %i\n", sconf->chan_sort);
235 dprintf(avctx, "RLSLMS = %i\n", sconf->rlslms); 233 dprintf(avctx, "RLSLMS = %i\n", sconf->rlslms);
236 dprintf(avctx, "chan_config_info = %i\n", sconf->chan_config_info); 234 dprintf(avctx, "chan_config_info = %i\n", sconf->chan_config_info);
237 dprintf(avctx, "header_size = %i\n", sconf->header_size);
238 dprintf(avctx, "trailer_size = %i\n", sconf->trailer_size);
239 #endif 235 #endif
240 } 236 }
241 237
242 238
243 /** Reads an ALSSpecificConfig from a buffer into the output struct. 239 /** Reads an ALSSpecificConfig from a buffer into the output struct.
248 uint64_t ht_size; 244 uint64_t ht_size;
249 int i, config_offset, crc_enabled; 245 int i, config_offset, crc_enabled;
250 MPEG4AudioConfig m4ac; 246 MPEG4AudioConfig m4ac;
251 ALSSpecificConfig *sconf = &ctx->sconf; 247 ALSSpecificConfig *sconf = &ctx->sconf;
252 AVCodecContext *avctx = ctx->avctx; 248 AVCodecContext *avctx = ctx->avctx;
253 uint32_t als_id; 249 uint32_t als_id, header_size, trailer_size;
254 250
255 init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); 251 init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
256 252
257 config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata, 253 config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata,
258 avctx->extradata_size); 254 avctx->extradata_size);
331 // read fixed header and trailer sizes, 327 // read fixed header and trailer sizes,
332 // if size = 0xFFFFFFFF then there is no data field! 328 // if size = 0xFFFFFFFF then there is no data field!
333 if (get_bits_left(&gb) < 64) 329 if (get_bits_left(&gb) < 64)
334 return -1; 330 return -1;
335 331
336 sconf->header_size = get_bits_long(&gb, 32); 332 header_size = get_bits_long(&gb, 32);
337 sconf->trailer_size = get_bits_long(&gb, 32); 333 trailer_size = get_bits_long(&gb, 32);
338 if (sconf->header_size == 0xFFFFFFFF) 334 if (header_size == 0xFFFFFFFF)
339 sconf->header_size = 0; 335 header_size = 0;
340 if (sconf->trailer_size == 0xFFFFFFFF) 336 if (trailer_size == 0xFFFFFFFF)
341 sconf->trailer_size = 0; 337 trailer_size = 0;
342 338
343 ht_size = ((int64_t)(sconf->header_size) + (int64_t)(sconf->trailer_size)) << 3; 339 ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3;
344 340
345 341
346 // skip the header and trailer data 342 // skip the header and trailer data
347 if (get_bits_left(&gb) < ht_size) 343 if (get_bits_left(&gb) < ht_size)
348 return -1; 344 return -1;