Commit d0a18850 authored by Nick Brereton's avatar Nick Brereton Committed by Benoit Fouet
Browse files

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
parent 453d28af
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment