[FFmpeg-cvslog] lavu: Drop FF_API_GET_CHANNEL_LAYOUT_COMPAT cruft

Hendrik Leppkes git at videolan.org
Sat Sep 5 20:39:47 CEST 2015


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Sat Sep  5 20:36:19 2015 +0200| [d83dd630a09d310463b525c6471c8d8f47fd20ec] | committer: Hendrik Leppkes

lavu: Drop FF_API_GET_CHANNEL_LAYOUT_COMPAT cruft

FATE refs changed to accomodate for the new default behavior of the function.
Numbers are now interpreted as a channel layout, instead of a number of channels.

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

 libavutil/channel_layout.c    |   38 --------------------------------------
 libavutil/internal.h          |    4 ----
 libavutil/opt.c               |    4 ----
 libavutil/version.h           |    3 ---
 tests/ref/fate/filter-formats |   10 +++++-----
 5 files changed, 5 insertions(+), 54 deletions(-)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index f72b2cf..a59ba46 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -106,11 +106,7 @@ static const struct {
     { "downmix",     2,  AV_CH_LAYOUT_STEREO_DOWNMIX, },
 };
 
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-static uint64_t get_channel_layout_single(const char *name, int name_len, int compat)
-#else
 static uint64_t get_channel_layout_single(const char *name, int name_len)
-#endif
 {
     int i;
     char *end;
@@ -128,27 +124,8 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
             return (int64_t)1 << i;
     i = strtol(name, &end, 10);
 
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-    if (compat) {
-        if (end - name == name_len ||
-            (end + 1 - name == name_len && *end  == 'c')) {
-            layout = av_get_default_channel_layout(i);
-            if (end - name == name_len) {
-                av_log(NULL, AV_LOG_WARNING,
-                       "Single channel layout '%.*s' is interpreted as a number of channels, "
-                       "switch to the syntax '%.*sc' otherwise it will be interpreted as a "
-                       "channel layout number in a later version\n",
-                       name_len, name, name_len, name);
-            }
-            return layout;
-        }
-    } else {
-#endif
     if ((end + 1 - name == name_len && *end  == 'c'))
         return av_get_default_channel_layout(i);
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-    }
-#endif
 
     layout = strtoll(name, &end, 0);
     if (end - name == name_len)
@@ -156,11 +133,7 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
     return 0;
 }
 
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-uint64_t ff_get_channel_layout(const char *name, int compat)
-#else
 uint64_t av_get_channel_layout(const char *name)
-#endif
 {
     const char *n, *e;
     const char *name_end = name + strlen(name);
@@ -168,11 +141,7 @@ uint64_t av_get_channel_layout(const char *name)
 
     for (n = name; n < name_end; n = e + 1) {
         for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-        layout_single = get_channel_layout_single(n, e - n, compat);
-#else
         layout_single = get_channel_layout_single(n, e - n);
-#endif
         if (!layout_single)
             return 0;
         layout |= layout_single;
@@ -180,13 +149,6 @@ uint64_t av_get_channel_layout(const char *name)
     return layout;
 }
 
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-uint64_t av_get_channel_layout(const char *name)
-{
-    return ff_get_channel_layout(name, 1);
-}
-#endif
-
 void av_bprint_channel_layout(struct AVBPrint *bp,
                               int nb_channels, uint64_t channel_layout)
 {
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 047f742..13dbd3b 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -276,10 +276,6 @@ static av_always_inline av_const int avpriv_mirror(int x, int w)
     return x;
 }
 
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-uint64_t ff_get_channel_layout(const char *name, int compat);
-#endif
-
 void ff_check_pixfmt_descriptors(void);
 
 extern const uint8_t ff_reverse[256];
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 8d44e1f..4030fa8 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -395,11 +395,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
         if (!val || !strcmp(val, "none")) {
             *(int64_t *)dst = 0;
         } else {
-#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
-            int64_t cl = ff_get_channel_layout(val, 0);
-#else
             int64_t cl = av_get_channel_layout(val);
-#endif
             if (!cl) {
                 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
                 ret = AVERROR(EINVAL);
diff --git a/libavutil/version.h b/libavutil/version.h
index 2f4d2ef..108e1c7 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -87,9 +87,6 @@
 #ifndef FF_API_VDPAU
 #define FF_API_VDPAU                    (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
-#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT
-#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 55)
-#endif
 #ifndef FF_API_XVMC
 #define FF_API_XVMC                     (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
diff --git a/tests/ref/fate/filter-formats b/tests/ref/fate/filter-formats
index b0377e0..4c303d8 100644
--- a/tests/ref/fate/filter-formats
+++ b/tests/ref/fate/filter-formats
@@ -67,11 +67,11 @@ quad(side)
 8 channels (FL+FR+LFE+BC+SL+SR+DL+DR)
 8 channels (FL+FR+FC+BC+SL+SR+DL+DR)
 -1 = ff_parse_channel_layout(FFFFFFFFFFFFFFFF, -1, blah);
-0 = ff_parse_channel_layout(0000000000000004,  1, 1);
-0 = ff_parse_channel_layout(0000000000000003,  2, 2);
+0 = ff_parse_channel_layout(0000000000000001,  1, 1);
+0 = ff_parse_channel_layout(0000000000000002,  1, 2);
 -1 = ff_parse_channel_layout(FFFFFFFFFFFFFFFF, -1, -1);
-0 = ff_parse_channel_layout(0000000000000000, 60, 60);
--1 = ff_parse_channel_layout(FFFFFFFFFFFFFFFF, -1, 65);
+0 = ff_parse_channel_layout(000000000000003C,  4, 60);
+0 = ff_parse_channel_layout(0000000000000041,  2, 65);
 0 = ff_parse_channel_layout(0000000000000004,  1, 1c);
 0 = ff_parse_channel_layout(0000000000000003,  2, 2c);
 -1 = ff_parse_channel_layout(FFFFFFFFFFFFFFFF, -1, -1c);
@@ -79,7 +79,7 @@ quad(side)
 -1 = ff_parse_channel_layout(FFFFFFFFFFFFFFFF, -1, 65c);
 0 = ff_parse_channel_layout(000000000000003F,  6, 5.1);
 0 = ff_parse_channel_layout(0000000000000003,  2, stereo);
-0 = ff_parse_channel_layout(0000000000000004,  1, 1+1+1+1);
+0 = ff_parse_channel_layout(0000000000000001,  1, 1+1+1+1);
 0 = ff_parse_channel_layout(0000000000000004,  1, 1c+1c+1c+1c);
 0 = ff_parse_channel_layout(0000000000000007,  3, 2c+1c);
 0 = ff_parse_channel_layout(0000000000000003,  2, 0x3);



More information about the ffmpeg-cvslog mailing list