Tag Parser  6.1.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
mp4tagfield.h
Go to the documentation of this file.
1 #ifndef MP4TAGATOM_H
2 #define MP4TAGATOM_H
3 
4 #include "../generictagfield.h"
5 #include "../statusprovider.h"
6 
7 #include <c++utilities/io/binarywriter.h>
8 
9 #include <vector>
10 #include <sstream>
11 
12 namespace Media
13 {
14 
18 namespace RawDataType {
19 enum KnownValue : uint32
20 {
21  Reserved = 0,
22  Utf8 = 1,
23  Utf16 = 2,
24  Sjis = 3,
25  Utf8Sort = 4,
26  Utf16Sort = 5,
27  Html = 6,
28  Xml = 7,
29  Uuid = 8,
30  Isrc = 9,
31  Mi3p = 10,
32  Gif = 12,
33  Jpeg = 13,
34  Png = 14,
35  Url = 15,
36  Duration = 16,
37  DateTime = 17,
38  Genred = 18,
39  BeSignedInt = 21,
41  BeFloat32 = 23,
42  BeFloat64 = 24,
43  Upc = 25,
44  Bmp = 27,
46  Undefined = 255
47 };
48 }
49 
50 class Mp4TagField;
51 
55 template <>
57 {
58 public:
62  typedef uint32 identifierType;
63 
67  typedef uint32 typeInfoType;
68 
73 };
74 
75 class Mp4Atom;
76 
78 {
79  friend class Mp4TagField;
80 
81 public:
82  void make(std::ostream &stream);
83  const Mp4TagField &field() const;
84  uint64 requiredSize() const;
85 
86 private:
88 
89  Mp4TagField &m_field;
90  std::stringstream m_convertedData;
91  IoUtilities::BinaryWriter m_writer;
92  uint32 m_rawDataType;
93  uint64 m_dataSize;
94  uint64 m_totalSize;
95 };
96 
101 {
102  return m_field;
103 }
104 
108 inline uint64 Mp4TagFieldMaker::requiredSize() const
109 {
110  return m_totalSize;
111 }
112 
113 class TAG_PARSER_EXPORT Mp4TagField : public TagField<Mp4TagField>, public StatusProvider
114 {
115  friend class TagField<Mp4TagField>;
116 
117 public:
118  Mp4TagField();
119  Mp4TagField(identifierType id, const TagValue &value);
120  Mp4TagField(const std::string &mean, const std::string &name, const TagValue &value);
121 
122  void reparse(Mp4Atom &ilstChild);
123  Mp4TagFieldMaker prepareMaking();
124  void make(std::ostream &stream);
125 
126  bool isAdditionalTypeInfoUsed() const;
127  const std::string &name() const;
128  void setName(const std::string &name);
129  const std::string &mean() const;
130  void setMean(const std::string &mean);
131  uint32 parsedRawDataType() const;
132  uint16 countryIndicator() const;
133  uint16 languageIndicator() const;
134  bool supportsNestedFields() const;
135  std::vector<uint32> expectedRawDataTypes() const;
136  uint32 appropriateRawDataType() const;
137 
138 protected:
139  void cleared();
140 
141 private:
142  std::string m_name;
143  std::string m_mean;
144  uint32 m_parsedRawDataType;
145  uint16 m_countryIndicator;
146  uint16 m_langIndicator;
147 };
148 
153 {
154  return false;
155 }
156 
160 inline const std::string &Mp4TagField::name() const
161 {
162  return m_name;
163 }
164 
168 inline void Mp4TagField::setName(const std::string &name)
169 {
170  m_name = name;
171 }
172 
176 inline const std::string &Mp4TagField::mean() const
177 {
178  return m_mean;
179 }
180 
184 inline void Mp4TagField::setMean(const std::string &mean)
185 {
186  m_mean = mean;
187 }
188 
192 inline uint32 Mp4TagField::parsedRawDataType() const
193 {
194  return m_parsedRawDataType;
195 }
196 
200 inline uint16 Mp4TagField::countryIndicator() const
201 {
202  return m_countryIndicator;
203 }
204 
208 inline uint16 Mp4TagField::languageIndicator() const
209 {
210  return m_langIndicator;
211 }
212 
217 {
218  return false;
219 }
220 
221 }
222 
223 #endif // MP4TAGATOM_H
uint64 requiredSize() const
Returns number of bytes which will be written when making the field.
Definition: mp4tagfield.h:108
The TagValue class wraps values of different types.
Definition: tagvalue.h:64
void setName(const std::string &name)
Sets the "name" for the "extended" field.
Definition: mp4tagfield.h:168
void setMean(const std::string &mean)
Sets the "mean" for the "extended" field.
Definition: mp4tagfield.h:184
Defines traits for the specified ImplementationType.
The Mp4TagFieldMaker class helps making tag fields.
Definition: mp4tagfield.h:77
const Mp4TagField & field() const
Returns the associated field.
Definition: mp4tagfield.h:100
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
Definition: mp4tagfield.h:152
const std::string & mean() const
Returns the "mean" for "extended" fields.
Definition: mp4tagfield.h:176
uint16 languageIndicator() const
Returns the language indicator.
Definition: mp4tagfield.h:208
uint32 typeInfoType
The type info is stored using 32-bit unsigned integers.
Definition: mp4tagfield.h:67
The TagField class is used by FieldMapBasedTag to store the fields.
uint32 identifierType
Fields in a iTunes-style MP4 tag are identified by 32-bit unsigned integers.
Definition: mp4tagfield.h:62
Mp4TagField implementationType
The implementation type is Mp4TagField.
Definition: mp4tagfield.h:72
uint16 countryIndicator() const
Returns the country indicator.
Definition: mp4tagfield.h:200
The Mp4Atom class helps to parse MP4 files.
Definition: mp4atom.h:57
const std::string & name() const
Returns the "name" for "extended" fields.
Definition: mp4tagfield.h:160
uint32 parsedRawDataType() const
Returns the raw data type which has been determined when parsing.
Definition: mp4tagfield.h:192
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
The StatusProvider class acts as a base class for objects providing status information.
The Mp4TagField class is used by Mp4Tag to store the fields.
Definition: mp4tagfield.h:113
bool supportsNestedFields() const
Returns whether nested fields are supported.
Definition: mp4tagfield.h:216
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.