diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index f2dbb8a0d0..4c4a4b0e59 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1023,10 +1023,17 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA sws_freeContext(img_convert_ctx); // update timestamp - if (av_frame_get_best_effort_timestamp(mediaengine->m_pFrame) != AV_NOPTS_VALUE) - mediaengine->m_videopts = av_frame_get_best_effort_timestamp(mediaengine->m_pFrame) + av_frame_get_pkt_duration(mediaengine->m_pFrame) - mediaengine->m_firstTimeStamp; +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100) + int64_t bestPts = mediaengine->m_pFrame->best_effort_timestamp; + int64_t ptsDuration = mediaengine->m_pFrame->pkt_duration; +#else + int64_t bestPts = av_frame_get_best_effort_timestamp(mediaengine->m_pFrame); + int64_t ptsDuration = av_frame_get_pkt_duration(mediaengine->m_pFrame); +#endif + if (bestPts != AV_NOPTS_VALUE) + mediaengine->m_videopts = bestPts + ptsDuration - mediaengine->m_firstTimeStamp; else - mediaengine->m_videopts += av_frame_get_pkt_duration(mediaengine->m_pFrame); + mediaengine->m_videopts += ptsDuration; // push the decoded frame into pmp_queue pmp_queue.push_back(pFrameRGB); diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 0a1e50f527..2da0792edf 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -666,10 +666,17 @@ bool MediaEngine::stepVideo(int videoPixelMode, bool skipFrame) { m_pCodecCtx->height, m_pFrameRGB->data, m_pFrameRGB->linesize); } - if (av_frame_get_best_effort_timestamp(m_pFrame) != AV_NOPTS_VALUE) - m_videopts = av_frame_get_best_effort_timestamp(m_pFrame) + av_frame_get_pkt_duration(m_pFrame) - m_firstTimeStamp; +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100) + int64_t bestPts = m_pFrame->best_effort_timestamp; + int64_t ptsDuration = m_pFrame->pkt_duration; +#else + int64_t bestPts = av_frame_get_best_effort_timestamp(m_pFrame); + int64_t ptsDuration = av_frame_get_pkt_duration(m_pFrame); +#endif + if (bestPts != AV_NOPTS_VALUE) + m_videopts = bestPts + ptsDuration - m_firstTimeStamp; else - m_videopts += av_frame_get_pkt_duration(m_pFrame); + m_videopts += ptsDuration; bGetFrame = true; } if (result <= 0 && dataEnd) {