static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)

{

    char *pix_fmts;

    AVCodecContext *codec = ofilter->ost->st->codec;

    AVFilterContext *last_filter = out->filter_ctx;

    int pad_idx = out->pad_idx;

    int ret;

    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();



#if FF_API_OLD_VSINK_API

    ret = avfilter_graph_create_filter(&ofilter->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "out", NULL, NULL, fg->graph);

#else

    ret = avfilter_graph_create_filter(&ofilter->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "out", NULL, buffersink_params, fg->graph);

#endif

    av_freep(&buffersink_params);



    if (ret < 0)

        return ret;



    if (codec->width || codec->height) {

        char args[255];

        AVFilterContext *filter;



        snprintf(args, sizeof(args), "%d:%d:flags=0x%X",

                 codec->width,

                 codec->height,

                 (unsigned)ofilter->ost->sws_flags);

        if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),

                                                NULL, args, NULL, fg->graph)) < 0)

            return ret;

        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)

            return ret;



        last_filter = filter;

        pad_idx = 0;

    }



    if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) {

        AVFilterContext *filter;

        if ((ret = avfilter_graph_create_filter(&filter,

                                                avfilter_get_by_name("format"),

                                                "format", pix_fmts, NULL,

                                                fg->graph)) < 0)

            return ret;

        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)

            return ret;



        last_filter = filter;

        pad_idx     = 0;

        av_freep(&pix_fmts);

    }



    if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)

        return ret;



    return 0;

}

static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)

{

    char *pix_fmts;

    AVCodecContext *codec = ofilter->ost->st->codec;

    AVFilterContext *last_filter = out->filter_ctx;

    int pad_idx = out->pad_idx;

    int ret;

    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();



#if FF_API_OLD_VSINK_API

    ret = avfilter_graph_create_filter(&ofilter->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "out", NULL, NULL, fg->graph);

#else

    ret = avfilter_graph_create_filter(&ofilter->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "out", NULL, buffersink_params, fg->graph);

#endif

    av_freep(&buffersink_params);



    if (ret < 0)

        return ret;



    if (codec->width || codec->height) {

        char args[255];

        AVFilterContext *filter;



        snprintf(args, sizeof(args), "%d:%d:flags=0x%X",

                 codec->width,

                 codec->height,

                 (unsigned)ofilter->ost->sws_flags);

        if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),

                                                NULL, args, NULL, fg->graph)) < 0)

            return ret;

        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)

            return ret;



        last_filter = filter;

        pad_idx = 0;

    }



    if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) {

        AVFilterContext *filter;

        if ((ret = avfilter_graph_create_filter(&filter,

                                                avfilter_get_by_name("format"),

                                                "format", pix_fmts, NULL,

                                                fg->graph)) < 0)

            return ret;

        if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)

            return ret;



        last_filter = filter;

        pad_idx     = 0;

        av_freep(&pix_fmts);

    }



    if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)

        return ret;



    return 0;

}

    if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) {     return 0;
static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2)

{

    char *VAR_3;

    AVCodecContext *codec = VAR_1->ost->st->codec;

    AVFilterContext *last_filter = VAR_2->filter_ctx;

    int VAR_4 = VAR_2->VAR_4;

    int VAR_5;

    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();



#if FF_API_OLD_VSINK_API

    VAR_5 = avfilter_graph_create_filter(&VAR_1->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "VAR_2", NULL, NULL, VAR_0->graph);

#else

    VAR_5 = avfilter_graph_create_filter(&VAR_1->filter,

                                       avfilter_get_by_name("buffersink"),

                                       "VAR_2", NULL, buffersink_params, VAR_0->graph);

#endif

    av_freep(&buffersink_params);



    if (VAR_5 < 0)

        return VAR_5;



    if (codec->width || codec->height) {

        char VAR_6[255];

        AVFilterContext *filter;



        snprintf(VAR_6, sizeof(VAR_6), "%d:%d:flags=0x%X",

                 codec->width,

                 codec->height,

                 (unsigned)VAR_1->ost->sws_flags);

        if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),

                                                NULL, VAR_6, NULL, VAR_0->graph)) < 0)

            return VAR_5;

        if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)

            return VAR_5;



        last_filter = filter;

        VAR_4 = 0;

    }



    if ((VAR_3 = choose_pixel_fmts(VAR_1->ost))) {

        AVFilterContext *filter;

        if ((VAR_5 = avfilter_graph_create_filter(&filter,

                                                avfilter_get_by_name("format"),

                                                "format", VAR_3, NULL,

                                                VAR_0->graph)) < 0)

            return VAR_5;

        if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)

            return VAR_5;



        last_filter = filter;

        VAR_4     = 0;

        av_freep(&VAR_3);

    }



    if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0)

        return VAR_5;



    return 0;

}

static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2)
{ char *VAR_3; AVCodecContext *codec = VAR_1->ost->st->codec; AVFilterContext *last_filter = VAR_2->filter_ctx; int VAR_4 = VAR_2->VAR_4; int VAR_5; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); #if FF_API_OLD_VSINK_API
VAR_5 = avfilter_graph_create_filter(&VAR_1->filter,
avfilter_get_by_name("buffersink"),
"VAR_2", NULL, NULL, VAR_0->graph); #else
VAR_5 = avfilter_graph_create_filter(&VAR_1->filter,
avfilter_get_by_name("buffersink"),
"VAR_2", NULL, buffersink_params, VAR_0->graph); #endif
av_freep(&buffersink_params); if (VAR_5 < 0)
return VAR_5; if (codec->width || codec->height) { char VAR_6[255]; AVFilterContext *filter; snprintf(VAR_6, sizeof(VAR_6), "%d:%d:flags=0x%X",
codec->width,
codec->height,
(unsigned)VAR_1->ost->sws_flags); if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
NULL, VAR_6, NULL, VAR_0->graph)) < 0)
return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)
return VAR_5; last_filter = filter; VAR_4 = 0; } if ((VAR_3 = choose_pixel_fmts(VAR_1->ost))) { AVFilterContext *filter; if ((VAR_5 = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
"format", VAR_3, NULL,
VAR_0->graph)) < 0)
return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)
return VAR_5; last_filter = filter; VAR_4     = 0; av_freep(&VAR_3); } if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0)
return VAR_5; return 0; }