Commit 841d2d51 authored by Vittorio Giovara's avatar Vittorio Giovara Committed by James Almer

wsd: convert to new channel layout API

Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent bc67df69
...@@ -128,18 +128,21 @@ static int wsd_read_header(AVFormatContext *s) ...@@ -128,18 +128,21 @@ static int wsd_read_header(AVFormatContext *s)
st->codecpar->codec_id = s->iformat->raw_codec_id; st->codecpar->codec_id = s->iformat->raw_codec_id;
st->codecpar->sample_rate = avio_rb32(pb) / 8; st->codecpar->sample_rate = avio_rb32(pb) / 8;
avio_skip(pb, 4); avio_skip(pb, 4);
st->codecpar->channels = avio_r8(pb) & 0xF; st->codecpar->ch_layout.nb_channels = avio_r8(pb) & 0xF;
st->codecpar->bit_rate = (int64_t)st->codecpar->channels * st->codecpar->sample_rate * 8LL; st->codecpar->bit_rate = (int64_t)st->codecpar->ch_layout.nb_channels *
if (!st->codecpar->channels) st->codecpar->sample_rate * 8LL;
if (!st->codecpar->ch_layout.nb_channels)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
avio_skip(pb, 3); avio_skip(pb, 3);
channel_assign = avio_rb32(pb); channel_assign = avio_rb32(pb);
if (!(channel_assign & 1)) { if (!(channel_assign & 1)) {
uint64_t ch_mask = 0;
int i; int i;
for (i = 1; i < 32; i++) for (i = 1; i < 32; i++)
if ((channel_assign >> i) & 1) if ((channel_assign >> i) & 1)
st->codecpar->channel_layout |= wsd_to_av_channel_layoyt(s, i); ch_mask |= wsd_to_av_channel_layoyt(s, i);
av_channel_layout_from_mask(&st->codecpar->ch_layout, ch_mask);
} }
avio_skip(pb, 16); avio_skip(pb, 16);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment