static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)

{

    AVFrame *decoded_frame, *f;

    AVCodecContext *avctx = ist->dec_ctx;

    int i, ret, err = 0;



    if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    decoded_frame = ist->decoded_frame;



    ret = decode(avctx, decoded_frame, got_output, pkt);

    if (!*got_output || ret < 0)

        return ret;



    ist->samples_decoded += decoded_frame->nb_samples;

    ist->frames_decoded++;



    /* if the decoder provides a pts, use it instead of the last packet pts.

       the decoder could be delaying output by a packet or more. */

    if (decoded_frame->pts != AV_NOPTS_VALUE)

        ist->next_dts = decoded_frame->pts;

    else if (pkt && pkt->pts != AV_NOPTS_VALUE) {

        decoded_frame->pts = pkt->pts;

    }



    if (decoded_frame->pts != AV_NOPTS_VALUE)

        decoded_frame->pts = av_rescale_q(decoded_frame->pts,

                                          ist->st->time_base,

                                          (AVRational){1, avctx->sample_rate});

    ist->nb_samples = decoded_frame->nb_samples;

    for (i = 0; i < ist->nb_filters; i++) {

        if (i < ist->nb_filters - 1) {

            f = ist->filter_frame;

            err = av_frame_ref(f, decoded_frame);

            if (err < 0)

                break;

        } else

            f = decoded_frame;



        err = ifilter_send_frame(ist->filters[i], f);

        if (err < 0)

            break;

    }



    av_frame_unref(ist->filter_frame);

    av_frame_unref(decoded_frame);

    return err < 0 ? err : ret;

}

static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)

{

    AVFrame *decoded_frame, *f;

    AVCodecContext *avctx = ist->dec_ctx;

    int i, ret, err = 0;



    if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    decoded_frame = ist->decoded_frame;



    ret = decode(avctx, decoded_frame, got_output, pkt);

    if (!*got_output || ret < 0)

        return ret;



    ist->samples_decoded += decoded_frame->nb_samples;

    ist->frames_decoded++;



    



    if (decoded_frame->pts != AV_NOPTS_VALUE)

        ist->next_dts = decoded_frame->pts;

    else if (pkt && pkt->pts != AV_NOPTS_VALUE) {

        decoded_frame->pts = pkt->pts;

    }



    if (decoded_frame->pts != AV_NOPTS_VALUE)

        decoded_frame->pts = av_rescale_q(decoded_frame->pts,

                                          ist->st->time_base,

                                          (AVRational){1, avctx->sample_rate});

    ist->nb_samples = decoded_frame->nb_samples;

    for (i = 0; i < ist->nb_filters; i++) {

        if (i < ist->nb_filters - 1) {

            f = ist->filter_frame;

            err = av_frame_ref(f, decoded_frame);

            if (err < 0)

                break;

        } else

            f = decoded_frame;



        err = ifilter_send_frame(ist->filters[i], f);

        if (err < 0)

            break;

    }



    av_frame_unref(ist->filter_frame);

    av_frame_unref(decoded_frame);

    return err < 0 ? err : ret;

}

static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2)

{

    AVFrame *decoded_frame, *f;

    AVCodecContext *avctx = VAR_0->dec_ctx;

    int VAR_3, VAR_4, VAR_5 = 0;



    if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    if (!VAR_0->filter_frame && !(VAR_0->filter_frame = av_frame_alloc()))

        return AVERROR(ENOMEM);

    decoded_frame = VAR_0->decoded_frame;



    VAR_4 = decode(avctx, decoded_frame, VAR_2, VAR_1);

    if (!*VAR_2 || VAR_4 < 0)

        return VAR_4;



    VAR_0->samples_decoded += decoded_frame->nb_samples;

    VAR_0->frames_decoded++;



    



    if (decoded_frame->pts != AV_NOPTS_VALUE)

        VAR_0->next_dts = decoded_frame->pts;

    else if (VAR_1 && VAR_1->pts != AV_NOPTS_VALUE) {

        decoded_frame->pts = VAR_1->pts;

    }



    if (decoded_frame->pts != AV_NOPTS_VALUE)

        decoded_frame->pts = av_rescale_q(decoded_frame->pts,

                                          VAR_0->st->time_base,

                                          (AVRational){1, avctx->sample_rate});

    VAR_0->nb_samples = decoded_frame->nb_samples;

    for (VAR_3 = 0; VAR_3 < VAR_0->nb_filters; VAR_3++) {

        if (VAR_3 < VAR_0->nb_filters - 1) {

            f = VAR_0->filter_frame;

            VAR_5 = av_frame_ref(f, decoded_frame);

            if (VAR_5 < 0)

                break;

        } else

            f = decoded_frame;



        VAR_5 = ifilter_send_frame(VAR_0->filters[VAR_3], f);

        if (VAR_5 < 0)

            break;

    }



    av_frame_unref(VAR_0->filter_frame);

    av_frame_unref(decoded_frame);

    return VAR_5 < 0 ? VAR_5 : VAR_4;

}

static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2)
{ AVFrame *decoded_frame, *f; AVCodecContext *avctx = VAR_0->dec_ctx; int VAR_3, VAR_4, VAR_5 = 0; if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = av_frame_alloc()))
return AVERROR(ENOMEM); if (!VAR_0->filter_frame && !(VAR_0->filter_frame = av_frame_alloc()))
return AVERROR(ENOMEM); decoded_frame = VAR_0->decoded_frame; VAR_4 = decode(avctx, decoded_frame, VAR_2, VAR_1); if (!*VAR_2 || VAR_4 < 0)
return VAR_4; VAR_0->samples_decoded += decoded_frame->nb_samples; VAR_0->frames_decoded++; if (decoded_frame->pts != AV_NOPTS_VALUE)
VAR_0->next_dts = decoded_frame->pts; else if (VAR_1 && VAR_1->pts != AV_NOPTS_VALUE) { decoded_frame->pts = VAR_1->pts; } if (decoded_frame->pts != AV_NOPTS_VALUE)
decoded_frame->pts = av_rescale_q(decoded_frame->pts,
VAR_0->st->time_base,
(AVRational){1, avctx->sample_rate}); VAR_0->nb_samples = decoded_frame->nb_samples; for (VAR_3 = 0; VAR_3 < VAR_0->nb_filters; VAR_3++) { if (VAR_3 < VAR_0->nb_filters - 1) { f = VAR_0->filter_frame; VAR_5 = av_frame_ref(f, decoded_frame); if (VAR_5 < 0)
break; } else f = decoded_frame; VAR_5 = ifilter_send_frame(VAR_0->filters[VAR_3], f); if (VAR_5 < 0)
break; } av_frame_unref(VAR_0->filter_frame); av_frame_unref(decoded_frame); return VAR_5 < 0 ? VAR_5 : VAR_4; }