1#ifndef TAG_PARSER_MEDIAINFO_H
2#define TAG_PARSER_MEDIAINFO_H
11#include <unordered_set>
14#include <c++utilities/misc/flagenumclass.h>
24class MatroskaContainer;
31class AbortableProgressFeedback;
34enum class TagType :
unsigned int;
81struct MediaFileInfoPrivate;
86 explicit MediaFileInfo();
87 explicit MediaFileInfo(std::string_view path);
88 explicit MediaFileInfo(std::string &&path);
110 std::string_view mimeType()
const;
111 std::uint64_t containerOffset()
const;
112 std::uint64_t paddingSize()
const;
113 std::uint64_t effectiveSize()
const;
118 std::vector<AbstractChapter *> chapters()
const;
119 bool areChaptersSupported()
const;
122 std::vector<AbstractAttachment *> attachments()
const;
123 bool areAttachmentsSupported()
const;
126 std::size_t trackCount()
const;
127 std::vector<AbstractTrack *> tracks()
const;
129 CppUtilities::TimeSpan duration()
const;
130 double overallAverageBitrate()
const;
132 std::string technicalSummary()
const;
133 bool areTracksSupported()
const;
136 bool hasId3v1Tag()
const;
137 bool hasId3v2Tag()
const;
138 bool hasAnyTag()
const;
140 const std::vector<std::unique_ptr<Id3v2Tag>> &id3v2Tags()
const;
141 void tags(std::vector<Tag *> &tags)
const;
142 std::vector<Tag *> tags()
const;
143 void parsedTags(std::vector<Tag *> &tags)
const;
144 std::vector<Tag *> parsedTags()
const;
146 const std::vector<std::unique_ptr<MatroskaTag>> &matroskaTags()
const;
148 bool areTagsSupported()
const;
152 bool removeId3v1Tag();
155 bool removeAllId3v2Tags();
157 bool removeTag(
Tag *tag);
158 void removeAllTags();
159 void mergeId3v2Tags();
163 bool removeVorbisComment();
164 void clearParsingResults();
165 void reportPaddingSizeChanged(std::uint64_t newPaddingSize);
168 const std::string &backupDirectory()
const;
169 void setBackupDirectory(std::string_view backupDirectory);
170 void setBackupDirectory(std::string &&backupDirectory);
171 const std::string &saveFilePath()
const;
172 void setSaveFilePath(std::string_view saveFilePath);
173 void setSaveFilePath(std::string &&saveFilePath);
174 const std::string &writingApplication()
const;
175 void setWritingApplication(std::string_view writingApplication);
178 bool isForcingFullParse()
const;
179 void setForceFullParse(
bool forceFullParse);
180 bool isForcingRewrite()
const;
181 void setForceRewrite(
bool forceRewrite);
182 std::size_t minPadding()
const;
183 void setMinPadding(std::size_t minPadding);
184 std::size_t maxPadding()
const;
185 void setMaxPadding(std::size_t maxPadding);
186 std::size_t preferredPadding()
const;
187 void setPreferredPadding(std::size_t preferredPadding);
190 bool forceTagPosition()
const;
191 void setForceTagPosition(
bool forceTagPosition);
194 bool forceIndexPosition()
const;
195 void setForceIndexPosition(
bool forceTagPosition);
196 std::uint64_t maxFullParseSize()
const;
197 void setMaxFullParseSize(std::uint64_t maxFullParseSize);
200 void invalidated()
override;
211 std::streamoff m_containerOffset;
212 std::uint64_t m_paddingSize;
213 std::uint64_t m_effectiveSize;
214 std::vector<std::streamoff> m_actualId3v2TagOffsets;
215 std::unique_ptr<AbstractContainer> m_container;
220 std::unique_ptr<AbstractTrack> m_singleTrack;
224 std::unique_ptr<Id3v1Tag> m_id3v1Tag;
225 std::vector<std::unique_ptr<Id3v2Tag>> m_id3v2Tags;
232 std::string m_backupDirectory;
233 std::string m_saveFilePath;
234 std::string m_writingApplication;
235 std::size_t m_minPadding;
236 std::size_t m_maxPadding;
237 std::size_t m_preferredPadding;
241 std::uint64_t m_maxFullParseSize;
242 std::unique_ptr<MediaFileInfoPrivate> m_p;
250 return m_containerParsingStatus;
261 return m_containerFormat;
299 return static_cast<std::uint64_t
>(m_containerOffset);
307 return m_paddingSize;
316 return m_effectiveSize;
324 return m_tagsParsingStatus;
332 return m_tracksParsingStatus;
345 return m_singleTrack ? 1 : (m_container ? m_container->trackCount() : 0);
353 return m_chaptersParsingStatus;
361 return m_attachmentsParsingStatus;
369 return m_id3v1Tag !=
nullptr;
377 return !m_id3v2Tags.empty();
389 return m_id3v1Tag.get();
410 m_paddingSize = newPaddingSize;
420 return m_backupDirectory;
447 return m_saveFilePath;
484 return m_writingApplication;
510 return m_container.get();
518 return m_fileHandlingFlags;
526 m_fileHandlingFlags = flags;
631 return m_preferredPadding;
651 return m_tagPosition;
696 return m_indexPosition;
744 return m_maxFullParseSize;
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
The AbstractContainer class provides an interface and common functionality to parse and make a certai...
The Diagnostics class is a container for DiagMessage.
Implementation of TagParser::Tag for ID3v1 tags.
Implementation of TagParser::Tag for ID3v2 tags.
Implementation of TagParser::Tag for the MP4 container.
The Tag class is used to store, read and write tag information.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
TAG_PARSER_EXPORT std::string_view containerFormatSubversion(ContainerFormat containerFormat)
Returns the subversion of the container format as C-style string.
TAG_PARSER_EXPORT std::string_view containerFormatAbbreviation(ContainerFormat containerFormat, MediaType mediaType=MediaType::Unknown, unsigned int version=0)
Returns the abbreviation of the container format as C-style string considering the specified media ty...
TAG_PARSER_EXPORT std::string_view containerFormatName(ContainerFormat containerFormat)
Returns the name of the specified container format as C-style string.
TagType
Specifies the tag type.
ParsingStatus
The ParsingStatus enum specifies whether a certain part of the file (tracks, tags,...
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
MediaFileStructureFlags
The MediaFileStructureFlags enum specifies flags which describing the structure of a media file.
ContainerFormat
Specifies the container format.
MediaFileHandlingFlags
The MediaFileHandlingFlags enum specifies flags which controls the behavior of MediaFileInfo objects.
@ PreserveWritingApplication
@ NormalizeKnownTagFieldIds
@ PreserveRawTimingValues
@ PreserveMuxingApplication
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)
The TagSettings struct contains settings which can be passed to MediaFileInfo::createAppropriateTags(...