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

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


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

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

See previous commits for details.

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

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

diff --git a/doc/examples/decode_filter_video.c b/doc/examples/decode_filter_video.c
index b91ca56d4e..4a5247dbf2 100644
--- a/doc/examples/decode_filter_video.c
+++ b/doc/examples/decode_filter_video.c
@@ -122,10 +122,10 @@ static int init_filters(const char *filters_descr)
     }
 
     /* buffer video sink: to terminate the filter chain. */
-    ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
-                                       NULL, NULL, filter_graph);
-    if (ret < 0) {
+    buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, "out");
+    if (!buffersink_ctx) {
         av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
+        ret = AVERROR(ENOMEM);
         goto end;
     }
 
@@ -136,6 +136,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 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