aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/sierravmd.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 18:30:08 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:37 -0300
commitcd5b4d4ba7d5fea9cf7f3b8469a1c140c916e600 (patch)
tree7498c1c00957f5a4a723a3af0bd65960a287c300 /libavformat/sierravmd.c
parent87e092348b1577aa989b8b44d9c708112e1b27b7 (diff)
downloadffmpeg-cd5b4d4ba7d5fea9cf7f3b8469a1c140c916e600.tar.gz
sierravmd: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/sierravmd.c')
-rw-r--r--libavformat/sierravmd.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index e35faae50d..d110457ec9 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -134,6 +134,7 @@ static int vmd_read_header(AVFormatContext *s)
/* if sample rate is 0, assume no audio */
vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]);
if (vmd->sample_rate) {
+ int channels;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
@@ -150,24 +151,22 @@ static int vmd_read_header(AVFormatContext *s)
st->codecpar->bits_per_coded_sample = 8;
}
if (vmd->vmd_header[811] & 0x80) {
- st->codecpar->channels = 2;
- st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
+ channels = 2;
} else if (vmd->vmd_header[811] & 0x2) {
/* Shivers 2 stereo audio */
/* Frame length is for 1 channel */
- st->codecpar->channels = 2;
- st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
+ channels = 2;
st->codecpar->block_align = st->codecpar->block_align << 1;
} else {
- st->codecpar->channels = 1;
- st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
+ channels = 1;
}
+ av_channel_layout_default(&st->codecpar->ch_layout, channels);
st->codecpar->bit_rate = st->codecpar->sample_rate *
- st->codecpar->bits_per_coded_sample * st->codecpar->channels;
+ st->codecpar->bits_per_coded_sample * channels;
/* calculate pts */
num = st->codecpar->block_align;
- den = st->codecpar->sample_rate * st->codecpar->channels;
+ den = st->codecpar->sample_rate * channels;
av_reduce(&num, &den, num, den, (1UL<<31)-1);
if (vst)
avpriv_set_pts_info(vst, 33, num, den);