Tag Parser  6.5.0
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 MEDIAFORMAT_H
2 #define MEDIAFORMAT_H
3 
4 #include "./global.h"
5 
6 #include <utility>
7 
8 namespace Media {
9 
13 enum class MediaType
14 {
15  Unknown,
16  Audio,
17  Video,
18  Text,
19  Buttons,
20  Control,
21  Hint
22 };
23 
24 extern const char *TAG_PARSER_EXPORT mediaTypeName(MediaType mediaType);
25 
30 {
31  Unknown,
32  Aac,
33  Ac3,
34  Ac4,
35  AdpcmAcm,
36  AfxStream,
37  Alac,
38  Als,
39  Amr,
40  Avc,
41  Bitmap,
42  Dirac,
43  Dts,
44  DtsHd,
45  EAc3,
46  Evrc,
47  Flac,
49  Gif,
50  Gpp2Cmf,
51  Hevc,
52  ImaadpcmAcm,
55  Jpeg,
56  OggKate,
57  Opus,
61  DolbyMlp,
62  Mpeg1Audio,
63  Mpeg1Video,
64  Mpeg2Audio,
65  Mpeg2Video,
66  Mpeg4Video,
68  Mpc,
69  Pcm,
70  Png,
71  ProRes,
72  Qcelp,
75  RealAudio,
76  RealVideo,
77  Sa0c,
78  Smv,
81  Systems,
82  TextSubtitle,
83  Theora,
84  Tiff,
85  TimedText,
86  Tta,
88  Vc1,
89  VobBtn,
90  VobSub,
91  Vorbis,
92  Vp8,
93  Vp9,
94  WavPack,
97  DvbSub,
98  Speex,
99  Daala,
100  MonkeysAudio,
101 };
102 
108 namespace SubFormats {
109 
110 enum : unsigned char {
112 };
113 
114 enum Mpeg1AudioLayer : unsigned char {
118 };
119 
120 enum AacProfile : unsigned char {
133 };
134 
135 enum Mpeg2VideoProfile : unsigned char {
142 };
143 
144 enum Mpeg4VideoProfile : unsigned char {
204 };
205 
206 enum AvcProfile : unsigned char {
221 };
222 
223 enum DtsSpecifier : unsigned char {
228 };
229 
230 enum PcmVersion : unsigned char {
231  PcmIntBe = 1,
234 };
235 
236 enum TextSubtitle : unsigned char {
242 };
243 
244 enum ImageSubtitle : unsigned char {
246 };
247 
248 }
249 
253 namespace ExtensionFormats {
254 enum AudioFormatExtensions : unsigned char {
257 };
258 }
259 
261 {
262 public:
263  MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
264 
265  const char *name() const;
266  const char *abbreviation() const;
267  const char *shortAbbreviation() const;
268  const char *extensionName() const;
269  operator bool() const;
270  MediaFormat &operator+=(const MediaFormat &other);
271  bool operator==(GeneralMediaFormat general) const;
272  bool operator!=(GeneralMediaFormat general) const;
273 
275  unsigned char sub;
276  unsigned char extension;
277 };
278 
282 inline MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension) :
283  general(general),
284  sub(sub),
285  extension(extension)
286 {}
287 
292 {
293  if(other) {
294  general = other.general;
295  if(other.sub) {
296  sub = other.sub;
297  }
298  if(other.extension) {
299  extension = other.extension;
300  }
301  }
302  return *this;
303 }
304 
309 {
310  return this->general == general;
311 }
312 
317 {
318  return this->general != general;
319 }
320 
324 inline MediaFormat::operator bool() const
325 {
327 }
328 
329 }
330 
331 #endif // MEDIAFORMAT_H
332 
GeneralMediaFormat
The GeneralMediaFormat enum specifies the general format of media data (PCM, MPEG-4, PNG, ...).
Definition: mediaformat.h:29
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition: mediaformat.h:13
bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
Definition: mediaformat.h:308
MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
Definition: mediaformat.h:282
GeneralMediaFormat general
Definition: mediaformat.h:274
unsigned char sub
Definition: mediaformat.h:275
MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
Definition: mediaformat.h:291
unsigned char extension
Definition: mediaformat.h:276
constexpr bool operator!=(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:33
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:28
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
const char *TAG_PARSER_EXPORT mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
bool operator!=(GeneralMediaFormat general) const
Returns whether the media format is not the specified general media format.
Definition: mediaformat.h:316
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:260