Revision 0d5b2eb4

View differences:

libavcodec/mpegaudiodec.c
2472 2472
 */
2473 2473
typedef struct MP3On4DecodeContext {
2474 2474
    int frames;   ///< number of mp3 frames per block (number of mp3 decoder instances)
2475
    int chan_cfg; ///< channel config number
2476 2475
    int syncword; ///< syncword patch
2476
    const uint8_t *coff; ///< channels offsets in output buffer
2477 2477
    MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance
2478 2478
} MP3On4DecodeContext;
2479 2479

  
......
2510 2510
        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
2511 2511
        return -1;
2512 2512
    }
2513
    s->chan_cfg = cfg.chan_config;
2514
    s->frames = mp3Frames[s->chan_cfg];
2515
    avctx->channels = ff_mpeg4audio_channels[s->chan_cfg];
2513
    s->frames = mp3Frames[cfg.chan_config];
2514
    s->coff = chan_offset[cfg.chan_config];
2515
    avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
2516 2516

  
2517 2517
    if (cfg.sample_rate < 16000)
2518 2518
        s->syncword = 0xffe00000;
......
2574 2574
    int fsize;
2575 2575
    int fr, i, j, n;
2576 2576
    int off = avctx->channels;
2577
    const uint8_t *coff = chan_offset[s->chan_cfg];
2578 2577

  
2579 2578
    len = buf_size;
2580 2579

  
......
2607 2606
        if(s->frames > 1) {
2608 2607
            n = m->avctx->frame_size*m->nb_channels;
2609 2608
            /* interleave output data */
2610
            bp = out_samples + coff[fr];
2609
            bp = out_samples + s->coff[fr];
2611 2610
            if(m->nb_channels == 1) {
2612 2611
                for(j = 0; j < n; j++) {
2613 2612
                    *bp = decoded_buf[j];

Also available in: Unified diff