瀏覽代碼

Merge pull request #1670 from rilian-la-te/ffmpeg-6.0

vcmi: fix build and run with ffmpeg 6.0
Ivan Savenko 2 年之前
父節點
當前提交
20ef84bd55
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      client/CVideoHandler.cpp

+ 6 - 1
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 )