aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_filter.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-04-04 12:49:55 +0200
committerAnton Khirnov <anton@khirnov.net>2024-04-09 10:34:18 +0200
commit243a51490a85923c29ea9c276786e7b7d29cff0d (patch)
tree45853e9fdc4b9757b4dbed219206433f5a662a90 /fftools/ffmpeg_filter.c
parentd74cbcb9635f1c94f990dae4988a060ec6494f34 (diff)
downloadffmpeg-243a51490a85923c29ea9c276786e7b7d29cff0d.tar.gz
fftools/ffmpeg_filter: only store complex filtergraphs in global array
Store simple filtergraphs in the stream they feed. Keeping the two separate will be useful in following commits.
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r--fftools/ffmpeg_filter.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 3988cf5fc2..388c8919fd 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1009,16 +1009,25 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
AVFilterGraph *graph;
int ret = 0;
- fgp = allocate_array_elem(&filtergraphs, sizeof(*fgp), &nb_filtergraphs);
+ fgp = av_mallocz(sizeof(*fgp));
if (!fgp)
return AVERROR(ENOMEM);
fg = &fgp->fg;
- if (pfg)
+ if (pfg) {
*pfg = fg;
+ fg->index = -1;
+ } else {
+ ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
+ if (ret < 0) {
+ av_freep(&fgp);
+ return ret;
+ }
+
+ fg->index = nb_filtergraphs - 1;
+ }
fg->class = &fg_class;
- fg->index = nb_filtergraphs - 1;
fgp->graph_desc = graph_desc;
fgp->disable_conversions = !auto_conversion_filters;
fgp->sch = sch;
@@ -1135,6 +1144,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
ret = fg_create(&fg, graph_desc, sch);
if (ret < 0)
return ret;
+ ost->fg_simple = fg;
fgp = fgp_from_fg(fg);
fgp->is_simple = 1;