1 #ifndef MEDIA_GENERICCONTAINER_H 2 #define MEDIA_GENERICCONTAINER_H 23 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
32 void validateElementStructure(
NotificationList &gatheredNotifications, uint64 *paddingSize =
nullptr);
33 FileInfoType &fileInfo()
const;
34 ElementType *firstElement()
const;
35 const std::vector<std::unique_ptr<ElementType> > &additionalElements()
const;
36 std::vector<std::unique_ptr<ElementType> > &additionalElements();
37 TagType *tag(std::size_t index);
38 std::size_t tagCount()
const;
40 std::size_t trackCount()
const;
41 const std::vector<std::unique_ptr<TagType> > &tags()
const;
42 std::vector<std::unique_ptr<TagType> > &tags();
43 const std::vector<std::unique_ptr<TrackType> > &tracks()
const;
44 std::vector<std::unique_ptr<TrackType> > &tracks();
47 bool removeTag(
Tag *tag);
51 void removeAllTracks();
62 std::vector<std::unique_ptr<TagType> >
m_tags;
63 std::vector<std::unique_ptr<TrackType> >
m_tracks;
66 FileInfoType *m_fileInfo;
72 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
84 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
98 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
103 m_firstElement->validateSubsequentElementStructure(gatheredNotifications, paddingSize);
112 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
130 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
133 return m_firstElement.get();
143 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
146 return m_additionalElements;
156 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
159 return m_additionalElements;
162 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
165 return m_tags[index].get();
168 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
171 return m_tags.size();
174 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
177 return m_tracks[index].get();
180 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
183 return m_tracks.size();
195 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
210 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
225 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
240 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
246 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
250 if(!m_tags.empty()) {
251 if(!target.
isEmpty() && m_tags.front()->supportsTarget()) {
252 for(
auto &tag : m_tags) {
253 if(tag->target() == target) {
258 return m_tags.front().get();
263 m_tags.emplace_back(std::make_unique<TagType>());
264 auto &tag = m_tags.back();
265 tag->setTarget(target);
269 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
272 if(
auto size = m_tags.size()) {
273 m_tags.erase(std::remove_if(m_tags.begin(), m_tags.end(), [tag] (
const std::unique_ptr<TagType> &existingTag) ->
bool {
274 return static_cast<Tag *
>(existingTag.get()) == tag;
276 return size != m_tags.size();
281 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
303 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
306 if(areTracksParsed() && supportsTrackModifications()) {
308 auto id = track->id();
310 for(
const auto &track : m_tracks) {
311 if(track->id() == id) {
313 goto ensureIdIsUnique;
318 m_tracks.emplace_back(track);
319 return m_tracksAltered =
true;
324 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
327 bool removed =
false;
328 if(areTracksParsed() && supportsTrackModifications() && !m_tracks.empty()) {
329 for(
auto i = m_tracks.end() - 1, begin = m_tracks.begin(); ; --i) {
330 if(static_cast<AbstractTrack *>(i->get()) == track) {
340 m_tracksAltered =
true;
346 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
349 if(areTracksParsed() && supportsTrackModifications() && m_tracks.size()) {
351 m_tracksAltered =
true;
355 template <
class FileInfoType,
class TagType,
class TrackType,
class ElementType>
358 AbstractContainer::reset();
359 m_firstElement.reset();
360 m_additionalElements.clear();
367 #endif // MEDIA_GENERICCONTAINER_H
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.