diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-03-31 14:04:07 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:32 -0300 |
commit | 53a132f0c5a067c1f49bd4dc3af60b833e42598a (patch) | |
tree | e775a079907a3e612832598c0518eec7c3f6bc70 /libavformat/flvdec.c | |
parent | ce5165f8ada0f2744a23af0b94fe32ab71c75255 (diff) | |
download | ffmpeg-53a132f0c5a067c1f49bd4dc3af60b833e42598a.tar.gz |
flv: 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>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index b9e36b3ff1..cb24b1cc26 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -629,10 +629,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (!strcmp(key, "audiosamplesize") && apar) { apar->bits_per_coded_sample = num_val; } else if (!strcmp(key, "stereo") && apar) { - apar->channels = num_val + 1; - apar->channel_layout = apar->channels == 2 ? - AV_CH_LAYOUT_STEREO : - AV_CH_LAYOUT_MONO; + av_channel_layout_default(&apar->ch_layout, num_val + 1); } else if (!strcmp(key, "width") && vpar) { vpar->width = num_val; } else if (!strcmp(key, "height") && vpar) { @@ -1202,12 +1199,10 @@ retry_duration: sample_rate = 44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3; bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; - if (!st->codecpar->channels || !st->codecpar->sample_rate || + if (!av_channel_layout_check(&st->codecpar->ch_layout) || + !st->codecpar->sample_rate || !st->codecpar->bits_per_coded_sample) { - st->codecpar->channels = channels; - st->codecpar->channel_layout = channels == 1 - ? AV_CH_LAYOUT_MONO - : AV_CH_LAYOUT_STEREO; + av_channel_layout_default(&st->codecpar->ch_layout, channels); st->codecpar->sample_rate = sample_rate; st->codecpar->bits_per_coded_sample = bits_per_coded_sample; } @@ -1217,7 +1212,7 @@ retry_duration: flv->last_sample_rate = sample_rate = st->codecpar->sample_rate; flv->last_channels = - channels = st->codecpar->channels; + channels = st->codecpar->ch_layout.nb_channels; } else { AVCodecParameters *par = avcodec_parameters_alloc(); if (!par) { |