2018-03-06 23:09:15 +01:00
|
|
|
#ifndef TAG_PARSER_MP4CONTAINER_H
|
|
|
|
#define TAG_PARSER_MP4CONTAINER_H
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "./mp4atom.h"
|
|
|
|
#include "./mp4tag.h"
|
|
|
|
#include "./mp4track.h"
|
2015-09-06 15:42:18 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "../genericcontainer.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2019-03-13 19:06:42 +01:00
|
|
|
#include <cstdint>
|
2015-04-22 19:22:01 +02:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
class MediaFileInfo;
|
|
|
|
|
2020-12-18 21:13:52 +01:00
|
|
|
class TAG_PARSER_EXPORT Mp4Container final : public GenericContainer<MediaFileInfo, Mp4Tag, Mp4Track, Mp4Atom> {
|
2015-04-22 19:22:01 +02:00
|
|
|
public:
|
2019-03-13 19:06:42 +01:00
|
|
|
Mp4Container(MediaFileInfo &fileInfo, std::uint64_t startOffset);
|
2018-03-05 17:49:29 +01:00
|
|
|
~Mp4Container() override;
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-05 17:49:29 +01:00
|
|
|
bool supportsTrackModifications() const override;
|
2015-04-22 19:22:01 +02:00
|
|
|
bool isFragmented() const;
|
2018-03-05 17:49:29 +01:00
|
|
|
void reset() override;
|
|
|
|
ElementPosition determineTagPosition(Diagnostics &diag) const override;
|
|
|
|
ElementPosition determineIndexPosition(Diagnostics &diag) const override;
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
protected:
|
2018-03-05 17:49:29 +01:00
|
|
|
void internalParseHeader(Diagnostics &diag) override;
|
|
|
|
void internalParseTags(Diagnostics &diag) override;
|
|
|
|
void internalParseTracks(Diagnostics &diag) override;
|
|
|
|
void internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress) override;
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
private:
|
2019-03-13 19:06:42 +01:00
|
|
|
void updateOffsets(const std::vector<std::int64_t> &oldMdatOffsets, const std::vector<std::int64_t> &newMdatOffsets, Diagnostics &diag);
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
bool m_fragmented;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool Mp4Container::supportsTrackModifications() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns whether the file is fragmented.
|
|
|
|
* Track information needs to be parsed to detect fragmentation.
|
|
|
|
*/
|
|
|
|
inline bool Mp4Container::isFragmented() const
|
|
|
|
{
|
|
|
|
return m_fragmented;
|
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
#endif // TAG_PARSER_MP4CONTAINER_H
|