1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Move XCH parameters into context structure.

Patch by Nick Brereton $name AT n$surname DOT net

Originally committed as revision 24209 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Nick Brereton 2010-07-12 09:00:17 +00:00 committed by Benoit Fouet
parent 453d28af60
commit d0a1885018

View File

@ -288,6 +288,10 @@ typedef struct {
int current_subframe;
int current_subsubframe;
/* XCh extension information */
int xch_present;
int xch_base_channel; ///< index of first (only) channel containing XCH data
int debug_flag; ///< used for suppressing repeated error messages output
DSPContext dsp;
FFTContext imdct;
@ -1260,12 +1264,12 @@ static int dca_decode_frame(AVCodecContext * avctx,
int lfe_samples;
int num_core_channels = 0;
int i;
int xch_present = 0;
int16_t *samples = data;
DCAContext *s = avctx->priv_data;
int channels;
s->xch_present = 0;
s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE);
if (s->dca_buffer_size == -1) {
av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
@ -1297,9 +1301,10 @@ static int dca_decode_frame(AVCodecContext * avctx,
switch(bits) {
case 0x5a5a5a5a: {
int ext_base_ch = s->prim_channels;
int ext_amode, xch_fsize;
s->xch_base_channel = s->prim_channels;
/* validate sync word using XCHFSIZE field */
xch_fsize = show_bits(&s->gb, 10);
if((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) &&
@ -1318,13 +1323,13 @@ static int dca_decode_frame(AVCodecContext * avctx,
}
/* much like core primary audio coding header */
dca_parse_audio_coding_header(s, ext_base_ch);
dca_parse_audio_coding_header(s, s->xch_base_channel);
for (i = 0; i < (s->sample_blocks / 8); i++) {
dca_decode_block(s, ext_base_ch, i);
dca_decode_block(s, s->xch_base_channel, i);
}
xch_present = 1;
s->xch_present = 1;
break;
}
case 0x1d95f262:
@ -1342,7 +1347,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
if (s->amode<16) {
avctx->channel_layout = dca_core_channel_layout[s->amode];
if (xch_present && (!avctx->request_channels ||
if (s->xch_present && (!avctx->request_channels ||
avctx->request_channels > num_core_channels)) {
avctx->channel_layout |= CH_BACK_CENTER;
if (s->lfe) {