filter/ffmpeg: fix FFmpeg 5.1 deprecation warnings

This commit is contained in:
Max Kellermann
2022-08-08 21:31:49 +02:00
parent bbc088ae4e
commit 7c920ddebe
3 changed files with 27 additions and 2 deletions

View File

@@ -40,10 +40,15 @@ FfmpegFilter::FfmpegFilter(const AudioFormat &in_audio_format,
buffer_sink(_buffer_sink),
in_format(Ffmpeg::ToFfmpegSampleFormat(in_audio_format.format)),
in_sample_rate(in_audio_format.sample_rate),
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 25, 100)
in_channels(in_audio_format.channels),
#endif
in_audio_frame_size(in_audio_format.GetFrameSize()),
out_audio_frame_size(_out_audio_format.GetFrameSize())
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 25, 100)
av_channel_layout_default(&in_ch_layout, in_audio_format.channels);
#endif
}
ConstBuffer<void>
@@ -54,7 +59,11 @@ FfmpegFilter::FilterPCM(ConstBuffer<void> src)
frame.Unref();
frame->format = in_format;
frame->sample_rate = in_sample_rate;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 25, 100)
frame->ch_layout = in_ch_layout;
#else
frame->channels = in_channels;
#endif
frame->nb_samples = src.size / in_audio_frame_size;
frame.GetBuffer();

View File

@@ -35,7 +35,13 @@ class FfmpegFilter final : public Filter {
FfmpegBuffer interleave_buffer;
const int in_format, in_sample_rate, in_channels;
const int in_format, in_sample_rate;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 25, 100)
AVChannelLayout in_ch_layout;
#else
const int in_channels;
#endif
const size_t in_audio_frame_size;
const size_t out_audio_frame_size;