int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,

                              int64_t pts, AVRational pixel_aspect, int width,

                              int height, enum PixelFormat  pix_fmt,

                              const char *sws_param)

{

    BufferSourceContext *c = buffer_filter->priv;

    int ret;



    if (c->has_frame) {

        av_log(buffer_filter, AV_LOG_ERROR,

               "Buffering several frames is not supported. "

               "Please consume all available frames before adding a new one.\n"

            );

        //return -1;

    }



    if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){

        AVFilterContext *scale= buffer_filter->outputs[0]->dst;

        AVFilterLink *link;



        av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n",

               width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format);



        if(!scale || strcmp(scale->filter->name,"scale")){

            AVFilter *f= avfilter_get_by_name("scale");



            av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n");

            if(avfilter_open(&scale, f, "Input equalizer") < 0)

                return -1;



            if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){

                avfilter_free(scale);

                return ret;

            }



            if((ret=avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0))<0){

                avfilter_free(scale);

                return ret;

            }



            scale->outputs[0]->format= c->pix_fmt;

        }



        c->pix_fmt= scale->inputs[0]->format= pix_fmt;

        c->w= scale->inputs[0]->w= width;

        c->h= scale->inputs[0]->h= height;



        link= scale->outputs[0];

        if ((ret =  link->srcpad->config_props(link)) < 0)

            return ret;

    }



    memcpy(c->frame.data    , frame->data    , sizeof(frame->data));

    memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));

    c->frame.interlaced_frame= frame->interlaced_frame;

    c->frame.top_field_first = frame->top_field_first;

    c->frame.key_frame = frame->key_frame;

    c->frame.pict_type = frame->pict_type;

    c->pts = pts;

    c->pixel_aspect = pixel_aspect;

    c->has_frame = 1;



    return 0;

}

int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,

                              int64_t pts, AVRational pixel_aspect, int width,

                              int height, enum PixelFormat  pix_fmt,

                              const char *sws_param)

{

    BufferSourceContext *c = buffer_filter->priv;

    int ret;



    if (c->has_frame) {

        av_log(buffer_filter, AV_LOG_ERROR,

               "Buffering several frames is not supported. "

               "Please consume all available frames before adding a new one.\n"

            );

        

    }



    if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){

        AVFilterContext *scale= buffer_filter->outputs[0]->dst;

        AVFilterLink *link;



        av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n",

               width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format);



        if(!scale || strcmp(scale->filter->name,"scale")){

            AVFilter *f= avfilter_get_by_name("scale");



            av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n");

            if(avfilter_open(&scale, f, "Input equalizer") < 0)

                return -1;



            if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){

                avfilter_free(scale);

                return ret;

            }



            if((ret=avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0))<0){

                avfilter_free(scale);

                return ret;

            }



            scale->outputs[0]->format= c->pix_fmt;

        }



        c->pix_fmt= scale->inputs[0]->format= pix_fmt;

        c->w= scale->inputs[0]->w= width;

        c->h= scale->inputs[0]->h= height;



        link= scale->outputs[0];

        if ((ret =  link->srcpad->config_props(link)) < 0)

            return ret;

    }



    memcpy(c->frame.data    , frame->data    , sizeof(frame->data));

    memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));

    c->frame.interlaced_frame= frame->interlaced_frame;

    c->frame.top_field_first = frame->top_field_first;

    c->frame.key_frame = frame->key_frame;

    c->frame.pict_type = frame->pict_type;

    c->pts = pts;

    c->pixel_aspect = pixel_aspect;

    c->has_frame = 1;



    return 0;

}

               width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format);
int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1,

                              int64_t VAR_2, AVRational VAR_3, int VAR_4,

                              int VAR_5, enum PixelFormat  VAR_6,

                              const char *VAR_7)

{

    BufferSourceContext *c = VAR_0->priv;

    int VAR_8;



    if (c->has_frame) {

        av_log(VAR_0, AV_LOG_ERROR,

               "Buffering several frames is not supported. "

               "Please consume all available frames before adding a new one.\n"

            );

        

    }



    if(VAR_4 != c->w || VAR_5 != c->h || VAR_6 != c->VAR_6){

        AVFilterContext *scale= VAR_0->outputs[0]->dst;

        AVFilterLink *link;



        av_log(VAR_0, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n",

               VAR_4,VAR_5,VAR_6, c->VAR_6, scale->outputs[0]->format);



        if(!scale || strcmp(scale->filter->name,"scale")){

            AVFilter *f= avfilter_get_by_name("scale");



            av_log(VAR_0, AV_LOG_INFO, "Inserting scaler filter\n");

            if(avfilter_open(&scale, f, "Input equalizer") < 0)

                return -1;



            if((VAR_8=avfilter_init_filter(scale, VAR_7, NULL))<0){

                avfilter_free(scale);

                return VAR_8;

            }



            if((VAR_8=avfilter_insert_filter(VAR_0->outputs[0], scale, 0, 0))<0){

                avfilter_free(scale);

                return VAR_8;

            }



            scale->outputs[0]->format= c->VAR_6;

        }



        c->VAR_6= scale->inputs[0]->format= VAR_6;

        c->w= scale->inputs[0]->w= VAR_4;

        c->h= scale->inputs[0]->h= VAR_5;



        link= scale->outputs[0];

        if ((VAR_8 =  link->srcpad->config_props(link)) < 0)

            return VAR_8;

    }



    memcpy(c->VAR_1.data    , VAR_1->data    , sizeof(VAR_1->data));

    memcpy(c->VAR_1.linesize, VAR_1->linesize, sizeof(VAR_1->linesize));

    c->VAR_1.interlaced_frame= VAR_1->interlaced_frame;

    c->VAR_1.top_field_first = VAR_1->top_field_first;

    c->VAR_1.key_frame = VAR_1->key_frame;

    c->VAR_1.pict_type = VAR_1->pict_type;

    c->VAR_2 = VAR_2;

    c->VAR_3 = VAR_3;

    c->has_frame = 1;



    return 0;

}

int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1,
int64_t VAR_2, AVRational VAR_3, int VAR_4,
int VAR_5, enum PixelFormat  VAR_6,
const char *VAR_7)
{ BufferSourceContext *c = VAR_0->priv; int VAR_8; if (c->has_frame) { av_log(VAR_0, AV_LOG_ERROR,
"Buffering several frames is not supported. "
"Please consume all available frames before adding a new one.\n"
); } if(VAR_4 != c->w || VAR_5 != c->h || VAR_6 != c->VAR_6){ AVFilterContext *scale= VAR_0->outputs[0]->dst; AVFilterLink *link; av_log(VAR_0, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n",
VAR_4,VAR_5,VAR_6, c->VAR_6, scale->outputs[0]->format); if(!scale || strcmp(scale->filter->name,"scale")){ AVFilter *f= avfilter_get_by_name("scale"); av_log(VAR_0, AV_LOG_INFO, "Inserting scaler filter\n"); if(avfilter_open(&scale, f, "Input equalizer") < 0)
return -1; if((VAR_8=avfilter_init_filter(scale, VAR_7, NULL))<0){ avfilter_free(scale); return VAR_8; } if((VAR_8=avfilter_insert_filter(VAR_0->outputs[0], scale, 0, 0))<0){ avfilter_free(scale); return VAR_8; } scale->outputs[0]->format= c->VAR_6; } c->VAR_6= scale->inputs[0]->format= VAR_6; c->w= scale->inputs[0]->w= VAR_4; c->h= scale->inputs[0]->h= VAR_5; link= scale->outputs[0]; if ((VAR_8 =  link->srcpad->config_props(link)) < 0)
return VAR_8; } memcpy(c->VAR_1.data    , VAR_1->data    , sizeof(VAR_1->data)); memcpy(c->VAR_1.linesize, VAR_1->linesize, sizeof(VAR_1->linesize)); c->VAR_1.interlaced_frame= VAR_1->interlaced_frame; c->VAR_1.top_field_first = VAR_1->top_field_first; c->VAR_1.key_frame = VAR_1->key_frame; c->VAR_1.pict_type = VAR_1->pict_type; c->VAR_2 = VAR_2; c->VAR_3 = VAR_3; c->has_frame = 1; return 0; }