Tag Parser  7.0.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
mediaformat.h
Go to the documentation of this file.
1 #ifndef TAG_PARSER_MEDIAFORMAT_H
2 #define TAG_PARSER_MEDIAFORMAT_H
3 
4 #include "./global.h"
5 
6 #include <utility>
7 
8 namespace TagParser {
9 
13 enum class MediaType : unsigned int {
14  Unknown,
15  Audio,
16  Video,
17  Text,
18  Buttons,
19  Control,
20  Hint
21 };
22 
23 extern const char *TAG_PARSER_EXPORT mediaTypeName(MediaType mediaType);
24 
28 enum class GeneralMediaFormat : unsigned int {
29  Unknown,
30  Aac,
31  Ac3,
32  Ac4,
33  AdpcmAcm,
34  AfxStream,
35  Alac,
36  Als,
37  Amr,
38  Avc,
39  Bitmap,
40  Daala,
41  Dirac,
42  DolbyMlp,
43  Dts,
44  DtsHd,
45  DvbSub,
46  EAc3,
47  Evrc,
48  Flac,
50  Gif,
51  Gpp2Cmf,
52  Hevc,
53  ImaadpcmAcm,
56  Jpeg,
60  MonkeysAudio,
61  Mpc,
62  Mpeg1Audio,
63  Mpeg1Video,
64  Mpeg2Audio,
65  Mpeg2Video,
67  Mpeg4Video,
68  OggKate,
69  Opus,
70  Pcm,
71  Png,
72  ProRes,
73  Qcelp,
76  RealAudio,
77  RealVideo,
78  Sa0c,
79  Smv,
80  Speex,
83  Systems,
84  TextSubtitle,
85  Theora,
86  Tiff,
87  TimedText,
88  Tta,
90  Vc1,
91  VobBtn,
92  VobSub,
93  Vorbis,
94  Vp8,
95  Vp9,
96  WavPack,
99 };
100 
106 namespace SubFormats {
107 
108 enum : unsigned char { None };
109 
110 enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
111 
112 enum AacProfile : unsigned char {
125 };
126 
127 enum Mpeg2VideoProfile : unsigned char {
134 };
135 
136 enum Mpeg4VideoProfile : unsigned char {
196 };
197 
198 enum AvcProfile : unsigned char {
213 };
214 
215 enum DtsSpecifier : unsigned char {
220 };
221 
222 enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
223 
224 enum TextSubtitle : unsigned char {
230 };
231 
232 enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
233 
234 } // namespace SubFormats
235 
239 namespace ExtensionFormats {
241 }
242 
244 public:
245  MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
246 
247  const char *name() const;
248  const char *abbreviation() const;
249  const char *shortAbbreviation() const;
250  const char *extensionName() const;
251  operator bool() const;
252  MediaFormat &operator+=(const MediaFormat &other);
253  bool operator==(GeneralMediaFormat general) const;
254  bool operator!=(GeneralMediaFormat general) const;
255 
257  unsigned char sub;
258  unsigned char extension;
259 };
260 
264 inline MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
265  : general(general)
266  , sub(sub)
267  , extension(extension)
268 {
269 }
270 
275 {
276  if (other) {
277  general = other.general;
278  if (other.sub) {
279  sub = other.sub;
280  }
281  if (other.extension) {
282  extension = other.extension;
283  }
284  }
285  return *this;
286 }
287 
291 inline bool MediaFormat::operator==(GeneralMediaFormat general) const
292 {
293  return this->general == general;
294 }
295 
299 inline bool MediaFormat::operator!=(GeneralMediaFormat general) const
300 {
301  return this->general != general;
302 }
303 
307 inline MediaFormat::operator bool() const
308 {
309  return general != GeneralMediaFormat::Unknown;
310 }
311 
312 } // namespace TagParser
313 
314 #endif // TAG_PARSER_MEDIAFORMAT_H
bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
Definition: mediaformat.h:291
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition: mediaformat.h:13
GeneralMediaFormat
The GeneralMediaFormat enum specifies the general format of media data (PCM, MPEG-4, PNG, ...).
Definition: mediaformat.h:28
GeneralMediaFormat general
Definition: mediaformat.h:256
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:19
MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
Definition: mediaformat.h:264
constexpr bool operator!=(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:24
const char *TAG_PARSER_EXPORT mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
unsigned char extension
Definition: mediaformat.h:258
constexpr TagCreationFlags & operator+=(TagCreationFlags &lhs, TagCreationFlags rhs)
Definition: settings.h:55
MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
Definition: mediaformat.h:274
bool operator!=(GeneralMediaFormat general) const
Returns whether the media format is not the specified general media format.
Definition: mediaformat.h:299
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.