mirror of https://git.ffmpeg.org/ffmpeg.git
fftools: use av_dict_get_string
Instead of manually assembling the string, use av_dict_get_string which handles things like proper escaping too (even though it is not yet needed here). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
f1907faab4
commit
ece29ad0dc
|
@ -972,39 +972,34 @@ int configure_filtergraph(FilterGraph *fg)
|
||||||
|
|
||||||
if (simple) {
|
if (simple) {
|
||||||
OutputStream *ost = fg->outputs[0]->ost;
|
OutputStream *ost = fg->outputs[0]->ost;
|
||||||
char args[512];
|
|
||||||
const AVDictionaryEntry *e = NULL;
|
|
||||||
|
|
||||||
if (filter_nbthreads) {
|
if (filter_nbthreads) {
|
||||||
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
|
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
|
const AVDictionaryEntry *e = NULL;
|
||||||
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
|
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
|
||||||
if (e)
|
if (e)
|
||||||
av_opt_set(fg->graph, "threads", e->value, 0);
|
av_opt_set(fg->graph, "threads", e->value, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
args[0] = 0;
|
if (av_dict_count(ost->sws_dict)) {
|
||||||
e = NULL;
|
ret = av_dict_get_string(ost->sws_dict,
|
||||||
while ((e = av_dict_get(ost->sws_dict, "", e,
|
&fg->graph->scale_sws_opts,
|
||||||
AV_DICT_IGNORE_SUFFIX))) {
|
'=', ':');
|
||||||
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
|
if (ret < 0)
|
||||||
}
|
goto fail;
|
||||||
if (strlen(args)) {
|
|
||||||
args[strlen(args)-1] = 0;
|
|
||||||
fg->graph->scale_sws_opts = av_strdup(args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args[0] = 0;
|
if (av_dict_count(ost->swr_opts)) {
|
||||||
e = NULL;
|
char *args;
|
||||||
while ((e = av_dict_get(ost->swr_opts, "", e,
|
ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
|
||||||
AV_DICT_IGNORE_SUFFIX))) {
|
if (ret < 0)
|
||||||
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
|
goto fail;
|
||||||
}
|
|
||||||
if (strlen(args))
|
|
||||||
args[strlen(args)-1] = 0;
|
|
||||||
av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
|
av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
|
||||||
|
av_free(args);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fg->graph->nb_threads = filter_complex_nbthreads;
|
fg->graph->nb_threads = filter_complex_nbthreads;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue