2015-04-22 19:22:01 +02:00
|
|
|
#ifndef MP4TAG_H
|
|
|
|
#define MP4TAG_H
|
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "./mp4tagfield.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "../fieldbasedtag.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
namespace Media
|
|
|
|
{
|
|
|
|
|
|
|
|
class Mp4Atom;
|
2015-12-10 13:50:46 +01:00
|
|
|
class Mp4Tag;
|
|
|
|
|
|
|
|
class LIB_EXPORT Mp4TagMaker
|
|
|
|
{
|
|
|
|
friend class Mp4Tag;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void make(std::ostream &stream);
|
|
|
|
const Mp4Tag &tag() const;
|
|
|
|
uint64 requiredSize() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Mp4TagMaker(Mp4Tag &tag);
|
|
|
|
|
|
|
|
Mp4Tag &m_tag;
|
2015-12-22 23:54:35 +01:00
|
|
|
std::vector<Mp4TagFieldMaker> m_maker;
|
2015-12-10 13:50:46 +01:00
|
|
|
uint64 m_metaSize;
|
|
|
|
uint64 m_ilstSize;
|
|
|
|
bool m_omitPreDefinedGenre;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the associated tag.
|
|
|
|
*/
|
|
|
|
inline const Mp4Tag &Mp4TagMaker::tag() const
|
|
|
|
{
|
|
|
|
return m_tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of bytes which will be written when making the tag.
|
|
|
|
*/
|
|
|
|
inline uint64 Mp4TagMaker::requiredSize() const
|
|
|
|
{
|
|
|
|
return m_metaSize;
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
class LIB_EXPORT Mp4Tag : public FieldMapBasedTag<Mp4TagField>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Mp4Tag();
|
|
|
|
|
|
|
|
TagType type() const;
|
|
|
|
const char *typeName() const;
|
|
|
|
TagTextEncoding proposedTextEncoding() const;
|
|
|
|
bool canEncodingBeUsed(TagTextEncoding encoding) const;
|
|
|
|
|
|
|
|
uint32 fieldId(KnownField value) const;
|
|
|
|
KnownField knownField(const uint32 &id) const;
|
|
|
|
using FieldMapBasedTag<Mp4TagField>::value;
|
|
|
|
const TagValue &value(KnownField value) const;
|
|
|
|
const TagValue &value(const std::string mean, const std::string name) const;
|
|
|
|
using FieldMapBasedTag<Mp4TagField>::setValue;
|
|
|
|
bool setValue(KnownField field, const TagValue &value);
|
|
|
|
bool setValue(const std::string mean, const std::string name, const TagValue &value);
|
|
|
|
using FieldMapBasedTag<Mp4TagField>::hasField;
|
|
|
|
bool hasField(KnownField value) const;
|
|
|
|
|
|
|
|
void parse(Mp4Atom &metaAtom);
|
2015-12-10 13:50:46 +01:00
|
|
|
Mp4TagMaker prepareMaking();
|
2015-04-22 19:22:01 +02:00
|
|
|
void make(std::ostream &stream);
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new tag.
|
|
|
|
*/
|
|
|
|
inline Mp4Tag::Mp4Tag()
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline TagType Mp4Tag::type() const
|
|
|
|
{
|
|
|
|
return TagType::Mp4Tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const char *Mp4Tag::typeName() const
|
|
|
|
{
|
|
|
|
return "MP4/iTunes tag";
|
|
|
|
}
|
|
|
|
|
|
|
|
inline TagTextEncoding Mp4Tag::proposedTextEncoding() const
|
|
|
|
{
|
|
|
|
return TagTextEncoding::Utf8;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MP4TAG_H
|