From 2541eb6e085cf8b2aec3185aae011ed015fc6f32 Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 8 Oct 2026 20:02:34 -0400 Subject: [PATCH 1/4] Specify in which version FFMS_GetTrackMetadataI was added --- include/ffms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ffms.h b/include/ffms.h index 3f9d455117..aa84fd5050 100644 --- a/include/ffms.h +++ b/include/ffms.h @@ -462,7 +462,7 @@ FFMS_API(int) FFMS_GetTrackType(FFMS_Track *T); FFMS_API(int) FFMS_GetTrackTypeI(FFMS_Indexer *Indexer, int Track); FFMS_API(FFMS_IndexErrorHandling) FFMS_GetErrorHandling(FFMS_Index *Index); FFMS_API(const char *) FFMS_GetCodecNameI(FFMS_Indexer *Indexer, int Track); -FFMS_API(const char *) FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char *Key); +FFMS_API(const char *) FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char *Key); /* Introduced in FFMS_VERSION ((5 << 24) | (1 << 16) | (2 << 8) | 0) */ FFMS_API(const char *) FFMS_GetFormatNameI(FFMS_Indexer *Indexer); FFMS_API(int) FFMS_GetNumFrames(FFMS_Track *T); FFMS_API(const FFMS_FrameInfo *) FFMS_GetFrameInfo(FFMS_Track *T, int Frame); From 0e2b978dad9e456012ba5b56a5d4d2334b9fea9d Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 8 Oct 2026 20:11:37 -0400 Subject: [PATCH 2/4] Add FFMS_GetContainerFirstTimeI This expose `AVFormatContext::start_time` to user. --- doc/ffms2-api.md | 12 ++++++++++++ doc/ffms2-changelog.md | 1 + include/ffms.h | 1 + src/core/ffms.cpp | 4 ++++ src/core/indexing.cpp | 10 ++++++++++ src/core/indexing.h | 1 + 6 files changed, 29 insertions(+) diff --git a/doc/ffms2-api.md b/doc/ffms2-api.md index cdbdac4882..02721cf333 100644 --- a/doc/ffms2-api.md +++ b/doc/ffms2-api.md @@ -586,6 +586,18 @@ const char *FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char Returns the value of the metadata entry associated with `Key` for the given track number in the media file represented by the given `FFMS_Indexer` object. For the list of commonly used metadata keys, see the `metadata_api Public Metadata API` comment in [avformat.h](https://code.ffmpeg.org/FFmpeg/FFmpeg/src/branch/master/libavformat/avformat.h). +### FFMS_GetContainerFirstTimeI - gets the container first time + +[GetContainerFirstTimeI]: #ffms_getcontainerfirsttimei---gets-the-container-first-time +```c++ +int FFMS_GetContainerFirstTimeI(FFMS_Indexer *Indexer, int64_t *pts, int *timebase); +``` +Retrieves the container start time of the media file represented by the given `FFMS_Indexer` object. +On success, *pts* is set to the container start timestamp (which corresponds to `AVFormatContext::start_time` in FFmpeg) and *timebase* is set to the timebase it is expressed in. +Note that the *timebase* might be different than `FFMS_GetTimeBase`. +Returns 0 on success. +Returns non-0 on failure (e.g. if the container has no start time, or if *pts* or *timebase* is NULL). + ### FFMS_GetFormatNameI - gets the name of the container format used in the given indexer [GetFormatNameI]: #ffms_getformatnamei---gets-the-name-of-the-container-format-used-in-the-given-indexer diff --git a/doc/ffms2-changelog.md b/doc/ffms2-changelog.md index 9d065aa947..21b481cd49 100644 --- a/doc/ffms2-changelog.md +++ b/doc/ffms2-changelog.md @@ -4,6 +4,7 @@ - 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. - Added FFMS_GetTrackMetadataI. + - Added FFMS_GetContainerFirstTimeI. - 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 aa84fd5050..20888df871 100644 --- a/include/ffms.h +++ b/include/ffms.h @@ -463,6 +463,7 @@ FFMS_API(int) FFMS_GetTrackTypeI(FFMS_Indexer *Indexer, int Track); FFMS_API(FFMS_IndexErrorHandling) FFMS_GetErrorHandling(FFMS_Index *Index); FFMS_API(const char *) FFMS_GetCodecNameI(FFMS_Indexer *Indexer, int Track); FFMS_API(const char *) FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char *Key); /* Introduced in FFMS_VERSION ((5 << 24) | (1 << 16) | (2 << 8) | 0) */ +FFMS_API(int) FFMS_GetContainerFirstTimeI(FFMS_Indexer *Indexer, int64_t *pts, int *timebase); /* Introduced in FFMS_VERSION ((5 << 24) | (1 << 16) | (3 << 8) | 0) */ FFMS_API(const char *) FFMS_GetFormatNameI(FFMS_Indexer *Indexer); FFMS_API(int) FFMS_GetNumFrames(FFMS_Track *T); FFMS_API(const FFMS_FrameInfo *) FFMS_GetFrameInfo(FFMS_Track *T, int Frame); diff --git a/src/core/ffms.cpp b/src/core/ffms.cpp index cbfe88e2a0..3340fdbe44 100644 --- a/src/core/ffms.cpp +++ b/src/core/ffms.cpp @@ -274,6 +274,10 @@ FFMS_API(const char *) FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, return Indexer->GetTrackMetadata(Track, Key); } +FFMS_API(int) FFMS_GetContainerFirstTimeI(FFMS_Indexer *Indexer, int64_t *pts, int *timebase) { + return Indexer->GetFirstTime(pts, timebase); +} + FFMS_API(int) FFMS_GetNumFrames(FFMS_Track *T) { return T->VisibleFrameCount(); } diff --git a/src/core/indexing.cpp b/src/core/indexing.cpp index 821ba053d9..40c7ca15bd 100644 --- a/src/core/indexing.cpp +++ b/src/core/indexing.cpp @@ -437,6 +437,16 @@ const char *FFMS_Indexer::GetTrackMetadata(int Track, const char *Key) { return Entry ? Entry->value : nullptr; } +int FFMS_Indexer::GetFirstTime(int64_t *pts, int *timebase) { + if (FormatContext->start_time == AV_NOPTS_VALUE || !pts || !timebase) + return 1; + + *pts = FormatContext->start_time; + *timebase = AV_TIME_BASE; + + return 0; +} + FFMS_Index *FFMS_Indexer::DoIndexing() { std::vector AVContexts(FormatContext->nb_streams); diff --git a/src/core/indexing.h b/src/core/indexing.h index 4a79e75ff9..e6ab861afb 100644 --- a/src/core/indexing.h +++ b/src/core/indexing.h @@ -101,6 +101,7 @@ struct FFMS_Indexer { FFMS_TrackType GetTrackType(int Track); const char *GetTrackCodec(int Track); const char *GetTrackMetadata(int Track, const char *Key); + int GetFirstTime(int64_t *pts, int *timebase); const char *GetFormatName(); }; From 2c6b6b2cd935ca4ee81a8265482e6341d0d6950d Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 8 Oct 2026 20:11:48 -0400 Subject: [PATCH 3/4] Bump version to 5.1.3 --- configure.ac | 2 +- include/ffms.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f3075f57a0..56d5cc0135 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:2" +VERSION_INFO="5:1:3" AC_MSG_CHECKING([if debug build is enabled]) diff --git a/include/ffms.h b/include/ffms.h index 20888df871..5517376003 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) | (2 << 8) | 0) +#define FFMS_VERSION ((5 << 24) | (1 << 16) | (3 << 8) | 0) #include #include From 17a550058c10befaa8e039d02b0c9549b2acb949 Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 8 Oct 2026 20:17:50 -0400 Subject: [PATCH 4/4] [CI] Switch to UCRT64 MSYS2 has deprecated the MINGW64 environment: https://www.msys2.org/news/#2026-03-15-deprecating-the-mingw64-environment This fix this warning in the CI. ``` Warning: [msystem-mingw64] MINGW64 is deprecated. Migrate to UCRT64 or CLANG64. To acknowledge and suppress this warning, add 'msystem-mingw64' to 'suppress-deprecation-warnings'. ``` --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee5bfcb13..de4e499c3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,11 +55,11 @@ jobs: if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: UCRT64 install: >- - mingw-w64-x86_64-autotools - mingw-w64-x86_64-ffmpeg - mingw-w64-x86_64-toolchain + mingw-w64-ucrt-x86_64-autotools + mingw-w64-ucrt-x86_64-ffmpeg + mingw-w64-ucrt-x86_64-toolchain - name: configure run: ./autogen.sh --enable-static --disable-shared - name: make