Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 14:40:18 +0300
committerJames Almer <jamrial@gmail.com>2022-03-15 15:42:31 +0300
commiteaad010f7b7057d03ec3c8048dfe519f0226f203 (patch)
tree2ad37bf446819960573a417009243240e7547803 /libavformat/cafenc.c
parent658102a823ca2aaa9d241d825291a2b05af06626 (diff)
caf: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/cafenc.c')
-rw-r--r--libavformat/cafenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 412b3230e3..396e946ceb 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -122,7 +122,7 @@ static int caf_write_header(AVFormatContext *s)
return AVERROR_PATCHWELCOME;
}
- if (par->codec_id == AV_CODEC_ID_OPUS && par->channels > 2) {
+ if (par->codec_id == AV_CODEC_ID_OPUS && par->ch_layout.nb_channels > 2) {
av_log(s, AV_LOG_ERROR, "Only mono and stereo are supported for Opus\n");
return AVERROR_INVALIDDATA;
}
@@ -138,7 +138,7 @@ static int caf_write_header(AVFormatContext *s)
}
if (par->codec_id != AV_CODEC_ID_MP3 || frame_size != 576)
- frame_size = samples_per_packet(par->codec_id, par->channels, par->block_align);
+ frame_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align);
ffio_wfourcc(pb, "caff"); //< mFileType
avio_wb16(pb, 1); //< mFileVersion
@@ -151,13 +151,13 @@ static int caf_write_header(AVFormatContext *s)
avio_wb32(pb, codec_flags(par->codec_id)); //< mFormatFlags
avio_wb32(pb, par->block_align); //< mBytesPerPacket
avio_wb32(pb, frame_size); //< mFramesPerPacket
- avio_wb32(pb, par->channels); //< mChannelsPerFrame
+ avio_wb32(pb, par->ch_layout.nb_channels); //< mChannelsPerFrame
avio_wb32(pb, av_get_bits_per_sample(par->codec_id)); //< mBitsPerChannel
- if (par->channel_layout) {
+ if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) {
ffio_wfourcc(pb, "chan");
avio_wb64(pb, 12);
- ff_mov_write_chan(pb, par->channel_layout);
+ ff_mov_write_chan(pb, par->ch_layout.u.mask);
}
if (par->codec_id == AV_CODEC_ID_ALAC) {
@@ -247,7 +247,7 @@ static int caf_write_trailer(AVFormatContext *s)
avio_seek(pb, caf->data, SEEK_SET);
avio_wb64(pb, file_size - caf->data - 8);
if (!par->block_align) {
- int packet_size = samples_per_packet(par->codec_id, par->channels, par->block_align);
+ int packet_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align);
if (!packet_size) {
packet_size = st->duration / (caf->packets - 1);
avio_seek(pb, FRAME_SIZE_OFFSET, SEEK_SET);