svag: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
release/5.1
Anton Khirnov 6 years ago committed by James Almer
parent 84aee1dc1e
commit ebe8ba131f
  1. 11
      libavformat/svag.c

@ -47,14 +47,15 @@ static int svag_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->channels > 8)
st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb);
if (st->codecpar->ch_layout.nb_channels <= 0 ||
st->codecpar->ch_layout.nb_channels > 8)
return AVERROR_INVALIDDATA;
st->duration = size / (16 * st->codecpar->channels) * 28;
st->duration = size / (16 * st->codecpar->ch_layout.nb_channels) * 28;
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;
st->codecpar->block_align = align * st->codecpar->channels;
st->codecpar->block_align = align * st->codecpar->ch_layout.nb_channels;
avio_skip(s->pb, 0x800 - avio_tell(s->pb));
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);

Loading…
Cancel
Save