Cleanup: Deprecation warning in the FFmpeg #108451

Merged
Sergey Sharybin merged 1 commits from Sergey/blender:ffmpeg into main 2023-05-31 16:41:54 +02:00
2 changed files with 13 additions and 2 deletions

View File

@ -123,6 +123,17 @@ int64_t av_get_pts_from_frame(AVFrame *picture)
return timestamp_from_pts_or_dts(picture->pts, picture->pkt_dts);
}
/* Duration of the frame, in the same units as pts. 0 if unknown. */
FFMPEG_INLINE
int64_t av_get_frame_duration_in_pts_units(const AVFrame *picture)
{
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 30, 100)
return picture->pkt_duration;
#else
return picture->duration;
#endif
}
/* -------------------------------------------------------------------- */
/** \name Deinterlace code block
*

View File

@ -955,7 +955,7 @@ static AVFrame *ffmpeg_frame_by_pts_get(struct anim *anim, int64_t pts_to_search
const bool backup_frame_ready = anim->pFrame_backup_complete;
const int64_t recent_start = av_get_pts_from_frame(anim->pFrame);
const int64_t recent_end = recent_start + anim->pFrame->pkt_duration;
const int64_t recent_end = recent_start + av_get_frame_duration_in_pts_units(anim->pFrame);
const int64_t backup_start = backup_frame_ready ? av_get_pts_from_frame(anim->pFrame_backup) : 0;
AVFrame *best_frame = nullptr;
@ -1164,7 +1164,7 @@ static bool ffmpeg_is_first_frame_decode(struct anim *anim)
static void ffmpeg_scan_log(struct anim *anim, int64_t pts_to_search)
{
int64_t frame_pts_start = av_get_pts_from_frame(anim->pFrame);
int64_t frame_pts_end = frame_pts_start + anim->pFrame->pkt_duration;
int64_t frame_pts_end = frame_pts_start + av_get_frame_duration_in_pts_units(anim->pFrame);
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
" SCAN WHILE: PTS range %" PRId64 " - %" PRId64 " in search of %" PRId64 "\n",