pcm: 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>
This commit is contained in:
Vittorio Giovara 2017-03-31 18:06:05 +02:00 committed by James Almer
parent 57141d73c7
commit 5347f2920f
2 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ int ff_pcm_read_seek(AVFormatContext *s,
st = s->streams[0];
block_align = st->codecpar->block_align ? st->codecpar->block_align :
(av_get_bits_per_sample(st->codecpar->codec_id) * st->codecpar->channels) >> 3;
(av_get_bits_per_sample(st->codecpar->codec_id) * st->codecpar->ch_layout.nb_channels) >> 3;
byte_rate = st->codecpar->bit_rate ? st->codecpar->bit_rate >> 3 :
block_align * st->codecpar->sample_rate;

View File

@ -48,7 +48,7 @@ static int pcm_read_header(AVFormatContext *s)
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = s->iformat->raw_codec_id;
par->sample_rate = s1->sample_rate;
par->channels = s1->channels;
par->ch_layout.nb_channels = s1->channels;
av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type);
if (mime_type && s->iformat->mime_type) {
@ -77,7 +77,7 @@ static int pcm_read_header(AVFormatContext *s)
}
par->sample_rate = rate;
if (channels > 0)
par->channels = channels;
par->ch_layout.nb_channels = channels;
if (little_endian)
par->codec_id = AV_CODEC_ID_PCM_S16LE;
}
@ -88,7 +88,7 @@ static int pcm_read_header(AVFormatContext *s)
av_assert0(par->bits_per_coded_sample > 0);
par->block_align = par->bits_per_coded_sample * par->channels / 8;
par->block_align = par->bits_per_coded_sample * par->ch_layout.nb_channels / 8;
avpriv_set_pts_info(st, 64, 1, par->sample_rate);
return 0;