[FFmpeg-devel] [PATCH] lavfi: add ff_all_channel_layouts internal symbol

Stefano Sabatini stefano.sabatini-lala at poste.it
Sat Aug 20 15:33:16 CEST 2011


This way the list of all the channel layouts can be easily shared in
the library, avoid code duplication.
---
 libavfilter/formats.c  |   34 +++++++++++++++++-----------------
 libavfilter/internal.h |    2 ++
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c863be6..504e9d7 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -153,25 +153,25 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
     return ret;
 }
 
+const int64_t ff_all_channel_layouts[] = {
+    AV_CH_LAYOUT_MONO,
+    AV_CH_LAYOUT_STEREO,
+    AV_CH_LAYOUT_4POINT0,
+    AV_CH_LAYOUT_QUAD,
+    AV_CH_LAYOUT_5POINT0,
+    AV_CH_LAYOUT_5POINT0_BACK,
+    AV_CH_LAYOUT_5POINT1,
+    AV_CH_LAYOUT_5POINT1_BACK,
+    AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
+    AV_CH_LAYOUT_7POINT1,
+    AV_CH_LAYOUT_7POINT1_WIDE,
+    AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
+    -1
+};
+
 AVFilterFormats *avfilter_all_channel_layouts(void)
 {
-    static int64_t chlayouts[] = {
-        AV_CH_LAYOUT_MONO,
-        AV_CH_LAYOUT_STEREO,
-        AV_CH_LAYOUT_4POINT0,
-        AV_CH_LAYOUT_QUAD,
-        AV_CH_LAYOUT_5POINT0,
-        AV_CH_LAYOUT_5POINT0_BACK,
-        AV_CH_LAYOUT_5POINT1,
-        AV_CH_LAYOUT_5POINT1_BACK,
-        AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
-        AV_CH_LAYOUT_7POINT1,
-        AV_CH_LAYOUT_7POINT1_WIDE,
-        AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
-        -1,
-    };
-
-    return avfilter_make_format64_list(chlayouts);
+    return avfilter_make_format64_list(ff_all_channel_layouts);
 }
 
 AVFilterFormats *avfilter_all_packing_formats(void)
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index d03b8b8..f6d4990 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -33,6 +33,8 @@ typedef struct AVFilterPool {
     int count;
 } AVFilterPool;
 
+extern const int64_t ff_all_channel_layouts[];
+
 /**
  * Check for the validity of graph.
  *
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list