Revision cc826626 libavcodec/dca.c

View differences:

libavcodec/dca.c
285 285
    s->dialog_norm       = get_bits(&s->gb, 4);
286 286

  
287 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 291
#ifdef TRACE
291 292
    av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
......
1143 1144
    }
1144 1145
    //set AVCodec values with parsed data
1145 1146
    avctx->sample_rate = s->sample_rate;
1146
    avctx->channels = 2; //FIXME
1147 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 1166
    if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
1151 1167
        return -1;
1152 1168
    *data_size = 0;

Also available in: Unified diff