comparison dca.c @ 4893:2b3fbf807734 libavcodec

enable multichannel output in dca decoder. reference: Subject: [Ffmpeg-devel] [PATCH] DTS multichannel Date: Wed, 25 Apr 2007 16:25:18 -0400
author jbr
date Wed, 02 May 2007 20:31:32 +0000
parents 9055ed00a295
children 9b2e61b0ec52
comparison
equal deleted inserted replaced
4892:bfb1c49171b6 4893:2b3fbf807734
283 s->front_sum = get_bits(&s->gb, 1); 283 s->front_sum = get_bits(&s->gb, 1);
284 s->surround_sum = get_bits(&s->gb, 1); 284 s->surround_sum = get_bits(&s->gb, 1);
285 s->dialog_norm = get_bits(&s->gb, 4); 285 s->dialog_norm = get_bits(&s->gb, 4);
286 286
287 /* FIXME: channels mixing levels */ 287 /* FIXME: channels mixing levels */
288 s->output = DCA_STEREO; 288 s->output = s->amode;
289 if(s->lfe) s->output |= DCA_LFE;
289 290
290 #ifdef TRACE 291 #ifdef TRACE
291 av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type); 292 av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
292 av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit); 293 av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit);
293 av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present); 294 av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present);
1141 //seems like the frame is corrupt, try with the next one 1142 //seems like the frame is corrupt, try with the next one
1142 return buf_size; 1143 return buf_size;
1143 } 1144 }
1144 //set AVCodec values with parsed data 1145 //set AVCodec values with parsed data
1145 avctx->sample_rate = s->sample_rate; 1146 avctx->sample_rate = s->sample_rate;
1146 avctx->channels = 2; //FIXME
1147 avctx->bit_rate = s->bit_rate; 1147 avctx->bit_rate = s->bit_rate;
1148 1148
1149 channels = dca_channels[s->output]; 1149 channels = s->prim_channels + !!s->lfe;
1150 if(avctx->channels == 0) {
1151 avctx->channels = channels;
1152 } else if(channels < avctx->channels) {
1153 av_log(avctx, AV_LOG_WARNING, "DTS source channels are less than "
1154 "specified: output to %d channels.\n", channels);
1155 avctx->channels = channels;
1156 }
1157 if(avctx->channels == 2) {
1158 s->output = DCA_STEREO;
1159 } else if(avctx->channels != channels) {
1160 av_log(avctx, AV_LOG_ERROR, "Cannot downmix DTS to %d channels.\n",
1161 avctx->channels);
1162 return -1;
1163 }
1164
1165 channels = avctx->channels;
1150 if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) 1166 if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
1151 return -1; 1167 return -1;
1152 *data_size = 0; 1168 *data_size = 0;
1153 for (i = 0; i < (s->sample_blocks / 8); i++) { 1169 for (i = 0; i < (s->sample_blocks / 8); i++) {
1154 dca_decode_block(s); 1170 dca_decode_block(s);