[FFmpeg-devel] [PATCH 071/281] gxf: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:50:33 EET 2022


From: Vittorio Giovara <vittorio.giovara at gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/gxf.c    | 9 +++------
 libavformat/gxfenc.c | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 6f370c1b57..d96e0796f4 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -143,8 +143,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
         case 9:
             st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
-            st->codecpar->channels = 1;
-            st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
+            st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
             st->codecpar->sample_rate = 48000;
             st->codecpar->bit_rate = 3 * 1 * 48000 * 8;
             st->codecpar->block_align = 3 * 1;
@@ -153,8 +152,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
         case 10:
             st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
-            st->codecpar->channels = 1;
-            st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
+            st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
             st->codecpar->sample_rate = 48000;
             st->codecpar->bit_rate = 2 * 1 * 48000 * 8;
             st->codecpar->block_align = 2 * 1;
@@ -163,8 +161,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
         case 17:
             st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codecpar->codec_id = AV_CODEC_ID_AC3;
-            st->codecpar->channels = 2;
-            st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
+            st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
             st->codecpar->sample_rate = 48000;
             break;
         case 26: /* AVCi50 / AVCi100 (AVC Intra) */
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 133d1e9fb3..e25d8764ba 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -714,7 +714,7 @@ static int gxf_write_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "only 48000hz sampling rate is allowed\n");
                 return -1;
             }
-            if (st->codecpar->channels != 1) {
+            if (st->codecpar->ch_layout.nb_channels != 1) {
                 av_log(s, AV_LOG_ERROR, "only mono tracks are allowed\n");
                 return -1;
             }
-- 
2.34.1



More information about the ffmpeg-devel mailing list