static int decode_init_mp3on4(AVCodecContext * avctx)

{

    MP3On4DecodeContext *s = avctx->priv_data;

    int i;



    if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {

        av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");

        return -1;

    }



    s->chan_cfg = (((unsigned char *)avctx->extradata)[1] >> 3) & 0x0f;

    s->frames = mp3Frames[s->chan_cfg];

    if(!s->frames) {

        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");

        return -1;

    }

    avctx->channels = mp3Channels[s->chan_cfg];



    /* Init the first mp3 decoder in standard way, so that all tables get builded

     * We replace avctx->priv_data with the context of the first decoder so that

     * decode_init() does not have to be changed.

     * Other decoders will be inited here copying data from the first context

     */

    // Allocate zeroed memory for the first decoder context

    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));

    // Put decoder context in place to make init_decode() happy

    avctx->priv_data = s->mp3decctx[0];

    decode_init(avctx);

    // Restore mp3on4 context pointer

    avctx->priv_data = s;

    s->mp3decctx[0]->adu_mode = 1; // Set adu mode



    /* Create a separate codec/context for each frame (first is already ok).

     * Each frame is 1 or 2 channels - up to 5 frames allowed

     */

    for (i = 1; i < s->frames; i++) {

        s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext));

        s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias;

        s->mp3decctx[i]->adu_mode = 1;

        s->mp3decctx[i]->avctx = avctx;

    }



    return 0;

}

static int decode_init_mp3on4(AVCodecContext * avctx)

{

    MP3On4DecodeContext *s = avctx->priv_data;

    int i;



    if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {

        av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");

        return -1;

    }



    s->chan_cfg = (((unsigned char *)avctx->extradata)[1] >> 3) & 0x0f;

    s->frames = mp3Frames[s->chan_cfg];

    if(!s->frames) {

        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");

        return -1;

    }

    avctx->channels = mp3Channels[s->chan_cfg];



    









    

    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));

    

    avctx->priv_data = s->mp3decctx[0];

    decode_init(avctx);

    

    avctx->priv_data = s;

    s->mp3decctx[0]->adu_mode = 1; 



    





    for (i = 1; i < s->frames; i++) {

        s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext));

        s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias;

        s->mp3decctx[i]->adu_mode = 1;

        s->mp3decctx[i]->avctx = avctx;

    }



    return 0;

}

static int FUNC_0(AVCodecContext * VAR_0)

{

    MP3On4DecodeContext *s = VAR_0->priv_data;

    int VAR_1;



    if ((VAR_0->extradata_size < 2) || (VAR_0->extradata == NULL)) {

        av_log(VAR_0, AV_LOG_ERROR, "Codec extradata missing or too short.\n");

        return -1;

    }



    s->chan_cfg = (((unsigned char *)VAR_0->extradata)[1] >> 3) & 0x0f;

    s->frames = mp3Frames[s->chan_cfg];

    if(!s->frames) {

        av_log(VAR_0, AV_LOG_ERROR, "Invalid channel config number.\n");

        return -1;

    }

    VAR_0->channels = mp3Channels[s->chan_cfg];



    









    

    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));

    

    VAR_0->priv_data = s->mp3decctx[0];

    decode_init(VAR_0);

    

    VAR_0->priv_data = s;

    s->mp3decctx[0]->adu_mode = 1; 



    





    for (VAR_1 = 1; VAR_1 < s->frames; VAR_1++) {

        s->mp3decctx[VAR_1] = av_mallocz(sizeof(MPADecodeContext));

        s->mp3decctx[VAR_1]->compute_antialias = s->mp3decctx[0]->compute_antialias;

        s->mp3decctx[VAR_1]->adu_mode = 1;

        s->mp3decctx[VAR_1]->VAR_0 = VAR_0;

    }



    return 0;

}

static int FUNC_0(AVCodecContext * VAR_0)
{ MP3On4DecodeContext *s = VAR_0->priv_data; int VAR_1; if ((VAR_0->extradata_size < 2) || (VAR_0->extradata == NULL)) { av_log(VAR_0, AV_LOG_ERROR, "Codec extradata missing or too short.\n"); return -1; } s->chan_cfg = (((unsigned char *)VAR_0->extradata)[1] >> 3) & 0x0f; s->frames = mp3Frames[s->chan_cfg]; if(!s->frames) { av_log(VAR_0, AV_LOG_ERROR, "Invalid channel config number.\n"); return -1; } VAR_0->channels = mp3Channels[s->chan_cfg]; s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext)); VAR_0->priv_data = s->mp3decctx[0]; decode_init(VAR_0); VAR_0->priv_data = s; s->mp3decctx[0]->adu_mode = 1; for (VAR_1 = 1; VAR_1 < s->frames; VAR_1++) { s->mp3decctx[VAR_1] = av_mallocz(sizeof(MPADecodeContext)); s->mp3decctx[VAR_1]->compute_antialias = s->mp3decctx[0]->compute_antialias; s->mp3decctx[VAR_1]->adu_mode = 1; s->mp3decctx[VAR_1]->VAR_0 = VAR_0; } return 0; }