Skip to content

Commit f3f252f

Browse files
committed
Add language/title in track selection
1 parent eef3fcc commit f3f252f

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/ffmpegsource_common.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,33 @@ std::map<int, std::string> FFmpegSourceProvider::GetTracksOfType(FFMS_Indexer *I
109109

110110
for (int i=0; i<NumTracks; i++) {
111111
if (FFMS_GetTrackTypeI(Indexer, i) == Type) {
112-
if (auto CodecName = FFMS_GetCodecNameI(Indexer, i))
113-
TrackList[i] = CodecName;
112+
std::string TrackDescription = "";
113+
114+
bool FirstEntry = true;
115+
auto Append = [&](const std::string& part) {
116+
if (!FirstEntry)
117+
TrackDescription += " - ";
118+
TrackDescription += part;
119+
FirstEntry = false;
120+
};
121+
122+
const char* CodecName = FFMS_GetCodecNameI(Indexer, i);
123+
const char* Language = NULL;
124+
const char* Title = NULL;
125+
126+
#if FFMS_VERSION >= 0x5010200
127+
Language = FFMS_GetTrackMetadataI(Indexer, i, "language");
128+
Title = FFMS_GetTrackMetadataI(Indexer, i, "title");
129+
#endif
130+
131+
if (CodecName)
132+
Append(CodecName);
133+
if (Language)
134+
Append("[" + std::string(Language) + "]");
135+
if (Title)
136+
Append(Title);
137+
138+
TrackList[i] = TrackDescription;
114139
}
115140
}
116141
return TrackList;

subprojects/ffms2.wrap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[wrap-git]
2-
url = https://github.com/FFMS/ffms2.git
3-
revision = head
2+
url = https://github.com/moi15moi/ffms2.git
3+
revision = Add-FFMS_GetTrackTitle
44
patch_directory = ffms2
55

66
[provide]

0 commit comments

Comments
 (0)