From 42244757cff145f60b156fde0e65bfe61c3cc24f Mon Sep 17 00:00:00 2001 From: Arjan Speiard | Asgard Sings! Date: Mon, 8 Jan 2024 16:29:13 +0100 Subject: [PATCH] ffmpeg fixes --- src/ffmpeg.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ffmpeg.cc b/src/ffmpeg.cc index 32fc6b2..022aedc 100644 --- a/src/ffmpeg.cc +++ b/src/ffmpeg.cc @@ -68,7 +68,9 @@ double FFmpeg::duration() const { void FFmpeg::open() { QMutexLocker l(&s_avcodec_mutex); +#if (LIBAVFORMAT_VERSION_INT) <= (AV_VERSION_INT(59, 0, 100)) av_register_all(); +#endif av_log_set_level(AV_LOG_ERROR); if (avformat_open_input(&pFormatCtx, m_filename.c_str(), NULL, NULL)) throw std::runtime_error("Cannot open input file"); if (avformat_find_stream_info(pFormatCtx, NULL) < 0) throw std::runtime_error("Cannot find stream information"); @@ -82,6 +84,9 @@ void FFmpeg::open() { } if (audioStream == -1) throw std::runtime_error("No audio stream found"); AVCodecContext* cc = pFormatCtx->streams[audioStream]->codec; +#if (LIBAVFORMAT_VERSION_INT) >= (AV_VERSION_INT(59, 0, 100)) + const +#endif pAudioCodec = avcodec_find_decoder(cc->codec_id); audioQueue.setRateChannels(m_rate, 2); if (!pAudioCodec) throw std::runtime_error("Cannot find audio codec");