[010/200] af_aformat: convert to new channel layout API

Message ID 20170517174712.8625-11-vittorio.giovara@gmail.com
State New
Headers show

Commit Message

Vittorio Giovara May 17, 2017, 5:47 p.m.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
---
 libavfilter/af_aformat.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch

diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index f0746737dc..c5aa4f7148 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -94,6 +94,13 @@  static int get_sample_rate(const char *samplerate)
     return FFMAX(ret, 0);
 }
 
+static int get_channel_layout(const char *channel_layout)
+{
+    AVChannelLayout ch_layout = {0};
+    av_channel_layout_from_string(&ch_layout, channel_layout);
+    return ch_layout.u.mask;
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
     AFormatContext *s = ctx->priv;
@@ -103,8 +110,7 @@  static av_cold int init(AVFilterContext *ctx)
     PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format,
                   get_sample_rate, 0, "sample rate");
     PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts,
-                  ff_add_channel_layout, av_get_channel_layout, 0,
-                  "channel layout");
+                  ff_add_channel_layout, get_channel_layout, 0, "channel layout");
 
     return 0;
 }