Add method to generate technical summary

This commit is contained in:
Martchus 2017-08-17 18:59:51 +02:00
parent fd138f65ca
commit 0485d6b5c6
2 changed files with 31 additions and 0 deletions

View File

@ -865,6 +865,36 @@ unordered_set<string> MediaFileInfo::availableLanguages(MediaType type) const
return res;
}
/*!
* \brief Generates a short technical summary about the file's tracks.
*
* parseTracks() needs to be called before. Otherwise this
* method always returns an empty string.
*
* Example (exact format might change in the future!):
* "H.264-720p / HE-AAC-6ch-eng / HE-AAC-2ch-ger / SRT-eng / SRT-ger"
*
* \sa parseTracks()
*/
string MediaFileInfo::technicalSummary() const
{
if(m_container) {
const size_t trackCount = m_container->trackCount();
vector<string> parts;
parts.reserve(trackCount);
for(size_t i = 0; i != trackCount; ++i) {
const string description(m_container->track(i)->description());
if(!description.empty()) {
parts.emplace_back(move(description));
}
}
return joinStrings(parts, " / ");
} else if(m_singleTrack) {
return m_singleTrack->description();
}
return string();
}
/*!
* \brief Removes a possibly assigned ID3v1 tag from the current file.
*

View File

@ -97,6 +97,7 @@ public:
bool hasTracksOfType(Media::MediaType type) const;
ChronoUtilities::TimeSpan duration() const;
std::unordered_set<std::string> availableLanguages(Media::MediaType type = Media::MediaType::Audio) const;
std::string technicalSummary() const;
bool areTracksSupported() const;
// ... the tags
ParsingStatus tagsParsingStatus() const;