Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE([1.11 subdir-objects])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([disable])

VERSION_INFO="5:1:1"
VERSION_INFO="5:1:2"

AC_MSG_CHECKING([if debug build is enabled])

Expand Down
9 changes: 9 additions & 0 deletions doc/ffms2-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,15 @@ Returns the human-readable name ("long name" in FFmpeg terms) of the codec used
Useful if you want to, say, pop up a menu asking the user which tracks he or she wishes to index.
Note that specifying an invalid track number may lead to undefined behavior.

### FFMS_GetTrackMetadataI - gets the metadata of a given track

[GetTrackMetadataI]: #ffms_gettrackmetadatai---gets-the-metadata-of-a-given-track
```c++
const char *FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char *Key);
```
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_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
Expand Down
1 change: 1 addition & 0 deletions doc/ffms2-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- 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.
- Added FFMS_GetTrackMetadataI.

- 5.0
- Fixed all issues with FFmpeg 6.1 which is now the minimum requirement
Expand Down
3 changes: 2 additions & 1 deletion include/ffms.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define FFMS_H

// Version format: major - minor - micro - bump
#define FFMS_VERSION ((5 << 24) | (1 << 16) | (1 << 8) | 0)
#define FFMS_VERSION ((5 << 24) | (1 << 16) | (2 << 8) | 0)

#include <stdint.h>
#include <stddef.h>
Expand Down Expand Up @@ -462,6 +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_GetFormatNameI(FFMS_Indexer *Indexer);
FFMS_API(int) FFMS_GetNumFrames(FFMS_Track *T);
FFMS_API(const FFMS_FrameInfo *) FFMS_GetFrameInfo(FFMS_Track *T, int Frame);
Expand Down
4 changes: 4 additions & 0 deletions src/core/ffms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ FFMS_API(const char *) FFMS_GetCodecNameI(FFMS_Indexer *Indexer, int Track) {
return Indexer->GetTrackCodec(Track);
}

FFMS_API(const char *) FFMS_GetTrackMetadataI(FFMS_Indexer *Indexer, int Track, const char *Key) {
return Indexer->GetTrackMetadata(Track, Key);
}

FFMS_API(int) FFMS_GetNumFrames(FFMS_Track *T) {
return T->VisibleFrameCount();
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ const char *FFMS_Indexer::GetTrackCodec(int Track) {
return codec ? codec->name : nullptr;
}

const char *FFMS_Indexer::GetTrackMetadata(int Track, const char *Key) {
AVStream *stream = FormatContext->streams[Track];
AVDictionaryEntry *Entry = av_dict_get(stream->metadata, Key, NULL, 0);
return Entry ? Entry->value : nullptr;
}

FFMS_Index *FFMS_Indexer::DoIndexing() {
std::vector<SharedAVContext> AVContexts(FormatContext->nb_streams);

Expand Down
1 change: 1 addition & 0 deletions src/core/indexing.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct FFMS_Indexer {
int GetNumberOfTracks();
FFMS_TrackType GetTrackType(int Track);
const char *GetTrackCodec(int Track);
const char *GetTrackMetadata(int Track, const char *Key);
const char *GetFormatName();
};

Expand Down
Loading