Showing the changes to libavfilter/graphparser.c (1 of 2 files). Show all
Unified · Split
| @@ -349,6 +349,30 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, · 348 unmodified lines | |||
| 349 | #else | 349 | #else |
| 350 | #define log_ctx NULL | 350 | #define log_ctx NULL |
| 351 | #endif | 351 | #endif |
| 352 | |||
| 353 | static int parse_sws_flags(const char **buf, AVFilterGraph *graph) | ||
| 354 | { | ||
| 355 | char *p = strchr(*buf, ';'); | ||
| 356 | |||
| 357 | if (strncmp(*buf, "sws_flags=", 10)) | ||
| 358 | return 0; | ||
| 359 | |||
| 360 | if (!p) { | ||
| 361 | av_log(log_ctx, AV_LOG_ERROR, "sws_flags not terminated with ';'.\n"); | ||
| 362 | return AVERROR(EINVAL); | ||
| 363 | } | ||
| 364 | |||
| 365 | *buf += 4; // keep the 'flags=' part | ||
| 366 | |||
| 367 | av_freep(&graph->scale_sws_opts); | ||
| 368 | if (!(graph->scale_sws_opts = av_mallocz(p - *buf + 1))) | ||
| 369 | return AVERROR(ENOMEM); | ||
| 370 | av_strlcpy(graph->scale_sws_opts, *buf, p - *buf + 1); | ||
| 371 | |||
| 372 | *buf = p + 1; | ||
| 373 | return 0; | ||
| 374 | } | ||
| 375 | |||
| 352 | int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, | 376 | int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, |
| 353 | AVFilterInOut **inputs, | 377 | AVFilterInOut **inputs, |
| 354 | AVFilterInOut **outputs) | 378 | AVFilterInOut **outputs) |
| @@ -358,6 +382,11 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, · 3 unmodified lines | |||
| 358 | 382 | ||
| 359 | AVFilterInOut *curr_inputs = NULL, *open_inputs = NULL, *open_outputs = NULL; | 383 | AVFilterInOut *curr_inputs = NULL, *open_inputs = NULL, *open_outputs = NULL; |
| 360 | 384 | ||
| 385 | filters += strspn(filters, WHITESPACES); | ||
| 386 | |||
| 387 | if ((ret = parse_sws_flags(&filters, graph)) < 0) | ||
| 388 | goto fail; | ||
| 389 | |||
| 361 | do { | 390 | do { |
| 362 | AVFilterContext *filter; | 391 | AVFilterContext *filter; |
| 363 | filters += strspn(filters, WHITESPACES); | 392 | filters += strspn(filters, WHITESPACES); |