mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
sierravmd: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
87e092348b
commit
cd5b4d4ba7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user