2018-03-06 23:09:15 +01:00
|
|
|
#ifndef TAG_PARSER_MPEG4DESCRIPTOR_H
|
|
|
|
#define TAG_PARSER_MPEG4DESCRIPTOR_H
|
2015-06-07 00:16:59 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "../genericfileelement.h"
|
2015-06-07 00:16:59 +02:00
|
|
|
|
2017-02-05 21:02:40 +01:00
|
|
|
#include <memory>
|
2015-06-07 00:18:28 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-06-07 00:18:28 +02:00
|
|
|
|
|
|
|
class Mp4Container;
|
|
|
|
class Mpeg4Descriptor;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Defines traits for the GenericFileElement implementation Mpeg4Descriptor.
|
|
|
|
*/
|
2018-03-07 01:17:50 +01:00
|
|
|
template <> class TAG_PARSER_EXPORT FileElementTraits<Mpeg4Descriptor> {
|
2015-06-07 00:18:28 +02:00
|
|
|
public:
|
2018-07-11 13:19:43 +02:00
|
|
|
using ContainerType = Mp4Container;
|
2019-03-13 19:06:42 +01:00
|
|
|
using IdentifierType = std::uint8_t;
|
|
|
|
using DataSizeType = std::uint32_t;
|
2015-07-13 00:57:38 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the minimal descriptor size which is 2 byte.
|
|
|
|
*/
|
2019-03-13 19:06:42 +01:00
|
|
|
static constexpr std::uint8_t minimumElementSize()
|
2015-07-13 00:57:38 +02:00
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
2015-06-07 00:18:28 +02:00
|
|
|
};
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
class TAG_PARSER_EXPORT Mpeg4Descriptor : public GenericFileElement<Mpeg4Descriptor> {
|
2015-06-07 00:18:28 +02:00
|
|
|
friend class GenericFileElement<Mpeg4Descriptor>;
|
|
|
|
|
2015-06-07 00:16:59 +02:00
|
|
|
public:
|
2019-03-13 19:06:42 +01:00
|
|
|
Mpeg4Descriptor(ContainerType &container, std::uint64_t startOffset, std::uint64_t maxSize);
|
2015-06-07 00:18:28 +02:00
|
|
|
|
|
|
|
std::string idToString() const;
|
|
|
|
bool isParent() const;
|
|
|
|
bool isPadding() const;
|
2019-03-13 19:06:42 +01:00
|
|
|
std::uint64_t firstChildOffset() const;
|
2015-06-07 00:18:28 +02:00
|
|
|
|
|
|
|
protected:
|
2019-03-13 19:06:42 +01:00
|
|
|
Mpeg4Descriptor(Mpeg4Descriptor &parent, std::uint64_t startOffset);
|
2015-06-07 00:18:28 +02:00
|
|
|
|
2018-03-05 17:49:29 +01:00
|
|
|
void internalParse(Diagnostics &diag);
|
2015-06-07 00:18:28 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string parsingContext() const;
|
2015-06-07 00:16:59 +02:00
|
|
|
};
|
|
|
|
|
2015-06-07 00:18:28 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns an indication whether the descriptor contains sub descriptors.
|
|
|
|
*
|
|
|
|
* \remarks Returns true if a first child has been denoted (via denoteFirstChild()).
|
|
|
|
*/
|
|
|
|
inline bool Mpeg4Descriptor::isParent() const
|
|
|
|
{
|
|
|
|
return m_firstChild != nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns always false for MPEG-4 descriptors.
|
|
|
|
*/
|
|
|
|
inline bool Mpeg4Descriptor::isPadding() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the offset of the first child (relative to the start offset of this descriptor).
|
|
|
|
*
|
|
|
|
* \remarks The first child must be denoted (via denoteFirstChild()).
|
|
|
|
*/
|
2019-03-13 19:06:42 +01:00
|
|
|
inline std::uint64_t Mpeg4Descriptor::firstChildOffset() const
|
2015-06-07 00:18:28 +02:00
|
|
|
{
|
|
|
|
return firstChild() ? firstChild()->startOffset() - startOffset() : 0;
|
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|
2015-06-07 00:18:28 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
#endif // TAG_PARSER_MPEG4DESCRIPTOR_H
|