[FFmpeg-cvslog] doc/examples/decode_filter_audio: stop using avfilter_graph_create_filter() incorrectly

Anton Khirnov git at videolan.org
Sat Sep 28 18:13:03 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Sep 25 12:18:31 2024 +0200| [27564f902002589a1681f64dbddfc988d948be70] | committer: Anton Khirnov

doc/examples/decode_filter_audio: stop using avfilter_graph_create_filter() incorrectly

See previous commit for details.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27564f902002589a1681f64dbddfc988d948be70
---

 doc/examples/decode_filter_audio.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/examples/decode_filter_audio.c b/doc/examples/decode_filter_audio.c
index d637ca1724..6d148f7ab4 100644
--- a/doc/examples/decode_filter_audio.c
+++ b/doc/examples/decode_filter_audio.c
@@ -123,10 +123,10 @@ static int init_filters(const char *filters_descr)
     }
 
     /* buffer audio sink: to terminate the filter chain. */
-    ret = avfilter_graph_create_filter(&buffersink_ctx, abuffersink, "out",
-                                       NULL, NULL, filter_graph);
-    if (ret < 0) {
+    buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, abuffersink, "out");
+    if (!buffersink_ctx) {
         av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");
+        ret = AVERROR(ENOMEM);
         goto end;
     }
 
@@ -151,6 +151,12 @@ static int init_filters(const char *filters_descr)
         goto end;
     }
 
+    ret = avfilter_init_dict(buffersink_ctx, NULL);
+    if (ret < 0) {
+        av_log(NULL, AV_LOG_ERROR, "Cannot initialize audio buffer sink\n");
+        goto end;
+    }
+
     /*
      * Set the endpoints for the filter graph. The filter_graph will
      * be linked to the graph described by filters_descr.



More information about the ffmpeg-cvslog mailing list