filter/ffmpeg: fix FFmpeg 5.1 deprecation warnings
This commit is contained in:
parent
bbc088ae4e
commit
7c920ddebe
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -48,7 +48,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();
|
||||
@ -75,8 +79,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
|
||||
|
Loading…
Reference in New Issue
Block a user