Tag Parser: mediafileinfo.h Source File

Tag Parser 12.5.3 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
mediafileinfo.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_MEDIAINFO_H
2#define TAG_PARSER_MEDIAINFO_H
3
4#include "./abstractcontainer.h"
5#include "./basicfileinfo.h"
6#include "./settings.h"
7#include "./signature.h"
8
9#include <cstdint>
10#include <memory>
11#include <unordered_set>
12#include <vector>
13
14#include <c++utilities/misc/flagenumclass.h>
15
16namespace TagParser {
17
18class Tag;
19class Id3v1Tag;
20class Id3v2Tag;
21class Mp4Container;
22class Mp4Atom;
23class Mp4Tag;
24class MatroskaContainer;
25class OggContainer;
26class EbmlElement;
27class MatroskaTag;
28class AbstractTrack;
29class VorbisComment;
30class Diagnostics;
31class AbortableProgressFeedback;
32
33enum class MediaType : unsigned int;
34enum class TagType : unsigned int;
35
40 enum class ParsingStatus : std::uint8_t {
41 NotParsedYet,
42 Ok,
43 NotSupported,
44 CriticalFailure
45};
46
50 enum class MediaFileStructureFlags : std::uint64_t {
51 None,
52 ActualExistingId3v1Tag = (1 << 0),
53};
54
58 enum class MediaFileHandlingFlags : std::uint64_t {
59 None,
60 ForceFullParse
61 = (1 << 0),
62 ForceRewrite = (1 << 1),
63 ForceTagPosition = (1 << 2),
64 ForceIndexPosition = (1 << 3),
65 NormalizeKnownTagFieldIds = (1 << 4),
66 PreserveRawTimingValues = (1 << 8),
67 PreserveMuxingApplication = (1 << 9),
68 PreserveWritingApplication = (1 << 10),
69 ConvertTotalFields = (1 << 11),
72};
73
74} // namespace TagParser
75
76 CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::MediaFileStructureFlags)
77 CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::MediaFileHandlingFlags)
78
79namespace TagParser {
80
81struct MediaFileInfoPrivate;
82
83 class TAG_PARSER_EXPORT MediaFileInfo : public BasicFileInfo {
84public:
85 // constructor, destructor
86 explicit MediaFileInfo();
87 explicit MediaFileInfo(std::string_view path);
88 explicit MediaFileInfo(std::string &&path);
89 MediaFileInfo(const MediaFileInfo &) = delete;
90 MediaFileInfo &operator=(const MediaFileInfo &) = delete;
91 ~MediaFileInfo() override;
92
93 // methods to parse file
94 void parseContainerFormat(Diagnostics &diag, AbortableProgressFeedback &progress);
95 void parseTracks(Diagnostics &diag, AbortableProgressFeedback &progress);
96 void parseTags(Diagnostics &diag, AbortableProgressFeedback &progress);
97 void parseChapters(Diagnostics &diag, AbortableProgressFeedback &progress);
98 void parseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress);
99 void parseEverything(Diagnostics &diag, AbortableProgressFeedback &progress);
100
101 // methods to apply changes
102 void applyChanges(Diagnostics &diag, AbortableProgressFeedback &progress);
103
104 // methods to get parsed information regarding ...
105 // ... the container
106 ContainerFormat containerFormat() const;
107 std::string_view containerFormatName() const;
108 std::string_view containerFormatAbbreviation() const;
109 std::string_view containerFormatSubversion() const;
110 std::string_view mimeType() const;
111 std::uint64_t containerOffset() const;
112 std::uint64_t paddingSize() const;
113 std::uint64_t effectiveSize() const;
114 AbstractContainer *container() const;
115 ParsingStatus containerParsingStatus() const;
116 // ... the chapters
117 ParsingStatus chaptersParsingStatus() const;
118 std::vector<AbstractChapter *> chapters() const;
119 bool areChaptersSupported() const;
120 // ... the attachments
121 ParsingStatus attachmentsParsingStatus() const;
122 std::vector<AbstractAttachment *> attachments() const;
123 bool areAttachmentsSupported() const;
124 // ... the tracks
125 ParsingStatus tracksParsingStatus() const;
126 std::size_t trackCount() const;
127 std::vector<AbstractTrack *> tracks() const;
128 bool hasTracksOfType(TagParser::MediaType type) const;
129 CppUtilities::TimeSpan duration() const;
130 double overallAverageBitrate() const;
131 std::unordered_set<std::string> availableLanguages(TagParser::MediaType type = TagParser::MediaType::Audio) const;
132 std::string technicalSummary() const;
133 bool areTracksSupported() const;
134 // ... the tags
135 ParsingStatus tagsParsingStatus() const;
136 bool hasId3v1Tag() const;
137 bool hasId3v2Tag() const;
138 bool hasAnyTag() const;
139 Id3v1Tag *id3v1Tag() 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;
145 Mp4Tag *mp4Tag() const;
146 const std::vector<std::unique_ptr<MatroskaTag>> &matroskaTags() const;
147 VorbisComment *vorbisComment() const;
148 bool areTagsSupported() const;
149
150 // methods to create/remove tags
151 bool createAppropriateTags(const TagCreationSettings &settings = TagCreationSettings());
152 bool removeId3v1Tag();
153 Id3v1Tag *createId3v1Tag();
154 bool removeId3v2Tag(Id3v2Tag *tag);
155 bool removeAllId3v2Tags();
156 Id3v2Tag *createId3v2Tag();
157 bool removeTag(Tag *tag);
158 void removeAllTags();
159 void mergeId3v2Tags();
160 bool id3v1ToId3v2();
161 bool id3v2ToId3v1();
162 VorbisComment *createVorbisComment();
163 bool removeVorbisComment();
164 void clearParsingResults();
165 void reportPaddingSizeChanged(std::uint64_t newPaddingSize);
166
167 // methods to get, set object behaviour
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);
176 MediaFileHandlingFlags fileHandlingFlags();
177 void setFileHandlingFlags(MediaFileHandlingFlags flags);
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);
188 ElementPosition tagPosition() const;
189 void setTagPosition(ElementPosition tagPosition);
190 bool forceTagPosition() const;
191 void setForceTagPosition(bool forceTagPosition);
192 ElementPosition indexPosition() const;
193 void setIndexPosition(ElementPosition indexPosition);
194 bool forceIndexPosition() const;
195 void setForceIndexPosition(bool forceTagPosition);
196 std::uint64_t maxFullParseSize() const;
197 void setMaxFullParseSize(std::uint64_t maxFullParseSize);
198
199 // helper functions
200 static void writePadding(std::ostream &outputStream, uint64_t size);
201
202protected:
203 void invalidated() override;
204
205private:
206 // private methods internally used when rewriting the file to apply new tag information
207 // currently only the makeMp3File() methods is present; corresponding methods for
208 // other formats are outsourced to container classes
209 void makeMp3File(Diagnostics &diag, AbortableProgressFeedback &progress);
210
211 // fields related to the container
212 ParsingStatus m_containerParsingStatus;
213 ContainerFormat m_containerFormat;
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;
219 MediaFileStructureFlags m_fileStructureFlags;
220
221 // fields related to the tracks
222 ParsingStatus m_tracksParsingStatus;
223 std::unique_ptr<AbstractTrack> m_singleTrack;
224
225 // fields related to the tag
226 ParsingStatus m_tagsParsingStatus;
227 std::unique_ptr<Id3v1Tag> m_id3v1Tag;
228 std::vector<std::unique_ptr<Id3v2Tag>> m_id3v2Tags;
229
230 // fields related to the chapters and the attachments
231 ParsingStatus m_chaptersParsingStatus;
232 ParsingStatus m_attachmentsParsingStatus;
233
234 // fields specifying object behaviour
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;
241 ElementPosition m_tagPosition;
242 ElementPosition m_indexPosition;
243 MediaFileHandlingFlags m_fileHandlingFlags;
244 std::uint64_t m_maxFullParseSize;
245 std::unique_ptr<MediaFileInfoPrivate> m_p;
246};
247
251 inline ParsingStatus MediaFileInfo::containerParsingStatus() const
252{
253 return m_containerParsingStatus;
254}
255
262 inline ContainerFormat MediaFileInfo::containerFormat() const
263{
264 return m_containerFormat;
265}
266
277 inline std::string_view MediaFileInfo::containerFormatName() const
278{
279 return TagParser::containerFormatName(m_containerFormat);
280}
281
292 inline std::string_view MediaFileInfo::containerFormatSubversion() const
293{
294 return TagParser::containerFormatSubversion(m_containerFormat);
295}
296
300 inline std::uint64_t MediaFileInfo::containerOffset() const
301{
302 return static_cast<std::uint64_t>(m_containerOffset);
303}
304
308 inline std::uint64_t MediaFileInfo::paddingSize() const
309{
310 return m_paddingSize;
311}
312
317 inline std::uint64_t MediaFileInfo::effectiveSize() const
318{
319 return m_effectiveSize;
320}
321
325 inline ParsingStatus MediaFileInfo::tagsParsingStatus() const
326{
327 return m_tagsParsingStatus;
328}
329
333 inline ParsingStatus MediaFileInfo::tracksParsingStatus() const
334{
335 return m_tracksParsingStatus;
336}
337
346 inline std::size_t MediaFileInfo::trackCount() const
347{
348 return m_singleTrack ? 1 : (m_container ? m_container->trackCount() : 0);
349}
350
354 inline ParsingStatus MediaFileInfo::chaptersParsingStatus() const
355{
356 return m_chaptersParsingStatus;
357}
358
362 inline ParsingStatus MediaFileInfo::attachmentsParsingStatus() const
363{
364 return m_attachmentsParsingStatus;
365}
366
370 inline bool MediaFileInfo::hasId3v1Tag() const
371{
372 return m_id3v1Tag != nullptr;
373}
374
378 inline bool MediaFileInfo::hasId3v2Tag() const
379{
380 return !m_id3v2Tags.empty();
381}
382
390 inline Id3v1Tag *MediaFileInfo::id3v1Tag() const
391{
392 return m_id3v1Tag.get();
393}
394
402 inline const std::vector<std::unique_ptr<Id3v2Tag>> &MediaFileInfo::id3v2Tags() const
403{
404 return m_id3v2Tags;
405}
406
411 inline void MediaFileInfo::reportPaddingSizeChanged(uint64_t newPaddingSize)
412{
413 m_paddingSize = newPaddingSize;
414}
415
421 inline const std::string &MediaFileInfo::backupDirectory() const
422{
423 return m_backupDirectory;
424}
425
430 inline void MediaFileInfo::setBackupDirectory(std::string_view backupDirectory)
431{
432 m_backupDirectory = backupDirectory;
433}
434
439 inline void MediaFileInfo::setBackupDirectory(std::string &&backupDirectory)
440{
441 m_backupDirectory = std::move(backupDirectory);
442}
443
448 inline const std::string &MediaFileInfo::saveFilePath() const
449{
450 return m_saveFilePath;
451}
452
467 inline void MediaFileInfo::setSaveFilePath(std::string_view saveFilePath)
468{
469 m_saveFilePath = saveFilePath;
470}
471
475 inline void MediaFileInfo::setSaveFilePath(std::string &&saveFilePath)
476{
477 m_saveFilePath = std::move(saveFilePath);
478}
479
485 inline const std::string &MediaFileInfo::writingApplication() const
486{
487 return m_writingApplication;
488}
489
496 inline void MediaFileInfo::setWritingApplication(std::string_view writingApplication)
497{
498 m_writingApplication = writingApplication;
499}
500
511 inline AbstractContainer *MediaFileInfo::container() const
512{
513 return m_container.get();
514}
515
519 inline MediaFileHandlingFlags MediaFileInfo::fileHandlingFlags()
520{
521 return m_fileHandlingFlags;
522}
523
527 inline void MediaFileInfo::setFileHandlingFlags(MediaFileHandlingFlags flags)
528{
529 m_fileHandlingFlags = flags;
530}
531
540 inline bool MediaFileInfo::isForcingFullParse() const
541{
542 return m_fileHandlingFlags & MediaFileHandlingFlags::ForceFullParse;
543}
544
550 inline void MediaFileInfo::setForceFullParse(bool forceFullParse)
551{
552 CppUtilities::modFlagEnum(m_fileHandlingFlags, MediaFileHandlingFlags::ForceFullParse, forceFullParse);
553}
554
558 inline bool MediaFileInfo::isForcingRewrite() const
559{
560 return m_fileHandlingFlags & MediaFileHandlingFlags::ForceRewrite;
561}
562
566 inline void MediaFileInfo::setForceRewrite(bool forceRewrite)
567{
568 CppUtilities::modFlagEnum(m_fileHandlingFlags, MediaFileHandlingFlags::ForceRewrite, forceRewrite);
569}
570
583 inline std::size_t MediaFileInfo::minPadding() const
584{
585 return m_minPadding;
586}
587
593 inline void MediaFileInfo::setMinPadding(std::size_t minPadding)
594{
595 m_minPadding = minPadding;
596}
597
611 inline std::size_t MediaFileInfo::maxPadding() const
612{
613 return m_maxPadding;
614}
615
621 inline void MediaFileInfo::setMaxPadding(std::size_t maxPadding)
622{
623 m_maxPadding = maxPadding;
624}
625
632 inline std::size_t MediaFileInfo::preferredPadding() const
633{
634 return m_preferredPadding;
635}
636
642 inline void MediaFileInfo::setPreferredPadding(std::size_t preferredPadding)
643{
644 m_preferredPadding = preferredPadding;
645}
646
652 inline ElementPosition MediaFileInfo::tagPosition() const
653{
654 return m_tagPosition;
655}
656
667 inline void MediaFileInfo::setTagPosition(ElementPosition tagPosition)
668{
669 m_tagPosition = tagPosition;
670}
671
677 inline bool MediaFileInfo::forceTagPosition() const
678{
679 return m_fileHandlingFlags & MediaFileHandlingFlags::ForceTagPosition;
680}
681
687 inline void MediaFileInfo::setForceTagPosition(bool forceTagPosition)
688{
689 CppUtilities::modFlagEnum(m_fileHandlingFlags, MediaFileHandlingFlags::ForceTagPosition, forceTagPosition);
690}
691
697 inline ElementPosition MediaFileInfo::indexPosition() const
698{
699 return m_indexPosition;
700}
701
707 inline void MediaFileInfo::setIndexPosition(ElementPosition indexPosition)
708{
709 m_indexPosition = indexPosition;
710}
711
717 inline bool MediaFileInfo::forceIndexPosition() const
718{
719 return m_fileHandlingFlags & MediaFileHandlingFlags::ForceIndexPosition;
720}
721
727 inline void MediaFileInfo::setForceIndexPosition(bool forceIndexPosition)
728{
729 CppUtilities::modFlagEnum(m_fileHandlingFlags, MediaFileHandlingFlags::ForceIndexPosition, forceIndexPosition);
730}
731
745 inline std::uint64_t MediaFileInfo::maxFullParseSize() const
746{
747 return m_maxFullParseSize;
748}
749
754 inline void MediaFileInfo::setMaxFullParseSize(std::uint64_t maxFullParseSize)
755{
756 m_maxFullParseSize = maxFullParseSize;
757}
758
759} // namespace TagParser
760
761#endif // TAG_PARSER_MEDIAINFO_H
abstractcontainer.h
basicfileinfo.h
TagParser::AbortableProgressFeedback
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
Definition progressfeedback.h:186
TagParser::AbstractContainer
The AbstractContainer class provides an interface and common functionality to parse and make a certai...
Definition abstractcontainer.h:31
TagParser::AbstractTrack
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
Definition abstracttrack.h:110
TagParser::BasicFileInfo::BasicFileInfo
BasicFileInfo()
Constructs a new BasicFileInfo for the specified file.
Definition basicfileinfo.cpp:23
TagParser::BasicFileInfo::path
const std::string & path() const
Returns the path of the current file.
Definition basicfileinfo.h:103
TagParser::BasicFileInfo::size
std::uint64_t size() const
Returns size of the current file in bytes.
Definition basicfileinfo.h:115
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::EbmlElement
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition ebmlelement.h:32
TagParser::Id3v1Tag
Implementation of TagParser::Tag for ID3v1 tags.
Definition id3v1tag.h:10
TagParser::Id3v2Tag
Implementation of TagParser::Tag for ID3v2 tags.
Definition id3v2tag.h:78
TagParser::MatroskaContainer
Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
Definition matroskacontainer.h:24
TagParser::MatroskaTag
Implementation of TagParser::Tag for the Matroska container.
Definition matroskatag.h:72
TagParser::MediaFileInfo::maxFullParseSize
std::uint64_t maxFullParseSize() const
Returns the maximal file size for a "full parse" in byte.
Definition mediafileinfo.h:745
TagParser::MediaFileInfo::isForcingRewrite
bool isForcingRewrite() const
Returns whether forcing rewriting (when applying changes) is enabled.
Definition mediafileinfo.h:558
TagParser::MediaFileInfo::id3v2Tags
const std::vector< std::unique_ptr< Id3v2Tag > > & id3v2Tags() const
Returns pointers to the assigned ID3v2 tags.
Definition mediafileinfo.h:402
TagParser::MediaFileInfo::parseEverything
void parseEverything(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the container format, the tracks and the tag information of the current file.
Definition mediafileinfo.cpp:584
TagParser::MediaFileInfo::paddingSize
std::uint64_t paddingSize() const
Returns the padding size.
Definition mediafileinfo.h:308
TagParser::MediaFileInfo::containerFormatName
std::string_view containerFormatName() const
Returns the name of the container format.
Definition mediafileinfo.h:277
TagParser::MediaFileInfo::setSaveFilePath
void setSaveFilePath(std::string_view saveFilePath)
Sets the "save file path".
Definition mediafileinfo.h:467
TagParser::MediaFileInfo::containerFormatSubversion
std::string_view containerFormatSubversion() const
Returns the subversion of the container format.
Definition mediafileinfo.h:292
TagParser::MediaFileInfo::matroskaTags
const std::vector< std::unique_ptr< MatroskaTag > > & matroskaTags() const
Returns pointers to the assigned Matroska tags.
Definition mediafileinfo.cpp:1308
TagParser::MediaFileInfo::forceIndexPosition
bool forceIndexPosition() const
Returns whether indexPosition() is forced.
Definition mediafileinfo.h:717
TagParser::MediaFileInfo::containerFormatAbbreviation
std::string_view containerFormatAbbreviation() const
Returns the abbreviation of the container format.
Definition mediafileinfo.cpp:809
TagParser::MediaFileInfo::tracks
std::vector< AbstractTrack * > tracks() const
Returns the tracks for the current file.
Definition mediafileinfo.cpp:890
TagParser::MediaFileInfo::areChaptersSupported
bool areChaptersSupported() const
Returns an indication whether this library supports parsing the chapters of the current file.
Definition mediafileinfo.cpp:1213
TagParser::MediaFileInfo::fileHandlingFlags
MediaFileHandlingFlags fileHandlingFlags()
Returns the currently configured file handling flags.
Definition mediafileinfo.h:519
TagParser::MediaFileInfo::tagsParsingStatus
ParsingStatus tagsParsingStatus() const
Returns an indication whether tag information has been parsed yet.
Definition mediafileinfo.h:325
TagParser::MediaFileInfo::setForceRewrite
void setForceRewrite(bool forceRewrite)
Sets whether forcing rewriting (when applying changes) is enabled.
Definition mediafileinfo.h:566
TagParser::MediaFileInfo::saveFilePath
const std::string & saveFilePath() const
Returns the "save file path" which has been set using setSaveFilePath().
Definition mediafileinfo.h:448
TagParser::MediaFileInfo::setFileHandlingFlags
void setFileHandlingFlags(MediaFileHandlingFlags flags)
Replaces all currently configured file handling flags with the specified flags.
Definition mediafileinfo.h:527
TagParser::MediaFileInfo::createVorbisComment
VorbisComment * createVorbisComment()
Creates a Vorbis comment for the current file.
Definition mediafileinfo.cpp:1494
TagParser::MediaFileInfo::vorbisComment
VorbisComment * vorbisComment() const
Returns a pointer to the first assigned Vorbis comment or nullptr if none is assigned.
Definition mediafileinfo.cpp:1324
TagParser::MediaFileInfo::removeAllTags
void removeAllTags()
Removes all assigned tags from the file.
Definition mediafileinfo.cpp:1198
TagParser::MediaFileInfo::removeId3v1Tag
bool removeId3v1Tag()
Removes a possibly assigned ID3v1 tag from the current file.
Definition mediafileinfo.cpp:1044
TagParser::MediaFileInfo::setMaxFullParseSize
void setMaxFullParseSize(std::uint64_t maxFullParseSize)
Sets the maximal file size for a "full parse" in byte.
Definition mediafileinfo.h:754
TagParser::MediaFileInfo::hasTracksOfType
bool hasTracksOfType(TagParser::MediaType type) const
Returns an indication whether the current file has tracks of the specified type.
Definition mediafileinfo.cpp:920
TagParser::MediaFileInfo::invalidated
void invalidated() override
Reimplemented from BasicFileInfo::invalidated().
Definition mediafileinfo.cpp:1650
TagParser::MediaFileInfo::setMaxPadding
void setMaxPadding(std::size_t maxPadding)
Sets the maximum padding to be written before the data blocks when applying changes.
Definition mediafileinfo.h:621
TagParser::MediaFileInfo::trackCount
std::size_t trackCount() const
Returns the number of tracks that could be parsed.
Definition mediafileinfo.h:346
TagParser::MediaFileInfo::parseAttachments
void parseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the attachments of the current file.
Definition mediafileinfo.cpp:554
TagParser::MediaFileInfo::setMinPadding
void setMinPadding(std::size_t minPadding)
Sets the minimum padding to be written before the data blocks when applying changes.
Definition mediafileinfo.h:593
TagParser::MediaFileInfo::parseTracks
void parseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the tracks of the current file.
Definition mediafileinfo.cpp:324
TagParser::MediaFileInfo::removeId3v2Tag
bool removeId3v2Tag(Id3v2Tag *tag)
Removes an assigned ID3v2 tag from the current file.
Definition mediafileinfo.cpp:1092
TagParser::MediaFileInfo::areAttachmentsSupported
bool areAttachmentsSupported() const
Returns an indication whether this library supports attachment format of the current file.
Definition mediafileinfo.cpp:1230
TagParser::MediaFileInfo::operator=
MediaFileInfo & operator=(const MediaFileInfo &)=delete
TagParser::MediaFileInfo::parseContainerFormat
void parseContainerFormat(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the container format of the current file.
Definition mediafileinfo.cpp:140
TagParser::MediaFileInfo::maxPadding
std::size_t maxPadding() const
Returns the maximum padding to be written before the data blocks when applying changes.
Definition mediafileinfo.h:611
TagParser::MediaFileInfo::tracksParsingStatus
ParsingStatus tracksParsingStatus() const
Returns an indication whether tracks have been parsed yet.
Definition mediafileinfo.h:333
TagParser::MediaFileInfo::id3v1Tag
Id3v1Tag * id3v1Tag() const
Returns a pointer to the assigned ID3v1 tag or nullptr if none is assigned.
Definition mediafileinfo.h:390
TagParser::MediaFileInfo::technicalSummary
std::string technicalSummary() const
Generates a short technical summary about the file's tracks.
Definition mediafileinfo.cpp:1016
TagParser::MediaFileInfo::duration
CppUtilities::TimeSpan duration() const
Returns the overall duration of the file if known; otherwise returns a TimeSpan with zero ticks.
Definition mediafileinfo.cpp:946
TagParser::MediaFileInfo::parseChapters
void parseChapters(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapters of the current file.
Definition mediafileinfo.cpp:521
TagParser::MediaFileInfo::preferredPadding
std::size_t preferredPadding() const
Returns the padding to be written before the data block when applying changes and the file needs to b...
Definition mediafileinfo.h:632
TagParser::MediaFileInfo::removeVorbisComment
bool removeVorbisComment()
Removes all assigned Vorbis comment from the current file.
Definition mediafileinfo.cpp:1521
TagParser::MediaFileInfo::parseTags
void parseTags(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the tag(s) of the current file.
Definition mediafileinfo.cpp:402
TagParser::MediaFileInfo::writingApplication
const std::string & writingApplication() const
Sets the writing application as container-level meta-data.
Definition mediafileinfo.h:485
TagParser::MediaFileInfo::id3v2ToId3v1
bool id3v2ToId3v1()
Converts the existing ID3v2 tags into an ID3v1 tag.
Definition mediafileinfo.cpp:1471
TagParser::MediaFileInfo::setForceTagPosition
void setForceTagPosition(bool forceTagPosition)
Sets whether tagPosition() is forced.
Definition mediafileinfo.h:687
TagParser::MediaFileInfo::createId3v2Tag
Id3v2Tag * createId3v2Tag()
Creates an ID3v2 tag for the current file.
Definition mediafileinfo.cpp:1138
TagParser::MediaFileInfo::areTracksSupported
bool areTracksSupported() const
Returns an indication whether this library supports parsing the tracks information of the current fil...
Definition mediafileinfo.cpp:1247
TagParser::MediaFileInfo::createAppropriateTags
bool createAppropriateTags(const TagCreationSettings &settings=TagCreationSettings())
Ensures appropriate tags are created according the given settings.
Definition mediafileinfo.cpp:616
TagParser::MediaFileInfo::clearParsingResults
void clearParsingResults()
Clears all parsing results and assigned/created/changed information such as detected container format...
Definition mediafileinfo.cpp:1378
TagParser::MediaFileInfo::setForceFullParse
void setForceFullParse(bool forceFullParse)
Sets whether forcing a full parse is enabled.
Definition mediafileinfo.h:550
TagParser::MediaFileInfo::tags
void tags(std::vector< Tag * > &tags) const
Stores all tags assigned to the current file in the specified vector.
Definition mediafileinfo.cpp:1550
TagParser::MediaFileInfo::minPadding
std::size_t minPadding() const
Returns the minimum padding to be written before the data blocks when applying changes.
Definition mediafileinfo.h:583
TagParser::MediaFileInfo::attachmentsParsingStatus
ParsingStatus attachmentsParsingStatus() const
Returns whether the attachments have been parsed yet.
Definition mediafileinfo.h:362
TagParser::MediaFileInfo::createId3v1Tag
Id3v1Tag * createId3v1Tag()
Creates an ID3v1 tag for the current file.
Definition mediafileinfo.cpp:1071
TagParser::MediaFileInfo::hasId3v2Tag
bool hasId3v2Tag() const
Returns an indication whether an ID3v2 tag is assigned.
Definition mediafileinfo.h:378
TagParser::MediaFileInfo::setTagPosition
void setTagPosition(ElementPosition tagPosition)
Sets the position (in the output file) where the tag information is written when applying changes.
Definition mediafileinfo.h:667
TagParser::MediaFileInfo::setWritingApplication
void setWritingApplication(std::string_view writingApplication)
Sets the writing application as container-level meta-data.
Definition mediafileinfo.h:496
TagParser::MediaFileInfo::isForcingFullParse
bool isForcingFullParse() const
Returns an indication whether forcing a full parse is enabled.
Definition mediafileinfo.h:540
TagParser::MediaFileInfo::tagPosition
ElementPosition tagPosition() const
Returns the position (in the output file) where the tag information is written when applying changes.
Definition mediafileinfo.h:652
TagParser::MediaFileInfo::effectiveSize
std::uint64_t effectiveSize() const
Returns the "effective size" of the file if know; otherwise returns 0.
Definition mediafileinfo.h:317
TagParser::MediaFileInfo::availableLanguages
std::unordered_set< std::string > availableLanguages(TagParser::MediaType type=TagParser::MediaType::Audio) const
Determines the available languages for specified media type (by default MediaType::Audio).
Definition mediafileinfo.cpp:984
TagParser::MediaFileInfo::areTagsSupported
bool areTagsSupported() const
Returns an indication whether this library supports the tag format of the current file.
Definition mediafileinfo.cpp:1268
TagParser::MediaFileInfo::removeAllId3v2Tags
bool removeAllId3v2Tags()
Removes all assigned ID3v2 tags from the current file.
Definition mediafileinfo.cpp:1114
TagParser::MediaFileInfo::setBackupDirectory
void setBackupDirectory(std::string_view backupDirectory)
Sets the directory used to store backup files.
Definition mediafileinfo.h:430
TagParser::MediaFileInfo::container
AbstractContainer * container() const
Returns the container for the current file.
Definition mediafileinfo.h:511
TagParser::MediaFileInfo::mimeType
std::string_view mimeType() const
Returns the MIME-type of the container format.
Definition mediafileinfo.cpp:863
TagParser::MediaFileInfo::containerFormat
ContainerFormat containerFormat() const
Returns the container format of the current file.
Definition mediafileinfo.h:262
TagParser::MediaFileInfo::parsedTags
void parsedTags(std::vector< Tag * > &tags) const
Returns all tags parsed from the current file.
Definition mediafileinfo.cpp:1606
TagParser::MediaFileInfo::containerParsingStatus
ParsingStatus containerParsingStatus() const
Returns an indication whether the container format has been parsed yet.
Definition mediafileinfo.h:251
TagParser::MediaFileInfo::id3v1ToId3v2
bool id3v1ToId3v2()
Converts an existing ID3v1 tag into an ID3v2 tag.
Definition mediafileinfo.cpp:1452
TagParser::MediaFileInfo::overallAverageBitrate
double overallAverageBitrate() const
Returns the overall average bitrate in kbit/s of the file if known; otherwise returns 0....
Definition mediafileinfo.cpp:965
TagParser::MediaFileInfo::MediaFileInfo
MediaFileInfo(const MediaFileInfo &)=delete
TagParser::MediaFileInfo::chapters
std::vector< AbstractChapter * > chapters() const
Returns all chapters assigned to the current file.
Definition mediafileinfo.cpp:1336
TagParser::MediaFileInfo::applyChanges
void applyChanges(Diagnostics &diag, AbortableProgressFeedback &progress)
Applies assigned/changed tag information to the current file.
Definition mediafileinfo.cpp:743
TagParser::MediaFileInfo::containerOffset
std::uint64_t containerOffset() const
Returns the actual container start offset.
Definition mediafileinfo.h:300
TagParser::MediaFileInfo::attachments
std::vector< AbstractAttachment * > attachments() const
Returns all attachments assigned to the current file.
Definition mediafileinfo.cpp:1354
TagParser::MediaFileInfo::forceTagPosition
bool forceTagPosition() const
Returns whether tagPosition() is forced.
Definition mediafileinfo.h:677
TagParser::MediaFileInfo::writePadding
static void writePadding(std::ostream &outputStream, uint64_t size)
Writes the specified number of zeroes to outputStream.
Definition mediafileinfo.cpp:1399
TagParser::MediaFileInfo::mergeId3v2Tags
void mergeId3v2Tags()
Merges the assigned ID3v2 tags into a single ID3v2 tag.
Definition mediafileinfo.cpp:1425
TagParser::MediaFileInfo::reportPaddingSizeChanged
void reportPaddingSizeChanged(std::uint64_t newPaddingSize)
Sets the padding size.
Definition mediafileinfo.h:411
TagParser::MediaFileInfo::hasId3v1Tag
bool hasId3v1Tag() const
Returns an indication whether an ID3v1 tag is assigned.
Definition mediafileinfo.h:370
TagParser::MediaFileInfo::chaptersParsingStatus
ParsingStatus chaptersParsingStatus() const
Returns whether the chapters have been parsed yet.
Definition mediafileinfo.h:354
TagParser::MediaFileInfo::removeTag
bool removeTag(Tag *tag)
Removes a possibly assigned tag from the current file.
Definition mediafileinfo.cpp:1159
TagParser::MediaFileInfo::setIndexPosition
void setIndexPosition(ElementPosition indexPosition)
Sets the position (in the output file) where the index is written when applying changes.
Definition mediafileinfo.h:707
TagParser::MediaFileInfo::setPreferredPadding
void setPreferredPadding(std::size_t preferredPadding)
Sets the padding to be written before the data block when applying changes and the file needs to be r...
Definition mediafileinfo.h:642
TagParser::MediaFileInfo::indexPosition
ElementPosition indexPosition() const
Returns the position (in the output file) where the index is written when applying changes.
Definition mediafileinfo.h:697
TagParser::MediaFileInfo::MediaFileInfo
MediaFileInfo()
Constructs a new MediaFileInfo.
Definition mediafileinfo.cpp:107
TagParser::MediaFileInfo::hasAnyTag
bool hasAnyTag() const
Returns an indication whether a tag of any format is assigned.
Definition mediafileinfo.cpp:1591
TagParser::MediaFileInfo::setForceIndexPosition
void setForceIndexPosition(bool forceTagPosition)
Sets whether indexPosition() is forced.
Definition mediafileinfo.h:727
TagParser::MediaFileInfo::backupDirectory
const std::string & backupDirectory() const
Returns the directory used to store backup files.
Definition mediafileinfo.h:421
TagParser::MediaFileInfo::mp4Tag
Mp4Tag * mp4Tag() const
Returns a pointer to the assigned MP4 tag or nullptr if none is assigned.
Definition mediafileinfo.cpp:1293
TagParser::Mp4Atom
The Mp4Atom class helps to parse MP4 files.
Definition mp4atom.h:38
TagParser::Mp4Container
Implementation of GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom>.
Definition mp4container.h:18
TagParser::Mp4Tag
Implementation of TagParser::Tag for the MP4 container.
Definition mp4tag.h:97
TagParser::OggContainer
Implementation of TagParser::AbstractContainer for Ogg files.
Definition oggcontainer.h:134
TagParser::Tag
The Tag class is used to store, read and write tag information.
Definition tag.h:179
TagParser::VorbisComment
Implementation of TagParser::Tag for Vorbis comments.
Definition vorbiscomment.h:27
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
TagParser::SubFormats::None
@ None
Definition mediaformat.h:112
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::containerFormatSubversion
TAG_PARSER_EXPORT std::string_view containerFormatSubversion(ContainerFormat containerFormat)
Returns the subversion of the container format.
Definition signature.cpp:505
TagParser::ElementPosition
ElementPosition
Definition settings.h:13
TagParser::containerFormatName
TAG_PARSER_EXPORT std::string_view containerFormatName(ContainerFormat containerFormat)
Returns the name of the specified container format.
Definition signature.cpp:393
TagParser::TagType
TagType
Specifies the tag type.
Definition tagtype.h:11
TagParser::ParsingStatus
ParsingStatus
The ParsingStatus enum specifies whether a certain part of the file (tracks, tags,...
Definition mediafileinfo.h:40
TagParser::ParsingStatus::CriticalFailure
@ CriticalFailure
Definition mediafileinfo.h:44
TagParser::ParsingStatus::NotParsedYet
@ NotParsedYet
Definition mediafileinfo.h:41
TagParser::ParsingStatus::NotSupported
@ NotSupported
Definition mediafileinfo.h:43
TagParser::ParsingStatus::Ok
@ Ok
Definition mediafileinfo.h:42
TagParser::MediaType
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition mediaformat.h:14
TagParser::MediaType::Audio
@ Audio
Definition mediaformat.h:16
TagParser::MediaFileStructureFlags
MediaFileStructureFlags
The MediaFileStructureFlags enum specifies flags which describing the structure of a media file.
Definition mediafileinfo.h:50
TagParser::MediaFileStructureFlags::ActualExistingId3v1Tag
@ ActualExistingId3v1Tag
Definition mediafileinfo.h:52
TagParser::ContainerFormat
ContainerFormat
Specifies the container format.
Definition signature.h:18
TagParser::MediaFileHandlingFlags
MediaFileHandlingFlags
The MediaFileHandlingFlags enum specifies flags which controls the behavior of MediaFileInfo objects.
Definition mediafileinfo.h:58
TagParser::MediaFileHandlingFlags::ForceIndexPosition
@ ForceIndexPosition
Definition mediafileinfo.h:64
TagParser::MediaFileHandlingFlags::ForceFullParse
@ ForceFullParse
Definition mediafileinfo.h:60
TagParser::MediaFileHandlingFlags::ConvertTotalFields
@ ConvertTotalFields
Definition mediafileinfo.h:69
TagParser::MediaFileHandlingFlags::PreserveWritingApplication
@ PreserveWritingApplication
Definition mediafileinfo.h:68
TagParser::MediaFileHandlingFlags::ForceTagPosition
@ ForceTagPosition
Definition mediafileinfo.h:63
TagParser::MediaFileHandlingFlags::NormalizeKnownTagFieldIds
@ NormalizeKnownTagFieldIds
Definition mediafileinfo.h:65
TagParser::MediaFileHandlingFlags::PreserveRawTimingValues
@ PreserveRawTimingValues
Definition mediafileinfo.h:66
TagParser::MediaFileHandlingFlags::ForceRewrite
@ ForceRewrite
Definition mediafileinfo.h:62
TagParser::MediaFileHandlingFlags::PreserveMuxingApplication
@ PreserveMuxingApplication
Definition mediafileinfo.h:67
settings.h
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)
signature.h
TagParser::MediaFileInfoPrivate
The MediaFileInfoPrivate struct contains private fields of the MediaFileInfo class.
Definition mediafileinfo.cpp:64
TagParser::TagCreationSettings
The TagSettings struct contains settings which can be passed to MediaFileInfo::createAppropriateTags(...
Definition settings.h:50