int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,

                         AVFilterInOut *openLinks, AVClass *log_ctx)

{

    int index = 0;

    char chr = 0;

    int pad = 0;



    AVFilterInOut *currInputs = NULL;



    do {

        AVFilterContext *filter;

        filters += consume_whitespace(filters);



        pad = parse_inputs(&filters, &currInputs, &openLinks, log_ctx);



        if(pad < 0)

            goto fail;



        if(!(filter = parse_filter(&filters, graph, index, log_ctx)))

            goto fail;



        if(filter->input_count == 1 && !currInputs && !index) {

            // First input can be ommitted if it is "[in]"

            const char *tmp = "[in]";

            pad = parse_inputs(&tmp, &currInputs, &openLinks, log_ctx);

            if(pad < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &currInputs, &openLinks, log_ctx) < 0)

            goto fail;



        pad = parse_outputs(&filters, &currInputs, &openLinks, log_ctx);



        if(pad < 0)

            goto fail;



        filters += consume_whitespace(filters);

        chr = *filters++;



        if(chr == ';' && currInputs) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Could not find a output to link when parsing \"%s\"\n",

                   filters - 1);

            goto fail;

        }

        index++;

    } while(chr == ',' || chr == ';');



    if(openLinks && !strcmp(openLinks->name, "out") && currInputs) {

        // Last output can be ommitted if it is "[out]"

        const char *tmp = "[out]";

        if(parse_outputs(&tmp, &currInputs, &openLinks, log_ctx) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(graph);

    free_inout(openLinks);

    free_inout(currInputs);

    return -1;

}

int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,

                         AVFilterInOut *openLinks, AVClass *log_ctx)

{

    int index = 0;

    char chr = 0;

    int pad = 0;



    AVFilterInOut *currInputs = NULL;



    do {

        AVFilterContext *filter;

        filters += consume_whitespace(filters);



        pad = parse_inputs(&filters, &currInputs, &openLinks, log_ctx);



        if(pad < 0)

            goto fail;



        if(!(filter = parse_filter(&filters, graph, index, log_ctx)))

            goto fail;



        if(filter->input_count == 1 && !currInputs && !index) {

            

            const char *tmp = "[in]";

            pad = parse_inputs(&tmp, &currInputs, &openLinks, log_ctx);

            if(pad < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &currInputs, &openLinks, log_ctx) < 0)

            goto fail;



        pad = parse_outputs(&filters, &currInputs, &openLinks, log_ctx);



        if(pad < 0)

            goto fail;



        filters += consume_whitespace(filters);

        chr = *filters++;



        if(chr == ';' && currInputs) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Could not find a output to link when parsing \"%s\"\n",

                   filters - 1);

            goto fail;

        }

        index++;

    } while(chr == ',' || chr == ';');



    if(openLinks && !strcmp(openLinks->name, "out") && currInputs) {

        

        const char *tmp = "[out]";

        if(parse_outputs(&tmp, &currInputs, &openLinks, log_ctx) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(graph);

    free_inout(openLinks);

    free_inout(currInputs);

    return -1;

}

int FUNC_0(AVFilterGraph *VAR_0, const char *VAR_1,

                         AVFilterInOut *VAR_2, AVClass *VAR_3)

{

    int VAR_4 = 0;

    char VAR_5 = 0;

    int VAR_6 = 0;



    AVFilterInOut *currInputs = NULL;



    do {

        AVFilterContext *filter;

        VAR_1 += consume_whitespace(VAR_1);



        VAR_6 = parse_inputs(&VAR_1, &currInputs, &VAR_2, VAR_3);



        if(VAR_6 < 0)

            goto fail;



        if(!(filter = parse_filter(&VAR_1, VAR_0, VAR_4, VAR_3)))

            goto fail;



        if(filter->input_count == 1 && !currInputs && !VAR_4) {

            

            const char *VAR_8 = "[in]";

            VAR_6 = parse_inputs(&VAR_8, &currInputs, &VAR_2, VAR_3);

            if(VAR_6 < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &currInputs, &VAR_2, VAR_3) < 0)

            goto fail;



        VAR_6 = parse_outputs(&VAR_1, &currInputs, &VAR_2, VAR_3);



        if(VAR_6 < 0)

            goto fail;



        VAR_1 += consume_whitespace(VAR_1);

        VAR_5 = *VAR_1++;



        if(VAR_5 == ';' && currInputs) {

            av_log(VAR_3, AV_LOG_ERROR,

                   "Could not find a output to link when parsing \"%s\"\n",

                   VAR_1 - 1);

            goto fail;

        }

        VAR_4++;

    } while(VAR_5 == ',' || VAR_5 == ';');



    if(VAR_2 && !strcmp(VAR_2->name, "out") && currInputs) {

        

        const char *VAR_8 = "[out]";

        if(parse_outputs(&VAR_8, &currInputs, &VAR_2, VAR_3) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(VAR_0);

    free_inout(VAR_2);

    free_inout(currInputs);

    return -1;

}

int FUNC_0(AVFilterGraph *VAR_0, const char *VAR_1,
AVFilterInOut *VAR_2, AVClass *VAR_3)
{ int VAR_4 = 0; char VAR_5 = 0; int VAR_6 = 0; AVFilterInOut *currInputs = NULL; do { AVFilterContext *filter; VAR_1 += consume_whitespace(VAR_1); VAR_6 = parse_inputs(&VAR_1, &currInputs, &VAR_2, VAR_3); if(VAR_6 < 0)
goto fail; if(!(filter = parse_filter(&VAR_1, VAR_0, VAR_4, VAR_3)))
goto fail; if(filter->input_count == 1 && !currInputs && !VAR_4) { const char *VAR_8 = "[in]"; VAR_6 = parse_inputs(&VAR_8, &currInputs, &VAR_2, VAR_3); if(VAR_6 < 0)
goto fail; } if(link_filter_inouts(filter, &currInputs, &VAR_2, VAR_3) < 0)
goto fail; VAR_6 = parse_outputs(&VAR_1, &currInputs, &VAR_2, VAR_3); if(VAR_6 < 0)
goto fail; VAR_1 += consume_whitespace(VAR_1); VAR_5 = *VAR_1++; if(VAR_5 == ';' && currInputs) { av_log(VAR_3, AV_LOG_ERROR,
"Could not find a output to link when parsing \"%s\"\n",
VAR_1 - 1); goto fail; } VAR_4++; } while(VAR_5 == ',' || VAR_5 == ';'); if(VAR_2 && !strcmp(VAR_2->name, "out") && currInputs) { const char *VAR_8 = "[out]"; if(parse_outputs(&VAR_8, &currInputs, &VAR_2, VAR_3) < 0)
goto fail; } return 0; fail:
avfilter_destroy_graph(VAR_0); free_inout(VAR_2); free_inout(currInputs); return -1; }