nuv: 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:
Vittorio Giovara 2017-03-31 17:53:51 +02:00 committed by James Almer
parent b9298dad94
commit f81417a6d2
1 changed files with 6 additions and 6 deletions

View File

@ -116,10 +116,11 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
ast->codecpar->bits_per_coded_sample = avio_rl32(pb); ast->codecpar->bits_per_coded_sample = avio_rl32(pb);
ast->codecpar->channels = avio_rl32(pb); av_channel_layout_uninit(&ast->codecpar->ch_layout);
ast->codecpar->channel_layout = 0; ast->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
if (ast->codecpar->channels <= 0) { ast->codecpar->ch_layout.nb_channels = avio_rl32(pb);
av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->channels); if (ast->codecpar->ch_layout.nb_channels <= 0) {
av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->ch_layout.nb_channels);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -227,8 +228,7 @@ static int nuv_header(AVFormatContext *s)
ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
ast->codecpar->channels = 2; ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
ast->codecpar->sample_rate = 44100; ast->codecpar->sample_rate = 44100;
ast->codecpar->bit_rate = 2 * 2 * 44100 * 8; ast->codecpar->bit_rate = 2 * 2 * 44100 * 8;
ast->codecpar->block_align = 2 * 2; ast->codecpar->block_align = 2 * 2;