aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 19:01:03 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:39 -0300
commit841d2d51c2f79a1fd8d42e53896fcb1093924875 (patch)
tree6e73094a6a2e195792b801135077578d663a7290
parentbc67df697b300e0fd792bf46c7726ca8478cb2ef (diff)
downloadffmpeg-841d2d51c2f79a1fd8d42e53896fcb1093924875.tar.gz
wsd: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/wsddec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c
index 1f90f5b467..9bee4d51bb 100644
--- a/libavformat/wsddec.c
+++ b/libavformat/wsddec.c
@@ -128,18 +128,21 @@ static int wsd_read_header(AVFormatContext *s)
st->codecpar->codec_id = s->iformat->raw_codec_id;
st->codecpar->sample_rate = avio_rb32(pb) / 8;
avio_skip(pb, 4);
- st->codecpar->channels = avio_r8(pb) & 0xF;
- st->codecpar->bit_rate = (int64_t)st->codecpar->channels * st->codecpar->sample_rate * 8LL;
- if (!st->codecpar->channels)
+ st->codecpar->ch_layout.nb_channels = avio_r8(pb) & 0xF;
+ st->codecpar->bit_rate = (int64_t)st->codecpar->ch_layout.nb_channels *
+ st->codecpar->sample_rate * 8LL;
+ if (!st->codecpar->ch_layout.nb_channels)
return AVERROR_INVALIDDATA;
avio_skip(pb, 3);
channel_assign = avio_rb32(pb);
if (!(channel_assign & 1)) {
+ uint64_t ch_mask = 0;
int i;
for (i = 1; i < 32; i++)
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);