Tag Parser: mp4/mp4container.h Source File

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

Loading...
Searching...
No Matches
mp4container.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_MP4CONTAINER_H
2#define TAG_PARSER_MP4CONTAINER_H
3
4#include "./mp4atom.h"
5#include "./mp4tag.h"
6#include "./mp4track.h"
7
8#include "../genericcontainer.h"
9
10#include <cstdint>
11#include <memory>
12#include <vector>
13
14namespace TagParser {
15
16class MediaFileInfo;
17
18 class TAG_PARSER_EXPORT Mp4Container final : public GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom> {
19public:
20 Mp4Container(MediaFileInfo &fileInfo, std::uint64_t startOffset);
21 ~Mp4Container() override;
22
23 bool supportsTrackModifications() const override;
24 bool isFragmented() const;
25 void reset() override;
26 ElementPosition determineTagPosition(Diagnostics &diag) const override;
27 ElementPosition determineIndexPosition(Diagnostics &diag) const override;
28
29 static const CppUtilities::DateTime epoch;
30
31protected:
32 void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override;
33 void internalParseTags(Diagnostics &diag, AbortableProgressFeedback &progress) override;
34 void internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress) override;
35 void internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress) override;
36
37private:
38 void updateOffsets(const std::vector<std::int64_t> &oldMdatOffsets, const std::vector<std::int64_t> &newMdatOffsets, Diagnostics &diag,
39 AbortableProgressFeedback &progress);
40
41 bool m_fragmented;
42};
43
44 inline bool Mp4Container::supportsTrackModifications() const
45{
46 return true;
47}
48
53 inline bool Mp4Container::isFragmented() const
54{
55 return m_fragmented;
56}
57
58} // namespace TagParser
59
60#endif // TAG_PARSER_MP4CONTAINER_H
TagParser::AbortableProgressFeedback
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
Definition progressfeedback.h:186
TagParser::AbstractContainer::startOffset
std::uint64_t startOffset() const
Returns the start offset in the related stream.
Definition abstractcontainer.h:154
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::GenericContainer< MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom >::GenericContainer
GenericContainer(MediaFileInfo &fileInfo, std::uint64_t startOffset)
Definition genericcontainer.h:71
TagParser::GenericContainer< MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom >::fileInfo
MediaFileInfo & fileInfo() const
Definition genericcontainer.h:114
TagParser::MediaFileInfo
The MediaFileInfo class allows to read and write tag information providing a container/tag format ind...
Definition mediafileinfo.h:83
TagParser::Mp4Container::determineIndexPosition
ElementPosition determineIndexPosition(Diagnostics &diag) const override
Determines the position of the index.
Definition mp4container.cpp:65
TagParser::Mp4Container::supportsTrackModifications
bool supportsTrackModifications() const override
Returns whether the implementation supports adding or removing of tracks.
Definition mp4container.h:44
TagParser::Mp4Container::determineTagPosition
ElementPosition determineTagPosition(Diagnostics &diag) const override
Determines the position of the tags inside the file.
Definition mp4container.cpp:53
TagParser::Mp4Container::epoch
static const CppUtilities::DateTime epoch
Dates within MP4 tracks are expressed as the number of seconds since this date.
Definition mp4container.h:29
TagParser::Mp4Container::reset
void reset() override
Discards all parsing results.
Definition mp4container.cpp:47
TagParser::Mp4Container::Mp4Container
Mp4Container(MediaFileInfo &fileInfo, std::uint64_t startOffset)
Constructs a new container for the specified fileInfo at the specified startOffset.
Definition mp4container.cpp:37
TagParser::Mp4Container::internalParseHeader
void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override
Internally called to parse the header.
Definition mp4container.cpp:77
TagParser::Mp4Container::isFragmented
bool isFragmented() const
Returns whether the file is fragmented.
Definition mp4container.h:53
TagParser::Mp4Container::internalParseTags
void internalParseTags(Diagnostics &diag, AbortableProgressFeedback &progress) override
Internally called to parse the tags.
Definition mp4container.cpp:93
TagParser::Mp4Container::internalParseTracks
void internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress) override
Internally called to parse the tracks.
Definition mp4container.cpp:123
TagParser::Mp4Container::internalMakeFile
void internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress) override
Internally called to make the file.
Definition mp4container.cpp:223
genericcontainer.h
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
mp4atom.h
mp4tag.h
mp4track.h
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::ElementPosition
ElementPosition
Definition settings.h:13