[FFmpeg-cvslog] asink_abuffer: extend ABufferSinkContext to make it accept lists of formats in input

Stefano Sabatini git at videolan.org
Mon Aug 22 10:36:03 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Thu Aug 18 14:58:47 2011 +0200| [df4c7ae9db04206c7557e9eaa1b16274e1bea965] | committer: Stefano Sabatini

asink_abuffer: extend ABufferSinkContext to make it accept lists of formats in input

This is required for the pending lavfi indev extension, also
consistent with the video buffer sink.

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

 libavfilter/asink_abuffer.c |   18 +++++++-----------
 libavfilter/asink_abuffer.h |    6 +++---
 libavfilter/avfilter.h      |    2 +-
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/libavfilter/asink_abuffer.c b/libavfilter/asink_abuffer.c
index f4e7740..25950d8 100644
--- a/libavfilter/asink_abuffer.c
+++ b/libavfilter/asink_abuffer.c
@@ -46,22 +46,18 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
 static int query_formats(AVFilterContext *ctx)
 {
     ABufferSinkContext *abuffersink = ctx->priv;
-    AVFilterFormats *formats;
-    int ret;
+    AVFilterFormats *formats = NULL;
 
-    formats = NULL;
-    if ((ret = avfilter_add_format(&formats, abuffersink->sample_fmt)) < 0)
-        return ret;
+    if (!(formats = avfilter_make_format_list(abuffersink->sample_fmts)))
+        return AVERROR(ENOMEM);
     avfilter_set_common_sample_formats(ctx, formats);
 
-    formats = NULL;
-    if ((ret = avfilter_add_format(&formats, abuffersink->channel_layout)) < 0)
-        return ret;
+    if (!(formats = avfilter_make_format64_list(abuffersink->channel_layouts)))
+        return AVERROR(ENOMEM);
     avfilter_set_common_channel_layouts(ctx, formats);
 
-    formats = NULL;
-    if ((ret = avfilter_add_format(&formats, abuffersink->planar)) < 0)
-        return ret;
+    if (!(formats = avfilter_make_format_list(abuffersink->packing_fmts)))
+        return AVERROR(ENOMEM);
     avfilter_set_common_packing_formats(ctx, formats);
 
     return 0;
diff --git a/libavfilter/asink_abuffer.h b/libavfilter/asink_abuffer.h
index 2c039fb..d0b822a 100644
--- a/libavfilter/asink_abuffer.h
+++ b/libavfilter/asink_abuffer.h
@@ -27,9 +27,9 @@
 #include "avfilter.h"
 
 typedef struct {
-    enum AVSampleFormat sample_fmt;
-    int64_t channel_layout;
-    int planar;
+    const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats,  terminated by -1
+    const int64_t *channel_layouts;         ///< list of allowed channel layouts, terminated by -1
+    const int *packing_fmts;                ///< list of allowed packing formats, terminated by -1
 } ABufferSinkContext;
 
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 03fc83a..e7b70fb 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -30,7 +30,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  2
 #define LIBAVFILTER_VERSION_MINOR 34
-#define LIBAVFILTER_VERSION_MICRO  1
+#define LIBAVFILTER_VERSION_MICRO  2
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list