static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,

                                           AVFrame *frame, int flags)

{

    BufferSourceContext *s = ctx->priv;

    AVFrame *copy;

    int ret;



    if (!frame) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {



    switch (ctx->outputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,

                                 frame->format);

        break;

    case AVMEDIA_TYPE_AUDIO:

        CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,

                                 frame->format);

        break;

    default:

        return AVERROR(EINVAL);

    }



    }



    if (!av_fifo_space(s->fifo) &&

        (ret = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +

                                         sizeof(copy))) < 0)

        return ret;



    if (!(copy = av_frame_alloc()))

        return AVERROR(ENOMEM);

    av_frame_move_ref(copy, frame);



    if ((ret = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) {

        av_frame_move_ref(frame, copy);

        av_frame_free(&copy);

        return ret;

    }



    if ((flags & AV_BUFFERSRC_FLAG_PUSH))

        if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)

            return ret;



    return 0;

}

static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,

                                           AVFrame *frame, int flags)

{

    BufferSourceContext *s = ctx->priv;

    AVFrame *copy;

    int ret;



    if (!frame) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {



    switch (ctx->outputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,

                                 frame->format);

        break;

    case AVMEDIA_TYPE_AUDIO:

        CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,

                                 frame->format);

        break;

    default:

        return AVERROR(EINVAL);

    }



    }



    if (!av_fifo_space(s->fifo) &&

        (ret = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +

                                         sizeof(copy))) < 0)

        return ret;



    if (!(copy = av_frame_alloc()))

        return AVERROR(ENOMEM);

    av_frame_move_ref(copy, frame);



    if ((ret = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) {

        av_frame_move_ref(frame, copy);

        av_frame_free(&copy);

        return ret;

    }



    if ((flags & AV_BUFFERSRC_FLAG_PUSH))

        if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)

            return ret;



    return 0;

}

static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,                                            AVFrame *frame, int flags)
static int FUNC_0(AVFilterContext *VAR_0,

                                           AVFrame *VAR_1, int VAR_2)

{

    BufferSourceContext *s = VAR_0->priv;

    AVFrame *copy;

    int VAR_3;



    if (!VAR_1) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    if (!(VAR_2 & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {



    switch (VAR_0->outputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        CHECK_VIDEO_PARAM_CHANGE(VAR_0, s, VAR_1->width, VAR_1->height,

                                 VAR_1->format);

        break;

    case AVMEDIA_TYPE_AUDIO:

        CHECK_AUDIO_PARAM_CHANGE(VAR_0, s, VAR_1->sample_rate, VAR_1->channel_layout,

                                 VAR_1->format);

        break;

    default:

        return AVERROR(EINVAL);

    }



    }



    if (!av_fifo_space(s->fifo) &&

        (VAR_3 = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +

                                         sizeof(copy))) < 0)

        return VAR_3;



    if (!(copy = av_frame_alloc()))

        return AVERROR(ENOMEM);

    av_frame_move_ref(copy, VAR_1);



    if ((VAR_3 = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) {

        av_frame_move_ref(VAR_1, copy);

        av_frame_free(&copy);

        return VAR_3;

    }



    if ((VAR_2 & AV_BUFFERSRC_FLAG_PUSH))

        if ((VAR_3 = VAR_0->output_pads[0].request_frame(VAR_0->outputs[0])) < 0)

            return VAR_3;



    return 0;

}

static int FUNC_0(AVFilterContext *VAR_0,
AVFrame *VAR_1, int VAR_2)
{ BufferSourceContext *s = VAR_0->priv; AVFrame *copy; int VAR_3; if (!VAR_1) { s->eof = 1; return 0; } else if (s->eof) return AVERROR(EINVAL); if (!(VAR_2 & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) { switch (VAR_0->outputs[0]->type) { case AVMEDIA_TYPE_VIDEO:
CHECK_VIDEO_PARAM_CHANGE(VAR_0, s, VAR_1->width, VAR_1->height,
VAR_1->format); break; case AVMEDIA_TYPE_AUDIO:
CHECK_AUDIO_PARAM_CHANGE(VAR_0, s, VAR_1->sample_rate, VAR_1->channel_layout,
VAR_1->format); break; default:
return AVERROR(EINVAL); } } if (!av_fifo_space(s->fifo) &&
(VAR_3 = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +
sizeof(copy))) < 0)
return VAR_3; if (!(copy = av_frame_alloc()))
return AVERROR(ENOMEM); av_frame_move_ref(copy, VAR_1); if ((VAR_3 = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) { av_frame_move_ref(VAR_1, copy); av_frame_free(&copy); return VAR_3; } if ((VAR_2 & AV_BUFFERSRC_FLAG_PUSH))
if ((VAR_3 = VAR_0->output_pads[0].request_frame(VAR_0->outputs[0])) < 0)
return VAR_3; return 0; }