aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/aiffdec.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 13:27:47 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:30 -0300
commit0ecd7106d7393adda82dee4944915572638b6483 (patch)
tree5d27f79f0c59d0addb5f7167fb8ee78944b84bf5 /libavformat/aiffdec.c
parent14bbc23b683a36d5f6b28bee2c003ef6fbc64afc (diff)
downloadffmpeg-0ecd7106d7393adda82dee4944915572638b6483.tar.gz
aiff: 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/aiffdec.c')
-rw-r--r--libavformat/aiffdec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 7afadeb085..3634bb4960 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -99,6 +99,7 @@ static int get_aiff_header(AVFormatContext *s, int size,
uint64_t val;
int sample_rate;
unsigned int num_frames;
+ int channels;
if (size == INT_MAX)
return AVERROR_INVALIDDATA;
@@ -106,7 +107,8 @@ static int get_aiff_header(AVFormatContext *s, int size,
if (size & 1)
size++;
par->codec_type = AVMEDIA_TYPE_AUDIO;
- par->channels = avio_rb16(pb);
+ channels = avio_rb16(pb);
+ par->ch_layout.nb_channels = channels;
num_frames = avio_rb32(pb);
par->bits_per_coded_sample = avio_rb16(pb);
@@ -154,10 +156,10 @@ static int get_aiff_header(AVFormatContext *s, int size,
aiff->block_duration = 1;
break;
case AV_CODEC_ID_ADPCM_IMA_QT:
- par->block_align = 34 * par->channels;
+ par->block_align = 34 * channels;
break;
case AV_CODEC_ID_MACE3:
- par->block_align = 2 * par->channels;
+ par->block_align = 2 * channels;
break;
case AV_CODEC_ID_ADPCM_G726LE:
par->bits_per_coded_sample = 5;
@@ -165,7 +167,7 @@ static int get_aiff_header(AVFormatContext *s, int size,
case AV_CODEC_ID_ADPCM_G722:
case AV_CODEC_ID_MACE6:
case AV_CODEC_ID_SDX2_DPCM:
- par->block_align = 1 * par->channels;
+ par->block_align = 1 * channels;
break;
case AV_CODEC_ID_GSM:
par->block_align = 33;
@@ -182,7 +184,7 @@ static int get_aiff_header(AVFormatContext *s, int size,
/* Block align needs to be computed in all cases, as the definition
* is specific to applications -> here we use the WAVE format definition */
if (!par->block_align)
- par->block_align = (av_get_bits_per_sample(par->codec_id) * par->channels) >> 3;
+ par->block_align = (av_get_bits_per_sample(par->codec_id) * channels) >> 3;
if (aiff->block_duration) {
par->bit_rate = av_rescale(par->sample_rate, par->block_align * 8LL,