int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,

                         int *frame_size_ptr,

                         uint8_t *buf, int buf_size)

{

    int ret;



    //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough

    if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){

        av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");

        return -1;

    }

    if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||

       *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) ||

       *frame_size_ptr < buf_size){

        av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);

        return -1;

    }

    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){

        ret = avctx->codec->decode(avctx, samples, frame_size_ptr,

                                buf, buf_size);

        avctx->frame_number++;

    }else{

        ret= 0;

        *frame_size_ptr=0;

    }

    return ret;

}

int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,

                         int *frame_size_ptr,

                         uint8_t *buf, int buf_size)

{

    int ret;



    

    if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){

        av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");

        return -1;

    }

    if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||

       *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) ||

       *frame_size_ptr < buf_size){

        av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);

        return -1;

    }

    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){

        ret = avctx->codec->decode(avctx, samples, frame_size_ptr,

                                buf, buf_size);

        avctx->frame_number++;

    }else{

        ret= 0;

        *frame_size_ptr=0;

    }

    return ret;

}

int FUNC_0(AVCodecContext *VAR_0, int16_t *VAR_1,

                         int *VAR_2,

                         uint8_t *VAR_3, int VAR_4)

{

    int VAR_5;



    

    if(*VAR_2 < AVCODEC_MAX_AUDIO_FRAME_SIZE){

        av_log(VAR_0, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");

        return -1;

    }

    if(*VAR_2 < FF_MIN_BUFFER_SIZE ||

       *VAR_2 < VAR_0->channels * VAR_0->frame_size * sizeof(int16_t) ||

       *VAR_2 < VAR_4){

        av_log(VAR_0, AV_LOG_ERROR, "buffer %d too small\n", *VAR_2);

        return -1;

    }

    if((VAR_0->codec->capabilities & CODEC_CAP_DELAY) || VAR_4){

        VAR_5 = VAR_0->codec->decode(VAR_0, VAR_1, VAR_2,

                                VAR_3, VAR_4);

        VAR_0->frame_number++;

    }else{

        VAR_5= 0;

        *VAR_2=0;

    }

    return VAR_5;

}

int FUNC_0(AVCodecContext *VAR_0, int16_t *VAR_1,
int *VAR_2,
uint8_t *VAR_3, int VAR_4)
{ int VAR_5; if(*VAR_2 < AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(VAR_0, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n"); return -1; } if(*VAR_2 < FF_MIN_BUFFER_SIZE ||
*VAR_2 < VAR_0->channels * VAR_0->frame_size * sizeof(int16_t) ||
*VAR_2 < VAR_4){ av_log(VAR_0, AV_LOG_ERROR, "buffer %d too small\n", *VAR_2); return -1; } if((VAR_0->codec->capabilities & CODEC_CAP_DELAY) || VAR_4){ VAR_5 = VAR_0->codec->decode(VAR_0, VAR_1, VAR_2,
VAR_3, VAR_4); VAR_0->frame_number++; }else{ VAR_5= 0; *VAR_2=0; } return VAR_5; }