diff --git a/configure.ac b/configure.ac index 79cb85dcee..49ba714e31 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE([1.11 subdir-objects]) AM_SILENT_RULES([yes]) AM_MAINTAINER_MODE([disable]) -VERSION_INFO="5:1:0" +VERSION_INFO="5:1:1" AC_MSG_CHECKING([if debug build is enabled]) diff --git a/doc/ffms2-api.md b/doc/ffms2-api.md index 6e47bb7c05..ace92aa5c6 100644 --- a/doc/ffms2-api.md +++ b/doc/ffms2-api.md @@ -1052,6 +1052,7 @@ typedef struct { unsigned int ContentLightLevelMax; unsigned int ContentLightLevelAverage; int Flip; + int64_t LastEndPTS; } FFMS_VideoProperties; ``` A struct containing metadata about a video track. @@ -1094,6 +1095,7 @@ The fields are: - `unsigned int ContentLightLevelMax;` - Maximum content luminance (cd/m^2). - `unsigned int ContentLightLevelAverage;` - Average content luminance (cd/m^2). - `int Flip;` - Flip direction to be applied *before* rotation: 0 for no operation, >0 for horizontal flip, <0 for vertical flip. + - `int64_t LastEndPTS;` - The end PTS of the last packet of the stream. ### FFMS_AudioProperties diff --git a/doc/ffms2-changelog.md b/doc/ffms2-changelog.md index 9a6a049333..e340995377 100644 --- a/doc/ffms2-changelog.md +++ b/doc/ffms2-changelog.md @@ -2,6 +2,7 @@ - 5.1 - FFmpeg 7.1 is now the minimum requirement. - Added layered decoding support, for e.g. spatial MV-HEVC. + - Added LastEndPTS to FFMS_VideoProperties. This field is the equivalent of LastEndTime, but it is expressed in the video timebase. - 5.0 - Fixed all issues with FFmpeg 6.1 which is now the minimum requirement diff --git a/include/ffms.h b/include/ffms.h index 486fb8689b..4e28fb7ff6 100644 --- a/include/ffms.h +++ b/include/ffms.h @@ -22,7 +22,7 @@ #define FFMS_H // Version format: major - minor - micro - bump -#define FFMS_VERSION ((5 << 24) | (1 << 16) | (0 << 8) | 0) +#define FFMS_VERSION ((5 << 24) | (1 << 16) | (1 << 8) | 0) #include #include @@ -406,6 +406,8 @@ typedef struct FFMS_VideoProperties { unsigned int ContentLightLevelAverage; /* Introduced in FFMS_VERSION ((2 << 24) | (31 << 16) | (0 << 8) | 0) */ int Flip; /* -1 = Vertical flip, 1 = Horizontal flip */ + /* Introduced in FFMS_VERSION ((5 << 24) | (1 << 16) | (1 << 8) | 0) */ + int64_t LastEndPTS; } FFMS_VideoProperties; typedef struct FFMS_AudioProperties { diff --git a/src/core/videosource.cpp b/src/core/videosource.cpp index c27b5d6f98..75a91f820a 100644 --- a/src/core/videosource.cpp +++ b/src/core/videosource.cpp @@ -685,9 +685,12 @@ void FFMS_VideoSource::SetVideoProperties() { VP.ColorRange = AVCOL_RANGE_JPEG; - VP.FirstTime = ((Frames[Frames.RealFrameNumber(0)].PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; - VP.LastTime = ((Frames[Frames.RealFrameNumber(Frames.VisibleFrameCount()-1)].PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; - VP.LastEndTime = (((Frames[Frames.RealFrameNumber(Frames.VisibleFrameCount()-1)].PTS + Frames.LastDuration) * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; + auto FirstPTS = Frames[Frames.RealFrameNumber(0)].PTS; + auto LastPTS = Frames[Frames.RealFrameNumber(Frames.VisibleFrameCount()-1)].PTS; + VP.LastEndPTS = LastPTS + Frames.LastDuration; + VP.FirstTime = ((FirstPTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; + VP.LastTime = ((LastPTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; + VP.LastEndTime = ((VP.LastEndPTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; if (CodecContext->width <= 0 || CodecContext->height <= 0) throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,