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;
78struct MediaFileInfoPrivate;
107 std::string_view mimeType()
const;
108 std::uint64_t containerOffset()
const;
109 std::uint64_t paddingSize()
const;
110 std::uint64_t effectiveSize()
const;
115 std::vector<AbstractChapter *> chapters()
const;
116 bool areChaptersSupported()
const;
119 std::vector<AbstractAttachment *> attachments()
const;
120 bool areAttachmentsSupported()
const;
123 std::size_t trackCount()
const;
124 std::vector<AbstractTrack *> tracks()
const;
126 CppUtilities::TimeSpan duration()
const;
127 double overallAverageBitrate()
const;
129 std::string technicalSummary()
const;
130 bool areTracksSupported()
const;
133 bool hasId3v1Tag()
const;
134 bool hasId3v2Tag()
const;
135 bool hasAnyTag()
const;
137 const std::vector<std::unique_ptr<Id3v2Tag>> &id3v2Tags()
const;
138 void tags(std::vector<Tag *> &tags)
const;
139 std::vector<Tag *> tags()
const;
140 void parsedTags(std::vector<Tag *> &tags)
const;
141 std::vector<Tag *> parsedTags()
const;
143 const std::vector<std::unique_ptr<MatroskaTag>> &matroskaTags()
const;
145 bool areTagsSupported()
const;
149 bool removeId3v1Tag();
152 bool removeAllId3v2Tags();
154 bool removeTag(
Tag *tag);
155 void removeAllTags();
156 void mergeId3v2Tags();
160 bool removeVorbisComment();
161 void clearParsingResults();
164 const std::string &backupDirectory()
const;
165 void setBackupDirectory(std::string_view backupDirectory);
166 void setBackupDirectory(std::string &&backupDirectory);
167 const std::string &saveFilePath()
const;
168 void setSaveFilePath(std::string_view saveFilePath);
169 void setSaveFilePath(std::string &&saveFilePath);
170 const std::string &writingApplication()
const;
171 void setWritingApplication(std::string_view writingApplication);
174 bool isForcingFullParse()
const;
175 void setForceFullParse(
bool forceFullParse);
176 bool isForcingRewrite()
const;
177 void setForceRewrite(
bool forceRewrite);
178 std::size_t minPadding()
const;
179 void setMinPadding(std::size_t minPadding);
180 std::size_t maxPadding()
const;
181 void setMaxPadding(std::size_t maxPadding);
182 std::size_t preferredPadding()
const;
183 void setPreferredPadding(std::size_t preferredPadding);
186 bool forceTagPosition()
const;
187 void setForceTagPosition(
bool forceTagPosition);
190 bool forceIndexPosition()
const;
191 void setForceIndexPosition(
bool forceTagPosition);
192 std::uint64_t maxFullParseSize()
const;
193 void setMaxFullParseSize(std::uint64_t maxFullParseSize);
196 void invalidated()
override;
207 std::streamoff m_containerOffset;
208 std::uint64_t m_paddingSize;
209 std::uint64_t m_effectiveSize;
210 std::vector<std::streamoff> m_actualId3v2TagOffsets;
211 std::unique_ptr<AbstractContainer> m_container;
216 std::unique_ptr<AbstractTrack> m_singleTrack;
220 std::unique_ptr<Id3v1Tag> m_id3v1Tag;
221 std::vector<std::unique_ptr<Id3v2Tag>> m_id3v2Tags;
228 std::string m_backupDirectory;
229 std::string m_saveFilePath;
230 std::string m_writingApplication;
231 std::size_t m_minPadding;
232 std::size_t m_maxPadding;
233 std::size_t m_preferredPadding;
237 std::uint64_t m_maxFullParseSize;
238 std::unique_ptr<MediaFileInfoPrivate> m_p;
246 return m_containerParsingStatus;
257 return m_containerFormat;
295 return static_cast<std::uint64_t
>(m_containerOffset);
303 return m_paddingSize;
312 return m_effectiveSize;
320 return m_tagsParsingStatus;
328 return m_tracksParsingStatus;
341 return m_singleTrack ? 1 : (m_container ? m_container->trackCount() : 0);
349 return m_chaptersParsingStatus;
357 return m_attachmentsParsingStatus;
365 return m_id3v1Tag !=
nullptr;
373 return !m_id3v2Tags.empty();
385 return m_id3v1Tag.get();
407 return m_backupDirectory;
434 return m_saveFilePath;
471 return m_writingApplication;
497 return m_container.get();
505 return m_fileHandlingFlags;
513 m_fileHandlingFlags = flags;
618 return m_preferredPadding;
638 return m_tagPosition;
683 return m_indexPosition;
731 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 BasicFileInfo class provides basic file information such as file name, extension,...
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(...