Tag Parser  6.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
abstractcontainer.cpp
Go to the documentation of this file.
1 #include "./abstractcontainer.h"
2 
3 using namespace std;
4 using namespace ChronoUtilities;
5 using namespace ConversionUtilities;
6 using namespace IoUtilities;
7 
8 namespace Media {
9 
18 AbstractContainer::AbstractContainer(iostream &stream, uint64 startOffset) :
19  m_version(0),
20  m_readVersion(0),
21  m_doctypeVersion(0),
22  m_doctypeReadVersion(0),
23  m_timeScale(0),
24  m_headerParsed(false),
25  m_tagsParsed(false),
26  m_tracksParsed(false),
27  m_tracksAltered(false),
28  m_chaptersParsed(false),
29  m_attachmentsParsed(false),
30  m_startOffset(startOffset),
31  m_stream(&stream),
32  m_reader(BinaryReader(m_stream)),
33  m_writer(BinaryWriter(m_stream))
34 {}
35 
43 {}
44 
55 {
56  if(!isHeaderParsed()) {
58  removeAllTags();
61  m_headerParsed = true;
62  }
63 }
64 
83 {
84  if(!areTagsParsed()) {
85  parseHeader();
87  m_tagsParsed = true;
88  }
89 }
90 
107 {
108  if(!areTracksParsed()) {
109  parseHeader();
111  m_tracksParsed = true;
112  m_tracksAltered = false;
113  }
114 }
115 
127 {
128  if(!areChaptersParsed()) {
129  parseHeader();
131  m_chaptersParsed = true;
132  }
133 }
134 
146 {
147  if(!areAttachmentsParsed()) {
148  parseHeader();
150  m_attachmentsParsed = true;
151  }
152 }
153 
162 {
164 }
165 
170 {
171  return false;
172 }
173 
184 {
185  return ElementPosition::Keep;
186 }
187 
197 {
198  throw NotImplementedException();
199 }
200 
210 {
211  throw NotImplementedException();
212 }
213 
223 {
224  throw NotImplementedException();
225 }
226 
236 {
237  throw NotImplementedException();
238 }
239 
249 {
250  throw NotImplementedException();
251 }
252 
262 {
263  throw NotImplementedException();
264 }
265 
277 {
278  return nullptr;
279 }
280 
287 {
288  return nullptr;
289 }
290 
297 {
298  return 0;
299 }
300 
315 {
316  return false;
317 }
318 
330 {}
331 
342 {
343  return ElementPosition::Keep;
344 }
345 
352 {
353  return nullptr;
354 }
355 
360 {
361  return 0;
362 }
363 
379 {
380  return false;
381 }
382 
397 {}
398 
405 {
406  return nullptr;
407 }
408 
413 {
414  return 0;
415 }
416 
423 {
424  return nullptr;
425 }
426 
433 {
434  return nullptr;
435 }
436 
441 {
442  return 0;
443 }
444 
449 {
450  return false;
451 }
452 
457 {
458  return 1;
459 }
460 
465 {
466  m_headerParsed = false;
467  m_tagsParsed = false;
468  m_tracksParsed = false;
469  m_tracksAltered = false;
470  m_chaptersParsed = false;
471  m_attachmentsParsed = false;
472  m_version = 0;
473  m_readVersion = 0;
474  m_doctypeVersion = 0;
476  m_timeScale = 0;
477  m_titles.clear();
478 }
479 
480 } // namespace Media
virtual bool supportsTitle() const
Returns whether the title property is supported.
virtual std::size_t trackCount() const
Returns the number of tracks the container holds.
void invalidateStatus()
Invalidates the current status.
virtual void removeAllTags()
Removes all tags attached to the container.
This exception is thrown when the an operation is invoked that has not been implemented yet...
Definition: exceptions.h:59
virtual bool removeTag(Tag *tag)
Removes the specified tag from the container.
void parseAttachments()
Parses the attachments of the file if not parsed yet.
virtual AbstractAttachment * attachment(std::size_t index)
Returns the attachment with the specified index.
The AbstractChapter class parses chapter information.
virtual Tag * createTag(const TagTarget &target=TagTarget())
Creates and returns a tag for the specified target.
virtual std::size_t chapterCount() const
Returns the number of chapters the container holds.
virtual AbstractChapter * chapter(std::size_t index)
Returns the chapter with the specified index.
virtual void internalParseChapters()
Internally called to parse the chapters.
virtual std::size_t segmentCount() const
Returns the number of segments.
void makeFile()
Rewrites the file to apply changed tag information.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
Definition: abstracttrack.h:40
virtual void internalParseTags()
Internally called to parse the tags.
STL namespace.
bool areChaptersParsed() const
Returns an indication whether the chapters have been parsed yet.
virtual ElementPosition determineTagPosition() const
Determines the position of the tags inside the file.
virtual void internalParseAttachments()
Internally called to parse the attachments.
virtual void removeAllTracks()
Removes all tracks from the container.
virtual std::size_t attachmentCount() const
Returns the number of attachments the container holds.
bool areTracksParsed() const
Returns an indication whether the tracks have been parsed yet.
virtual void internalMakeFile()
Internally called to make the file.
void parseChapters()
Parses the chapters of the file if not parsed yet.
Contains utility classes helping to read and write streams.
The AbstractAttachment class parses and stores attachment information.
void parseTags()
Parses the tag information if not parsed yet.
virtual std::size_t tagCount() const
Returns the number of tags attached to the container.
bool isHeaderParsed() const
Returns an indication whether the header has been parsed yet.
void parseHeader()
Parses the header if not parsed yet.
bool areAttachmentsParsed() const
Returns an indication whether the attachments have been parsed yet.
The Tag class is used to store, read and write tag information.
Definition: tag.h:98
bool areTagsParsed() const
Returns an indication whether the tags have been parsed yet.
virtual ~AbstractContainer()
Destroys the container.
virtual bool supportsTrackModifications() const
Returns whether the implementation supports adding or removing of tracks.
virtual void reset()
Discards all parsing results.
std::vector< std::string > m_titles
virtual void internalParseHeader()
Internally called to parse the header.
virtual void internalParseTracks()
Internally called to parse the tracks.
virtual AbstractTrack * track(std::size_t index)
Returns the track with the specified index.
virtual AbstractAttachment * createAttachment()
Creates and returns a new attachment.
The TagTarget class specifies the target of a tag.
Definition: tagtarget.h:31
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
void parseTracks()
Parses the tracks of the file if not parsed yet.
virtual bool removeTrack(AbstractTrack *track)
Removes the specified track to the container.
virtual ElementPosition determineIndexPosition() const
Determines the position of the index.
virtual Tag * tag(std::size_t index)
Returns the tag with the specified index.