History

graphparser: allow specifying sws flags in the graph description.

Anton Khirnov committed 14 years ago

Commit 12e7e1d1 parent 4e781c22 files · +36 −1Browse files

Showing the changes to libavfilter/graphparser.c (1 of 2 files). Show all

Unified · Split

libavfilter/graphparser.c+29−0
@@ -349,6 +349,30 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, · 348 unmodified lines
349#else349#else
350#define log_ctx NULL350#define log_ctx NULL
351#endif351#endif
352
353static 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
352int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,376int 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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t