X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fgraphparser.c;h=0ce823a10d8864a735bb235f10a3069973e61dc1;hb=67420b3de50202c0c71e3c9a57451b4adbcb16ab;hp=c34651f1310999efbc68281481eaa253f2a62e6a;hpb=b4ca1b159f4b7f0c3d1e4b2deab686bda934f3a2;p=ffmpeg diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index c34651f1310..0ce823a10d8 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -123,7 +123,8 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind return ret; } - if (!strcmp(filt_name, "scale") && args && !strstr(args, "flags")) { + if (!strcmp(filt_name, "scale") && args && !strstr(args, "flags") + && ctx->scale_sws_opts) { snprintf(tmp_args, sizeof(tmp_args), "%s:%s", args, ctx->scale_sws_opts); args = tmp_args; @@ -238,10 +239,11 @@ static int link_filter_inouts(AVFilterContext *filt_ctx, return AVERROR(ENOMEM); if (p->filter_ctx) { - if ((ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx)) < 0) - return ret; + ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx); av_free(p->name); av_free(p); + if (ret < 0) + return ret; } else { p->filter_ctx = filt_ctx; p->pad_idx = pad; @@ -289,8 +291,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, av_free(name); } else { /* Not in the list, so add it as an input */ - if (!(match = av_mallocz(sizeof(AVFilterInOut)))) + if (!(match = av_mallocz(sizeof(AVFilterInOut)))) { + av_free(name); return AVERROR(ENOMEM); + } match->name = name; match->pad_idx = pad; } @@ -318,24 +322,27 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut *match; AVFilterInOut *input = *curr_inputs; + + if (!name) + return AVERROR(EINVAL); + if (!input) { av_log(log_ctx, AV_LOG_ERROR, - "No output pad can be associated to link label '%s'.\n", - name); + "No output pad can be associated to link label '%s'.\n", name); + av_free(name); return AVERROR(EINVAL); } *curr_inputs = (*curr_inputs)->next; - if (!name) - return AVERROR(EINVAL); - /* First check if the label is not in the open_inputs list */ match = extract_inout(name, open_inputs); if (match) { if ((ret = link_filter(input->filter_ctx, input->pad_idx, - match->filter_ctx, match->pad_idx, log_ctx)) < 0) + match->filter_ctx, match->pad_idx, log_ctx)) < 0) { + av_free(name); return ret; + } av_free(match->name); av_free(name); av_free(match); @@ -519,6 +526,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *open_inputs = open_inputs_ptr ? *open_inputs_ptr : NULL; AVFilterInOut *open_outputs = open_outputs_ptr ? *open_outputs_ptr : NULL; + if ((ret = parse_sws_flags(&filters, graph)) < 0) + goto end; + do { AVFilterContext *filter; const char *filterchain = filters;