@@ -204,9 +204,9 @@ pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.
Libavfilter will automatically insert @ref{scale} filters where format
-conversion is required. It is possible to specify swscale flags
-for those automatically inserted scalers by prepending
-@code{sws_flags=@var{flags};}
+conversion is required. It is possible to specify swscale flags or
+scale_sws_opts for those automatically inserted scalers by prepending
+@code{sws_flags=@var{flags};} or @code{scale_sws_opts=@var{scale_sws_opts};}
to the filtergraph description.
Here is a BNF description of the filtergraph syntax:
@@ -219,6 +219,7 @@ Here is a BNF description of the filtergraph syntax:
@var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
+@var{FILTERGRAPH} ::= [scale_sws_opts=@var{opts};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
@anchor{filtergraph escaping}
@@ -415,6 +415,25 @@ static int parse_sws_flags(const char **buf, AVFilterGraph *graph)
return 0;
}
+static int parse_scale_sws_opts(const char **buf, AVFilterGraph *graph)
+{
+ char *p = strchr(*buf, ';');
+
+ if (!av_strstart(*buf, "scale_sws_opts=", buf))
+ return 0;
+
+ if (!p) {
+ av_log(graph, AV_LOG_ERROR, "scale_sws_opts not terminated with ';'.\n");
+ return AVERROR(EINVAL);
+ }
+
+ av_freep(&graph->scale_sws_opts);
+ graph->scale_sws_opts = av_strndup(*buf, p - *buf);
+
+ *buf = p + 1;
+ return 0;
+}
+
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
AVFilterInOut **inputs,
AVFilterInOut **outputs)
@@ -429,6 +448,9 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
if ((ret = parse_sws_flags(&filters, graph)) < 0)
goto fail;
+ if ((ret = parse_scale_sws_opts(&filters, graph)) < 0)
+ goto fail;
+
do {
AVFilterContext *filter;
filters += strspn(filters, WHITESPACES);