diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-05-13 11:11:26 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:31 -0300 |
commit | 6a9668e17fc7cbc3e2ce0cc2e0d4f8c03f1127b8 (patch) | |
tree | 6bad411539d83d7e63e8ad1f2819c61c57e81139 | |
parent | e4fc86a45877faccff8ee73be76a20a720a85de7 (diff) | |
download | ffmpeg-6a9668e17fc7cbc3e2ce0cc2e0d4f8c03f1127b8.tar.gz |
dcstr: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r-- | libavformat/dcstr.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/dcstr.c b/libavformat/dcstr.c index 71dce08bf7..286ec92df3 100644 --- a/libavformat/dcstr.c +++ b/libavformat/dcstr.c @@ -41,7 +41,7 @@ static int dcstr_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; - st->codecpar->channels = avio_rl32(s->pb); + st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb); st->codecpar->sample_rate = avio_rl32(s->pb); if (st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; @@ -50,14 +50,16 @@ static int dcstr_read_header(AVFormatContext *s) avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); mult = avio_rl32(s->pb); - if (st->codecpar->channels <= 0 || mult <= 0 || mult > INT_MAX / st->codecpar->channels) { - av_log(s, AV_LOG_ERROR, "invalid number of channels %d x %d\n", st->codecpar->channels, mult); + if (st->codecpar->ch_layout.nb_channels <= 0 || mult <= 0 || + mult > INT_MAX / st->codecpar->ch_layout.nb_channels) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d x %d\n", + st->codecpar->ch_layout.nb_channels, mult); return AVERROR_INVALIDDATA; } - st->codecpar->channels *= mult; - if (!align || align > INT_MAX / st->codecpar->channels) + st->codecpar->ch_layout.nb_channels *= mult; + if (!align || align > INT_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; - st->codecpar->block_align = align * st->codecpar->channels; + st->codecpar->block_align = align * st->codecpar->ch_layout.nb_channels; switch (codec) { case 4: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break; |