1#ifndef TAG_PARSER_ABSTRACTCONTAINER_H
2#define TAG_PARSER_ABSTRACTCONTAINER_H
8#include <c++utilities/chrono/datetime.h>
9#include <c++utilities/chrono/timespan.h>
10#include <c++utilities/io/binaryreader.h>
11#include <c++utilities/io/binarywriter.h>
26class AbstractAttachment;
28class AbortableProgressFeedback;
29struct AbstractContainerPrivate;
38 CppUtilities::BinaryReader &
reader();
39 CppUtilities::BinaryWriter &
writer();
55 virtual Tag *
tag(std::size_t index);
56 virtual std::size_t
tagCount()
const;
80 const std::vector<std::string> &
titles()
const;
81 void setTitle(std::string_view title, std::size_t segmentIndex = 0);
86 CppUtilities::TimeSpan
duration()
const;
124 std::unique_ptr<AbstractContainerPrivate> &p();
126 std::uint64_t m_startOffset;
127 std::iostream *m_stream;
128 CppUtilities::BinaryReader m_reader;
129 CppUtilities::BinaryWriter m_writer;
130 std::unique_ptr<AbstractContainerPrivate> m_p;
147 m_reader.setStream(m_stream);
148 m_writer.setStream(m_stream);
156 return m_startOffset;
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
The AbstractAttachment class parses and stores attachment information.
The AbstractChapter class parses chapter information.
CppUtilities::DateTime modificationTime() const
Returns the modification time of the file if known; otherwise the returned date time is null.
std::uint64_t doctypeVersion() const
Returns the document type version if known; otherwise returns 0.
virtual bool removeTrack(AbstractTrack *track)
Removes the specified track to the container.
bool areAttachmentsParsed() const
Returns an indication whether the attachments have been parsed yet.
CppUtilities::DateTime m_modificationTime
std::iostream & stream()
Returns the related stream.
virtual void removeAllTags()
Removes all tags attached to the container.
std::uint64_t startOffset() const
Returns the start offset in the related stream.
virtual void internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to make the file.
void setTitle(std::string_view title, std::size_t segmentIndex=0)
Sets the title for the specified segment.
virtual void internalParseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to parse the attachments.
std::vector< std::string > m_titles
void parseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the tracks of the file if not parsed yet.
virtual Tag * tag(std::size_t index)
Returns the tag with the specified index.
bool areTracksParsed() const
Returns an indication whether the tracks have been parsed yet.
virtual std::size_t segmentCount() const
Returns the number of segments.
std::uint64_t doctypeReadVersion() const
Returns the document type "read version" if known; otherwise returns 0.
virtual std::size_t attachmentCount() const
Returns the number of attachments the container holds.
virtual bool supportsTrackModifications() const
Returns whether the implementation supports adding or removing of tracks.
const std::vector< std::string > & writingApplications() const
Returns the writing applications specified as meta-data.
virtual AbstractChapter * chapter(std::size_t index)
Returns the chapter with the specified index.
std::uint64_t version() const
Returns the version if known; otherwise returns 0.
CppUtilities::DateTime creationTime() const
Returns the creation time of the file if known; otherwise the returned date time is null.
const std::vector< std::string > & muxingApplications() const
Returns the muxing applications specified as meta-data.
bool isHeaderParsed() const
Returns an indication whether the header has been parsed yet.
virtual void reset()
Discards all parsing results.
void setStream(std::iostream &stream)
Sets the related stream.
void makeFile(Diagnostics &diag, AbortableProgressFeedback &progress)
Rewrites the file to apply changed tag information.
void parseChapters(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapters of the file if not parsed yet.
std::uint32_t timeScale() const
Returns the time scale of the file if known; otherwise returns 0.
virtual void internalParseChapters(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to parse the chapters.
CppUtilities::BinaryWriter & writer()
Returns the related BinaryWriter.
virtual AbstractAttachment * createAttachment()
Creates and returns a new attachment.
virtual bool removeTag(Tag *tag)
Removes the specified tag from the container.
void parseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the header if not parsed yet.
virtual ElementPosition determineTagPosition(Diagnostics &diag) const
Determines the position of the tags inside the file.
std::uint64_t m_doctypeReadVersion
virtual AbstractTrack * track(std::size_t index)
Returns the track with the specified index.
std::uint64_t m_readVersion
virtual ElementPosition determineIndexPosition(Diagnostics &diag) const
Determines the position of the index.
CppUtilities::BinaryReader & reader()
Returns the related BinaryReader.
CppUtilities::DateTime m_creationTime
const std::string & documentType() const
Returns a string that describes the document type if available; otherwise returns an empty string.
virtual Tag * createTag(const TagTarget &target=TagTarget())
Creates and returns a tag for the specified target.
const std::vector< std::string > & titles() const
Returns the title(s) of the file.
virtual void internalParseTags(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to parse the tags.
virtual std::size_t tagCount() const
Returns the number of tags attached to the container.
bool areTagsParsed() const
Returns an indication whether the tags have been parsed yet.
bool areChaptersParsed() const
Returns an indication whether the chapters have been parsed yet.
virtual std::size_t trackCount() const
Returns the number of tracks the container holds.
virtual bool supportsTitle() const
Returns whether the title property is supported.
void parseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the attachments of the file if not parsed yet.
std::uint64_t m_doctypeVersion
virtual std::size_t chapterCount() const
Returns the number of chapters the container holds.
AbstractContainer(std::iostream &stream, std::uint64_t startOffset)
Constructs a new container for the specified file stream at the specified startOffset.
virtual void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to parse the header.
void parseTags(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the tag information if not parsed yet.
std::uint32_t m_timeScale
CppUtilities::TimeSpan m_duration
CppUtilities::TimeSpan duration() const
Returns the duration of the file if known; otherwise returns a time span of zero ticks.
std::uint64_t readVersion() const
Returns the "read version" if known; otherwise returns 0.
virtual AbstractAttachment * attachment(std::size_t index)
Returns the attachment with the specified index.
virtual void removeAllTracks()
Removes all tracks from the container.
virtual void internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
Internally called to parse the tracks.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
The Diagnostics class is a container for DiagMessage.
The TagTarget class specifies the target of a tag.
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.