From 3428968702d81d84683f9c918b98b2ec0bbd16d2 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Fri, 10 Mar 2023 13:53:03 +0100 Subject: [PATCH] Fix deprecation warning in ffmpeg 6 (fixes #6398) --- src/engine/client/video.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/engine/client/video.cpp b/src/engine/client/video.cpp index 75c6caaa0..0db67bd08 100644 --- a/src/engine/client/video.cpp +++ b/src/engine/client/video.cpp @@ -28,6 +28,12 @@ using namespace std::chrono_literals; #define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */ +#if LIBAVCODEC_VERSION_MAJOR >= 60 +#define FRAME_NUM frame_num +#else +#define FRAME_NUM frame_number +#endif + const size_t FORMAT_GL_NCHANNELS = 4; LOCK g_WriteLock = 0; @@ -325,7 +331,7 @@ void CVideo::NextVideoFrameThread() } } - //dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number); + //dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->FRAME_NUM); // after reading the graphic libraries' frame buffer, go threaded { @@ -371,7 +377,7 @@ void CVideo::NextAudioFrameTimeline(ISoundMixFunc Mix) { if(m_Recording && m_HasAudio) { - //if(m_VideoStream.pEnc->frame_number * (double)m_AudioStream.pEnc->sample_rate / m_FPS >= (double)m_AudioStream.pEnc->frame_number * m_AudioStream.pEnc->frame_size) + //if(m_VideoStream.pEnc->FRAME_NUM * (double)m_AudioStream.pEnc->sample_rate / m_FPS >= (double)m_AudioStream.pEnc->FRAME_NUM * m_AudioStream.pEnc->frame_size) double SamplesPerFrame = (double)m_AudioStream.pEnc->sample_rate / m_FPS; while(m_AudioStream.m_SamplesFrameCount >= m_AudioStream.m_SamplesCount) { @@ -552,7 +558,7 @@ void CVideo::RunVideoThread(size_t ParentThreadIndex, size_t ThreadIndex) std::unique_lock LockVideo(pThreadData->m_VideoFillMutex); { CLockScope ls(g_WriteLock); - m_VideoStream.m_vpFrames[ThreadIndex]->pts = (int64_t)m_VideoStream.pEnc->frame_number; + m_VideoStream.m_vpFrames[ThreadIndex]->pts = (int64_t)m_VideoStream.pEnc->FRAME_NUM; WriteFrame(&m_VideoStream, ThreadIndex); }