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

                         AVFilterInOut *open_inputs,

                         AVFilterInOut *open_outputs, AVClass *log_ctx)

{

    int index = 0;

    char chr = 0;



    AVFilterInOut *curr_inputs = NULL;



    do {

        AVFilterContext *filter;

        filters += consume_whitespace(filters);



        if(parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx) < 0)

            goto fail;



        filter = parse_filter(&filters, graph, index, log_ctx);



        if(!filter)

            goto fail;



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

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

            const char *tmp = "[in]";

            if(parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx) < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx) < 0)

            goto fail;



        if(parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,

                         log_ctx) < 0)

            goto fail;



        filters += consume_whitespace(filters);

        chr = *filters++;



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

            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 (*filters) {

        av_log(log_ctx, AV_LOG_ERROR,

               "Unable to parse graph description substring: \"%s\"\n",

               filters - 1);

        goto fail;

    }



    if(open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) {

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

        const char *tmp = "[out]";

        if(parse_outputs(&tmp, &curr_inputs, &open_inputs,

                         &open_outputs, log_ctx) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(graph);

    free_inout(open_inputs);

    free_inout(open_outputs);

    free_inout(curr_inputs);

    return -1;

}

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

                         AVFilterInOut *open_inputs,

                         AVFilterInOut *open_outputs, AVClass *log_ctx)

{

    int index = 0;

    char chr = 0;



    AVFilterInOut *curr_inputs = NULL;



    do {

        AVFilterContext *filter;

        filters += consume_whitespace(filters);



        if(parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx) < 0)

            goto fail;



        filter = parse_filter(&filters, graph, index, log_ctx);



        if(!filter)

            goto fail;



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

            

            const char *tmp = "[in]";

            if(parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx) < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx) < 0)

            goto fail;



        if(parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,

                         log_ctx) < 0)

            goto fail;



        filters += consume_whitespace(filters);

        chr = *filters++;



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

            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 (*filters) {

        av_log(log_ctx, AV_LOG_ERROR,

               "Unable to parse graph description substring: \"%s\"\n",

               filters - 1);

        goto fail;

    }



    if(open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) {

        

        const char *tmp = "[out]";

        if(parse_outputs(&tmp, &curr_inputs, &open_inputs,

                         &open_outputs, log_ctx) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(graph);

    free_inout(open_inputs);

    free_inout(open_outputs);

    free_inout(curr_inputs);

    return -1;

}

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

                         AVFilterInOut *VAR_2,

                         AVFilterInOut *VAR_3, AVClass *VAR_4)

{

    int VAR_5 = 0;

    char VAR_6 = 0;



    AVFilterInOut *curr_inputs = NULL;



    do {

        AVFilterContext *filter;

        VAR_1 += consume_whitespace(VAR_1);



        if(parse_inputs(&VAR_1, &curr_inputs, &VAR_3, VAR_4) < 0)

            goto fail;



        filter = parse_filter(&VAR_1, VAR_0, VAR_5, VAR_4);



        if(!filter)

            goto fail;



        if(filter->input_count == 1 && !curr_inputs && !VAR_5) {

            

            const char *VAR_8 = "[in]";

            if(parse_inputs(&VAR_8, &curr_inputs, &VAR_3, VAR_4) < 0)

                goto fail;

        }



        if(link_filter_inouts(filter, &curr_inputs, &VAR_2, VAR_4) < 0)

            goto fail;



        if(parse_outputs(&VAR_1, &curr_inputs, &VAR_2, &VAR_3,

                         VAR_4) < 0)

            goto fail;



        VAR_1 += consume_whitespace(VAR_1);

        VAR_6 = *VAR_1++;



        if(VAR_6 == ';' && curr_inputs) {

            av_log(VAR_4, AV_LOG_ERROR,

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

                   VAR_1 - 1);

            goto fail;

        }

        VAR_5++;

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



    if (*VAR_1) {

        av_log(VAR_4, AV_LOG_ERROR,

               "Unable to parse VAR_0 description substring: \"%s\"\n",

               VAR_1 - 1);

        goto fail;

    }



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

        

        const char *VAR_8 = "[out]";

        if(parse_outputs(&VAR_8, &curr_inputs, &VAR_2,

                         &VAR_3, VAR_4) < 0)

            goto fail;

    }



    return 0;



 fail:

    avfilter_destroy_graph(VAR_0);

    free_inout(VAR_2);

    free_inout(VAR_3);

    free_inout(curr_inputs);

    return -1;

}

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