[FFmpeg-cvslog] vf_format: do not use the AVFilterFormats internals.

Anton Khirnov git at videolan.org
Sat May 18 13:08:12 CEST 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Mar 31 16:58:49 2013 +0200| [1dd35611433c224e2231ed7ae26b5b560863a3cb] | committer: Anton Khirnov

vf_format: do not use the AVFilterFormats internals.

Use the formats.h API instead.

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

 libavfilter/vf_format.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
index 7fcc7d6..e1fcc23 100644
--- a/libavfilter/vf_format.c
+++ b/libavfilter/vf_format.c
@@ -83,15 +83,17 @@ static av_cold int init(AVFilterContext *ctx)
 
 static AVFilterFormats *make_format_list(FormatContext *s, int flag)
 {
-    AVFilterFormats *formats;
+    AVFilterFormats *formats = NULL;
     enum AVPixelFormat pix_fmt;
 
-    formats = av_mallocz(sizeof(AVFilterFormats));
-    formats->formats = av_malloc(sizeof(enum AVPixelFormat) * AV_PIX_FMT_NB);
-
     for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
-        if (s->listed_pix_fmt_flags[pix_fmt] == flag)
-            formats->formats[formats->nb_formats++] = pix_fmt;
+        if (s->listed_pix_fmt_flags[pix_fmt] == flag) {
+            int ret = ff_add_format(&formats, pix_fmt);
+            if (ret < 0) {
+                ff_formats_unref(&formats);
+                return NULL;
+            }
+        }
 
     return formats;
 }



More information about the ffmpeg-cvslog mailing list