1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

bit: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Anton Khirnov 2019-05-13 11:11:26 +02:00 committed by James Almer
parent f508915777
commit fc5e819f65

View File

@ -63,7 +63,7 @@ static int read_header(AVFormatContext *s)
st->codecpar->codec_id=AV_CODEC_ID_G729;
st->codecpar->sample_rate=8000;
st->codecpar->block_align = 16;
st->codecpar->channels=1;
st->codecpar->ch_layout.nb_channels = 1;
avpriv_set_pts_info(st, 64, 1, 100);
return 0;
@ -124,14 +124,14 @@ static int write_header(AVFormatContext *s)
{
AVCodecParameters *par = s->streams[0]->codecpar;
if ((par->codec_id != AV_CODEC_ID_G729) || par->channels != 1) {
if ((par->codec_id != AV_CODEC_ID_G729) || par->ch_layout.nb_channels != 1) {
av_log(s, AV_LOG_ERROR,
"only codec g729 with 1 channel is supported by this format\n");
return AVERROR(EINVAL);
}
par->bits_per_coded_sample = 16;
par->block_align = (par->bits_per_coded_sample * par->channels) >> 3;
par->block_align = (par->bits_per_coded_sample * par->ch_layout.nb_channels) >> 3;
return 0;
}