int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)

{

    BufferSourceContext *s = ctx->priv;

    AVFrame *copy;

    int ret;



    if (!frame) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    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;

    }



    return 0;

}

int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)

{

    BufferSourceContext *s = ctx->priv;

    AVFrame *copy;

    int ret;



    if (!frame) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    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;

    }



    return 0;

}

int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1)

{

    BufferSourceContext *s = VAR_0->priv;

    AVFrame *copy;

    int VAR_2;



    if (!VAR_1) {

        s->eof = 1;

        return 0;

    } else if (s->eof)

        return AVERROR(EINVAL);



    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_2 = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +

                                         sizeof(copy))) < 0)

        return VAR_2;



    if (!(copy = av_frame_alloc()))

        return AVERROR(ENOMEM);

    av_frame_move_ref(copy, VAR_1);



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

        av_frame_move_ref(VAR_1, copy);

        av_frame_free(&copy);

        return VAR_2;

    }



    return 0;

}

int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1)
{ BufferSourceContext *s = VAR_0->priv; AVFrame *copy; int VAR_2; if (!VAR_1) { s->eof = 1; return 0; } else if (s->eof) return AVERROR(EINVAL); 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_2 = av_fifo_realloc2(s->fifo, av_fifo_size(s->fifo) +
sizeof(copy))) < 0)
return VAR_2; if (!(copy = av_frame_alloc()))
return AVERROR(ENOMEM); av_frame_move_ref(copy, VAR_1); if ((VAR_2 = av_fifo_generic_write(s->fifo, &copy, sizeof(copy), NULL)) < 0) { av_frame_move_ref(VAR_1, copy); av_frame_free(&copy); return VAR_2; } return 0; }