[FFmpeg-cvslog] lavd/lavfi: stop using avfilter_graph_create_filter() incorrectly
Anton Khirnov
git at videolan.org
Sat Sep 28 18:13:22 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Sep 25 11:58:57 2024 +0200| [d3f76dbca122360215ded32c3d0e974216511d3e] | committer: Anton Khirnov
lavd/lavfi: stop using avfilter_graph_create_filter() incorrectly
See previous commits for details.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3f76dbca122360215ded32c3d0e974216511d3e
---
libavdevice/lavfi.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index ce10d61f8a..17657a0638 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -249,18 +249,24 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL,
};
- ret = avfilter_graph_create_filter(&sink, abuffersink,
- inout->name, NULL,
- NULL, lavfi->graph);
- if (ret >= 0)
- ret = av_opt_set_bin(sink, "sample_fmts", (const uint8_t*)sample_fmts,
- sizeof(sample_fmts), AV_OPT_SEARCH_CHILDREN);
+ sink = avfilter_graph_alloc_filter(lavfi->graph, abuffersink, inout->name);
+ if (!sink) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+
+ ret = av_opt_set_bin(sink, "sample_fmts", (const uint8_t*)sample_fmts,
+ sizeof(sample_fmts), AV_OPT_SEARCH_CHILDREN);
if (ret < 0)
goto end;
ret = av_opt_set_int(sink, "all_channel_counts", 1,
AV_OPT_SEARCH_CHILDREN);
if (ret < 0)
goto end;
+
+ ret = avfilter_init_dict(sink, NULL);
+ if (ret < 0)
+ goto end;
} else {
av_log(avctx, AV_LOG_ERROR,
"Output '%s' is not a video or audio output, not yet supported\n", inout->name);
More information about the ffmpeg-cvslog
mailing list