aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_filter.c
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2022-11-26 15:46:19 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-12-01 11:21:14 +0100
commitece29ad0dcef10ef637919326de4cd91e62bc277 (patch)
tree2b9286e1222655daf9f998d34b343a6ec84a57f9 /fftools/ffmpeg_filter.c
parentf1907faab4023517af7d10d746b5684cccc5cfcc (diff)
downloadffmpeg-ece29ad0dcef10ef637919326de4cd91e62bc277.tar.gz
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>
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r--fftools/ffmpeg_filter.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b0c4c8ece3..7eb656dbe5 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -972,39 +972,34 @@ int configure_filtergraph(FilterGraph *fg)
if (simple) {
OutputStream *ost = fg->outputs[0]->ost;
- char args[512];
- const AVDictionaryEntry *e = NULL;
if (filter_nbthreads) {
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
if (ret < 0)
goto fail;
} else {
+ const AVDictionaryEntry *e = NULL;
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->sws_dict, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
- }
- if (strlen(args)) {
- args[strlen(args)-1] = 0;
- fg->graph->scale_sws_opts = av_strdup(args);
+ if (av_dict_count(ost->sws_dict)) {
+ ret = av_dict_get_string(ost->sws_dict,
+ &fg->graph->scale_sws_opts,
+ '=', ':');
+ if (ret < 0)
+ goto fail;
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->swr_opts, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+ if (av_dict_count(ost->swr_opts)) {
+ char *args;
+ ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
+ if (ret < 0)
+ goto fail;
+ av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
+ av_free(args);
}
- if (strlen(args))
- args[strlen(args)-1] = 0;
- av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
} else {
fg->graph->nb_threads = filter_complex_nbthreads;
}