diff mbox series

[FFmpeg-devel,058/281] flac: convert to new channel layout API

Message ID 20220113015101.4-59-jamrial@gmail.com
State New
Headers show
Series New channel layout API | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

James Almer Jan. 13, 2022, 1:50 a.m. UTC
From: Vittorio Giovara <vittorio.giovara@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/flacdec.c | 3 +--
 libavformat/flacenc.c | 7 +++----
 2 files changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 3401aebe8d..bfae5a2af1 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -191,8 +191,7 @@  static int flac_read_header(AVFormatContext *s)
                         av_log(s, AV_LOG_WARNING,
                                "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
                     } else {
-                        st->codecpar->channel_layout = mask;
-                        st->codecpar->channels       = av_get_channel_layout_nb_channels(mask);
+                        av_channel_layout_from_mask(&st->codecpar->ch_layout, mask);
                         av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
                     }
                 }
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b267197ccc..eaaf774f9e 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -238,9 +238,8 @@  static int flac_init(struct AVFormatContext *s)
     }
 
     /* add the channel layout tag */
-    if (par->channel_layout &&
-        !(par->channel_layout & ~0x3ffffULL) &&
-        !ff_flac_is_native_layout(par->channel_layout)) {
+    if (!av_channel_layout_subset(&par->ch_layout, ~0x3ffffULL) &&
+        !ff_flac_is_native_layout(par->ch_layout.u.mask)) {
         AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
                                                 NULL, 0);
 
@@ -249,7 +248,7 @@  static int flac_init(struct AVFormatContext *s)
                    "already present, this muxer will not overwrite it.\n");
         } else {
             uint8_t buf[32];
-            snprintf(buf, sizeof(buf), "0x%"PRIx64, par->channel_layout);
+            snprintf(buf, sizeof(buf), "0x%"PRIx64, par->ch_layout.u.mask);
             av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
         }
     }