Tag Parser  6.4.1
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 };
99 
105 namespace SubFormats {
106 
107 enum : unsigned char {
109 };
110 
111 enum Mpeg1AudioLayer : unsigned char {
115 };
116 
117 enum AacProfile : unsigned char {
130 };
131 
132 enum Mpeg2VideoProfile : unsigned char {
139 };
140 
141 enum Mpeg4VideoProfile : unsigned char {
201 };
202 
203 enum AvcProfile : unsigned char {
218 };
219 
220 enum DtsSpecifier : unsigned char {
225 };
226 
227 enum PcmVersion : unsigned char {
228  PcmIntBe = 1,
231 };
232 
233 enum TextSubtitle : unsigned char {
239 };
240 
241 enum ImageSubtitle : unsigned char {
243 };
244 
245 }
246 
250 namespace ExtensionFormats {
251 enum AudioFormatExtensions : unsigned char {
254 };
255 }
256 
258 {
259 public:
260  MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
261 
262  const char *name() const;
263  const char *abbreviation() const;
264  const char *shortAbbreviation() const;
265  const char *extensionName() const;
266  operator bool() const;
267  MediaFormat &operator+=(const MediaFormat &other);
268  bool operator==(GeneralMediaFormat general) const;
269  bool operator!=(GeneralMediaFormat general) const;
270 
272  unsigned char sub;
273  unsigned char extension;
274 };
275 
279 inline MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension) :
280  general(general),
281  sub(sub),
282  extension(extension)
283 {}
284 
289 {
290  if(other) {
291  general = other.general;
292  if(other.sub) {
293  sub = other.sub;
294  }
295  if(other.extension) {
296  extension = other.extension;
297  }
298  }
299  return *this;
300 }
301 
306 {
307  return this->general == general;
308 }
309 
314 {
315  return this->general != general;
316 }
317 
321 inline MediaFormat::operator bool() const
322 {
324 }
325 
326 }
327 
328 #endif // MEDIAFORMAT_H
329 
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:305
MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
Definition: mediaformat.h:279
GeneralMediaFormat general
Definition: mediaformat.h:271
unsigned char sub
Definition: mediaformat.h:272
MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
Definition: mediaformat.h:288
unsigned char extension
Definition: mediaformat.h:273
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:313
#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:257