1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

ads: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Anton Khirnov 2019-05-13 11:11:26 +02:00 committed by James Almer
parent ced933a394
commit a4630dc046

View File

@ -48,11 +48,11 @@ static int ads_read_header(AVFormatContext *s)
st->codecpar->sample_rate = avio_rl32(s->pb);
if (st->codecpar->sample_rate <= 0)
return AVERROR_INVALIDDATA;
st->codecpar->channels = avio_rl32(s->pb);
if (st->codecpar->channels <= 0)
st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb);
if (st->codecpar->ch_layout.nb_channels <= 0)
return AVERROR_INVALIDDATA;
align = avio_rl32(s->pb);
if (align <= 0 || align > INT_MAX / st->codecpar->channels)
if (align <= 0 || align > INT_MAX / st->codecpar->ch_layout.nb_channels)
return AVERROR_INVALIDDATA;
if (codec == 1)
@ -60,11 +60,11 @@ static int ads_read_header(AVFormatContext *s)
else
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
st->codecpar->block_align = st->codecpar->channels * align;
st->codecpar->block_align = st->codecpar->ch_layout.nb_channels * align;
avio_skip(s->pb, 12);
size = avio_rl32(s->pb);
if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX && size >= 0x40)
st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28;
st->duration = (size - 0x40) / 16 / st->codecpar->ch_layout.nb_channels * 28;
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
return 0;