summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/cafdec.c6
-rw-r--r--libavformat/cafenc.c12
2 files changed, 9 insertions, 9 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 4b5b15b58d..f0c2c50c59 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -76,10 +76,10 @@ static int read_desc_chunk(AVFormatContext *s)
caf->bytes_per_packet = avio_rb32(pb);
st->codecpar->block_align = caf->bytes_per_packet;
caf->frames_per_packet = avio_rb32(pb);
- st->codecpar->channels = avio_rb32(pb);
+ st->codecpar->ch_layout.nb_channels = avio_rb32(pb);
st->codecpar->bits_per_coded_sample = avio_rb32(pb);
- if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0 || st->codecpar->channels < 0)
+ if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0 || st->codecpar->ch_layout.nb_channels < 0)
return AVERROR_INVALIDDATA;
/* calculate bit rate for constant size packets */
@@ -172,7 +172,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
} else if (st->codecpar->codec_id == AV_CODEC_ID_OPUS) {
// The data layout for Opus is currently unknown, so we do not export
// extradata at all. Multichannel streams are not supported.
- if (st->codecpar->channels > 2) {
+ if (st->codecpar->ch_layout.nb_channels > 2) {
avpriv_request_sample(s, "multichannel Opus in CAF");
return AVERROR_PATCHWELCOME;
}
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);