mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-12 19:24:22 +08:00
适配FFmpeg7.1 (#4102)
ffmpeg中FF_API_OLD_CHANNEL_LAYOUT系列API在2024年3月的提交中已经正式移除了,对应release7.0,使用ffmpeg7.0及以上版本编译zlm会报错。
This commit is contained in:
@@ -97,7 +97,13 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
decoder->setOnDecode([audio_player, swr](const FFmpegFrame::Ptr &frame) mutable {
|
||||
if (!swr) {
|
||||
|
||||
# if LIBAVCODEC_VERSION_INT >= FF_CODEC_VER_7_1
|
||||
swr = std::make_shared<FFmpegSwr>(AV_SAMPLE_FMT_S16, &(frame->get()->ch_layout), frame->get()->sample_rate);
|
||||
#else
|
||||
swr = std::make_shared<FFmpegSwr>(AV_SAMPLE_FMT_S16, frame->get()->channels, frame->get()->channel_layout, frame->get()->sample_rate);
|
||||
#endif
|
||||
|
||||
}
|
||||
auto pcm = swr->inputFrame(frame);
|
||||
auto len = pcm->get()->nb_samples * pcm->get()->channels * av_get_bytes_per_sample((enum AVSampleFormat)pcm->get()->format);
|
||||
|
||||
Reference in New Issue
Block a user