Skip to content

Commit

Permalink
ffmpeg7 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
substring committed May 4, 2024
1 parent 67ca08c commit d2226e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/media.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,16 +778,20 @@ void FeVideoImp::video_thread()
if ( raw_frame->pts == AV_NOPTS_VALUE )
raw_frame->pts = packet->dts;


#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 30, 100 ))
// AVFrame.pkt_duration renamed to AVFrame.duration with FFmpeg 6
#define XSTR(x) STR(x)
#define STR(x) #x
#pragma message "The value of LIBAVCODEC_VERSION_INT: " XSTR(LIBAVUTIL_VERSION_INT)
#pragma message "The value of AV_VERSION_INT( 58, 2, 100 ): " XSTR(AV_VERSION_INT( 58, 2, 100 ))
#if (LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 58, 2, 100 ))
// Correct for out of bounds pts
if ( raw_frame->pts < prev_pts )
raw_frame->pts = prev_pts + prev_duration;

// Track pts and duration if we need to correct next frame
prev_pts = raw_frame->pts;
prev_duration = raw_frame->duration;
#elif (LIBAVUTIL_VERSION_MICRO >= 100 )
#elif (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 58, 2, 100 ))
// This only works on FFmpeg, exclude libav (it doesn't have pkt_duration
// Correct for out of bounds pts
if ( raw_frame->pts < prev_pts )
Expand Down

0 comments on commit d2226e3

Please sign in to comment.