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 static void writePadding(std::ostream &outputStream, uint64_t size);
203 void invalidated()
override;
214 std::streamoff m_containerOffset;
215 std::uint64_t m_paddingSize;
216 std::uint64_t m_effectiveSize;
217 std::vector<std::streamoff> m_actualId3v2TagOffsets;
218 std::unique_ptr<AbstractContainer> m_container;
223 std::unique_ptr<AbstractTrack> m_singleTrack;
227 std::unique_ptr<Id3v1Tag> m_id3v1Tag;
228 std::vector<std::unique_ptr<Id3v2Tag>> m_id3v2Tags;
235 std::string m_backupDirectory;
236 std::string m_saveFilePath;
237 std::string m_writingApplication;
238 std::size_t m_minPadding;
239 std::size_t m_maxPadding;
240 std::size_t m_preferredPadding;
244 std::uint64_t m_maxFullParseSize;
245 std::unique_ptr<MediaFileInfoPrivate> m_p;
253 return m_containerParsingStatus;
264 return m_containerFormat;
302 return static_cast<std::uint64_t
>(m_containerOffset);
310 return m_paddingSize;
319 return m_effectiveSize;
327 return m_tagsParsingStatus;
335 return m_tracksParsingStatus;
348 return m_singleTrack ? 1 : (m_container ? m_container->trackCount() : 0);
356 return m_chaptersParsingStatus;
364 return m_attachmentsParsingStatus;
372 return m_id3v1Tag !=
nullptr;
380 return !m_id3v2Tags.empty();
392 return m_id3v1Tag.get();
413 m_paddingSize = newPaddingSize;
423 return m_backupDirectory;
450 return m_saveFilePath;
487 return m_writingApplication;
513 return m_container.get();
521 return m_fileHandlingFlags;
529 m_fileHandlingFlags = flags;
634 return m_preferredPadding;
654 return m_tagPosition;
699 return m_indexPosition;
747 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(...