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

{

    AVFrame *decoded_frame, *f;

    int i, ret = 0, 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(ist->dec_ctx, decoded_frame, got_output, pkt);

    if (!*got_output || ret < 0)

        return ret;



    ist->frames_decoded++;



    if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) {

        err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame);

        if (err < 0)

            goto fail;

    }

    ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;



    decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pts,

                                           decoded_frame->pkt_dts);

    if (ist->framerate.num)

        decoded_frame->pts = ist->cfr_next_pts++;



    if (ist->st->sample_aspect_ratio.num)

        decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;



    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;

    }



fail:

    av_frame_unref(ist->filter_frame);

    av_frame_unref(decoded_frame);

    return err < 0 ? err : ret;

}

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

{

    AVFrame *decoded_frame, *f;

    int i, ret = 0, 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(ist->dec_ctx, decoded_frame, got_output, pkt);

    if (!*got_output || ret < 0)

        return ret;



    ist->frames_decoded++;



    if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) {

        err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame);

        if (err < 0)

            goto fail;

    }

    ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;



    decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pts,

                                           decoded_frame->pkt_dts);

    if (ist->framerate.num)

        decoded_frame->pts = ist->cfr_next_pts++;



    if (ist->st->sample_aspect_ratio.num)

        decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;



    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;

    }



fail:

    av_frame_unref(ist->filter_frame);

    av_frame_unref(decoded_frame);

    return err < 0 ? err : ret;

}

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

{

    AVFrame *decoded_frame, *f;

    int VAR_3, VAR_4 = 0, 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(VAR_0->dec_ctx, decoded_frame, VAR_2, VAR_1);

    if (!*VAR_2 || VAR_4 < 0)

        return VAR_4;



    VAR_0->frames_decoded++;



    if (VAR_0->hwaccel_retrieve_data && decoded_frame->format == VAR_0->hwaccel_pix_fmt) {

        VAR_5 = VAR_0->hwaccel_retrieve_data(VAR_0->dec_ctx, decoded_frame);

        if (VAR_5 < 0)

            goto fail;

    }

    VAR_0->hwaccel_retrieved_pix_fmt = decoded_frame->format;



    decoded_frame->pts = guess_correct_pts(&VAR_0->pts_ctx, decoded_frame->pts,

                                           decoded_frame->pkt_dts);

    if (VAR_0->framerate.num)

        decoded_frame->pts = VAR_0->cfr_next_pts++;



    if (VAR_0->st->sample_aspect_ratio.num)

        decoded_frame->sample_aspect_ratio = VAR_0->st->sample_aspect_ratio;



    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;

    }



fail:

    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; int VAR_3, VAR_4 = 0, 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(VAR_0->dec_ctx, decoded_frame, VAR_2, VAR_1); if (!*VAR_2 || VAR_4 < 0)
return VAR_4; VAR_0->frames_decoded++; if (VAR_0->hwaccel_retrieve_data && decoded_frame->format == VAR_0->hwaccel_pix_fmt) { VAR_5 = VAR_0->hwaccel_retrieve_data(VAR_0->dec_ctx, decoded_frame); if (VAR_5 < 0)
goto fail; } VAR_0->hwaccel_retrieved_pix_fmt = decoded_frame->format; decoded_frame->pts = guess_correct_pts(&VAR_0->pts_ctx, decoded_frame->pts,
decoded_frame->pkt_dts); if (VAR_0->framerate.num)
decoded_frame->pts = VAR_0->cfr_next_pts++; if (VAR_0->st->sample_aspect_ratio.num)
decoded_frame->sample_aspect_ratio = VAR_0->st->sample_aspect_ratio; 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; } fail:
av_frame_unref(VAR_0->filter_frame); av_frame_unref(decoded_frame); return VAR_5 < 0 ? VAR_5 : VAR_4; }