Cleanup: Deprecation warning in the FFmpeg
Since avuitl 57.30.100 the pkt_duration is deprecated, and the duration is to be used instead. The units seems to match, and also from the avcodec decoder.c the `frame->pkt_duration = frame->duration;` so does not seem we need to do any conversion. The change in FFmpeg is from 2022, which is a bit recent, so the access to the duration is hidden behind a compatibility API. Pull Request: https://projects.blender.org/blender/blender/pulls/108451
This commit is contained in:
parent
c1bc70b711
commit
eb9209c1f5
@ -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
|
||||
*
|
||||
|
@ -956,7 +956,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;
|
||||
@ -1165,7 +1165,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",
|
||||
|
Loading…
Reference in New Issue
Block a user