Skip to content
Draft
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
29 changes: 27 additions & 2 deletions src/ffmpegsource_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,33 @@ std::map<int, std::string> FFmpegSourceProvider::GetTracksOfType(FFMS_Indexer *I

for (int i=0; i<NumTracks; i++) {
if (FFMS_GetTrackTypeI(Indexer, i) == Type) {
if (auto CodecName = FFMS_GetCodecNameI(Indexer, i))
TrackList[i] = CodecName;
std::string TrackDescription = "";

bool FirstEntry = true;
auto Append = [&](const std::string& part) {
if (!FirstEntry)
TrackDescription += " - ";
TrackDescription += part;
FirstEntry = false;
};

const char* CodecName = FFMS_GetCodecNameI(Indexer, i);
const char* Language = NULL;
const char* Title = NULL;

#if FFMS_VERSION >= 0x5010200
Language = FFMS_GetTrackMetadataI(Indexer, i, "language");
Title = FFMS_GetTrackMetadataI(Indexer, i, "title");
#endif

if (CodecName)
Append(CodecName);
if (Language)
Append("[" + std::string(Language) + "]");
if (Title)
Append(Title);

TrackList[i] = TrackDescription;
}
}
return TrackList;
Expand Down
4 changes: 2 additions & 2 deletions subprojects/ffms2.wrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/FFMS/ffms2.git
revision = head
url = https://github.com/moi15moi/ffms2.git
revision = Add-FFMS_GetTrackTitle
patch_directory = ffms2

[provide]
Expand Down
Loading