From a72af34d9fb691186b7b4bd7acd49b38cc25f096 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sat, 11 Mar 2023 00:11:17 +0300 Subject: [PATCH] vcmi: fix build and run with ffmpeg 6.0 --- client/CVideoHandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/CVideoHandler.cpp b/client/CVideoHandler.cpp index 41837733d..4979b7ac0 100644 --- a/client/CVideoHandler.cpp +++ b/client/CVideoHandler.cpp @@ -364,7 +364,12 @@ void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, boo if (sws == nullptr) return; - double frameEndTime = (frame->pts + frame->pkt_duration) * av_q2d(format->streams[stream]->time_base); +#if (LIBAVUTIL_VERSION_MAJOR < 58) + auto packet_duration = frame->pkt_duration; +#else + auto packet_duration = frame->duration; +#endif + double frameEndTime = (frame->pts + packet_duration) * av_q2d(format->streams[stream]->time_base); frameTime += GH.mainFPSmng->getElapsedMilliseconds() / 1000.0; if (frameTime >= frameEndTime )