Merge branch 'v0.23.x'

This commit is contained in:
Max Kellermann
2022-08-08 23:46:22 +02:00
19 changed files with 234 additions and 149 deletions

View File

@@ -47,7 +47,11 @@ DetectFilterOutputFormat(const AudioFormat &in_audio_format,
Frame frame;
frame->format = ToFfmpegSampleFormat(in_audio_format.format);
frame->sample_rate = in_audio_format.sample_rate;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 25, 100)
av_channel_layout_default(&frame->ch_layout, in_audio_format.channels);
#else
frame->channels = in_audio_format.channels;
#endif
frame->nb_samples = 1;
frame.GetBuffer();
@@ -74,8 +78,14 @@ DetectFilterOutputFormat(const AudioFormat &in_audio_format,
if (sample_format == SampleFormat::UNDEFINED)
throw std::runtime_error("Unsupported FFmpeg sample format");
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 25, 100)
const unsigned out_channels = frame->ch_layout.nb_channels;
#else
const unsigned out_channels = frame->channels;
#endif
return CheckAudioFormat(frame->sample_rate, sample_format,
frame->channels);
out_channels);
}
} // namespace Ffmpeg