aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/musx.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-05-13 11:11:26 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:35 -0300
commit6bc5485c077f9b48c9cec5562ebbafd08f6f8255 (patch)
tree8b7ec70d109c8fd49ee5686bff0b6f636738e791 /libavformat/musx.c
parentc46192de21b3de21cdb455d09fa0688501b0ac69 (diff)
downloadffmpeg-6bc5485c077f9b48c9cec5562ebbafd08f6f8255.tar.gz
musx: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/musx.c')
-rw-r--r--libavformat/musx.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/libavformat/musx.c b/libavformat/musx.c
index fd5a9297f9..5bf793f882 100644
--- a/libavformat/musx.c
+++ b/libavformat/musx.c
@@ -68,30 +68,30 @@ static int musx_read_header(AVFormatContext *s)
offset = avio_rl32(s->pb);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
st->codecpar->sample_rate = 32000;
- st->codecpar->block_align = 0x80 * st->codecpar->channels;
+ st->codecpar->block_align = 0x80 * st->codecpar->ch_layout.nb_channels;
} else if (version == 10) {
type = avio_rl32(s->pb);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
offset = 0x800;
switch (type) {
case MKTAG('P', 'S', '3', '_'):
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
st->codecpar->sample_rate = 44100;
avio_skip(s->pb, 44);
coding = avio_rl32(s->pb);
if (coding == MKTAG('D', 'A', 'T', '4') ||
coding == MKTAG('D', 'A', 'T', '8')) {
avio_skip(s->pb, 4);
- st->codecpar->channels = avio_rl32(s->pb);
- if (st->codecpar->channels <= 0 ||
- st->codecpar->channels > INT_MAX / 0x20)
+ st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb);
+ if (st->codecpar->ch_layout.nb_channels <= 0 ||
+ st->codecpar->ch_layout.nb_channels > INT_MAX / 0x20)
return AVERROR_INVALIDDATA;
st->codecpar->sample_rate = avio_rl32(s->pb);
}
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_DAT4;
- st->codecpar->block_align = 0x20 * st->codecpar->channels;
+ st->codecpar->block_align = 0x20 * st->codecpar->ch_layout.nb_channels;
break;
case MKTAG('W', 'I', 'I', '_'):
avio_skip(s->pb, 44);
@@ -103,30 +103,30 @@ static int musx_read_header(AVFormatContext *s)
}
avio_skip(s->pb, 4);
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_DAT4;
- st->codecpar->channels = avio_rl32(s->pb);
- if (st->codecpar->channels <= 0 ||
- st->codecpar->channels > INT_MAX / 0x20)
+ st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb);
+ if (st->codecpar->ch_layout.nb_channels <= 0 ||
+ st->codecpar->ch_layout.nb_channels > INT_MAX / 0x20)
return AVERROR_INVALIDDATA;
st->codecpar->sample_rate = avio_rl32(s->pb);
- st->codecpar->block_align = 0x20 * st->codecpar->channels;
+ st->codecpar->block_align = 0x20 * st->codecpar->ch_layout.nb_channels;
break;
case MKTAG('X', 'E', '_', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_DAT4;
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
st->codecpar->sample_rate = 32000;
- st->codecpar->block_align = 0x20 * st->codecpar->channels;
+ st->codecpar->block_align = 0x20 * st->codecpar->ch_layout.nb_channels;
break;
case MKTAG('P', 'S', 'P', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
st->codecpar->sample_rate = 32768;
- st->codecpar->block_align = 0x80 * st->codecpar->channels;
+ st->codecpar->block_align = 0x80 * st->codecpar->ch_layout.nb_channels;
break;
case MKTAG('P', 'S', '2', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
st->codecpar->sample_rate = 32000;
- st->codecpar->block_align = 0x80 * st->codecpar->channels;
+ st->codecpar->block_align = 0x80 * st->codecpar->ch_layout.nb_channels;
break;
default:
avpriv_request_sample(s, "Unsupported type: %X", type);
@@ -136,23 +136,23 @@ static int musx_read_header(AVFormatContext *s)
type = avio_rl32(s->pb);
avio_skip(s->pb, 20);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codecpar->channels = 2;
+ st->codecpar->ch_layout.nb_channels = 2;
switch (type) {
case MKTAG('G', 'C', '_', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_DAT4;
- st->codecpar->block_align = 0x20 * st->codecpar->channels;
+ st->codecpar->block_align = 0x20 * st->codecpar->ch_layout.nb_channels;
st->codecpar->sample_rate = 32000;
offset = avio_rb32(s->pb);
break;
case MKTAG('P', 'S', '2', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
- st->codecpar->block_align = 0x80 * st->codecpar->channels;
+ st->codecpar->block_align = 0x80 * st->codecpar->ch_layout.nb_channels;
st->codecpar->sample_rate = 32000;
offset = avio_rl32(s->pb);
break;
case MKTAG('X', 'B', '_', '_'):
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_DAT4;
- st->codecpar->block_align = 0x20 * st->codecpar->channels;
+ st->codecpar->block_align = 0x20 * st->codecpar->ch_layout.nb_channels;
st->codecpar->sample_rate = 44100;
offset = avio_rl32(s->pb);
break;