aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/dca.c
diff options
context:
space:
mode:
authorNick Brereton2010-07-12 09:00:17 +0000
committerBenoit Fouet2010-07-12 09:00:17 +0000
commitd0a188501899a5aa613a950354caa9e15cb3ea35 (patch)
tree6b04b8cdabb153bb3e64448b01aa3e106d1a182d /libavcodec/dca.c
parent453d28af601ec9cab3d03a89a380f647188cc3dd (diff)
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
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r--libavcodec/dca.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 7deb284481..073b1c2386 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -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) {