Tag Parser  8.0.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 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 TAG_PARSER_EXPORT const char *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  Av1,
40  Bitmap,
41  Daala,
42  Dirac,
43  DolbyMlp,
44  Dts,
45  DtsHd,
46  DvbSub,
47  EAc3,
48  Evrc,
49  Flac,
51  Gif,
52  Gpp2Cmf,
53  Hevc,
54  ImaadpcmAcm,
57  Jpeg,
61  MonkeysAudio,
62  Mpc,
63  Mpeg1Audio,
64  Mpeg1Video,
65  Mpeg2Audio,
66  Mpeg2Video,
68  Mpeg4Video,
69  OggKate,
70  Opus,
71  Pcm,
72  Png,
73  ProRes,
74  Qcelp,
77  RealAudio,
78  RealVideo,
79  Sa0c,
80  Smv,
81  Speex,
84  Systems,
85  TextSubtitle,
86  Theora,
87  Tiff,
88  TimedText,
89  Tta,
91  Vc1,
92  VobBtn,
93  VobSub,
94  Vorbis,
95  Vp8,
96  Vp9,
97  WavPack,
100 };
101 
107 namespace SubFormats {
108 
109 enum : unsigned char { None };
110 
111 enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
112 
113 enum AacProfile : unsigned char {
126 };
127 
128 enum Mpeg2VideoProfile : unsigned char {
135 };
136 
137 enum Mpeg4VideoProfile : unsigned char {
197 };
198 
199 enum AvcProfile : unsigned char {
214 };
215 
216 enum DtsSpecifier : unsigned char {
221 };
222 
223 enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
224 
225 enum TextSubtitle : unsigned char {
231 };
232 
233 enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
234 
235 } // namespace SubFormats
236 
240 namespace ExtensionFormats {
242 }
243 
245 public:
246  constexpr MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
247 
248  const char *name() const;
249  const char *abbreviation() const;
250  const char *shortAbbreviation() const;
251  const char *extensionName() const;
252  constexpr operator bool() const;
253  constexpr MediaFormat &operator+=(const MediaFormat &other);
254  constexpr bool operator==(GeneralMediaFormat general) const;
255  constexpr bool operator!=(GeneralMediaFormat general) const;
256 
258  unsigned char sub;
259  unsigned char extension;
260 };
261 
265 constexpr MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
266  : general(general)
267  , sub(sub)
268  , extension(extension)
269 {
270 }
271 
276 {
277  if (other) {
278  general = other.general;
279  if (other.sub) {
280  sub = other.sub;
281  }
282  if (other.extension) {
283  extension = other.extension;
284  }
285  }
286  return *this;
287 }
288 
292 constexpr bool MediaFormat::operator==(GeneralMediaFormat general) const
293 {
294  return this->general == general;
295 }
296 
300 constexpr bool MediaFormat::operator!=(GeneralMediaFormat general) const
301 {
302  return this->general != general;
303 }
304 
308 constexpr MediaFormat::operator bool() const
309 {
310  return general != GeneralMediaFormat::Unknown;
311 }
312 
313 } // namespace TagParser
314 
315 #endif // TAG_PARSER_MEDIAFORMAT_H
constexpr bool operator!=(GeneralMediaFormat general) const
Returns whether the media format is not the specified general media format.
Definition: mediaformat.h:300
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
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:244
GeneralMediaFormat general
Definition: mediaformat.h:257
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:19
constexpr bool operator!=(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:24
constexpr MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
Definition: mediaformat.h:265
TAG_PARSER_EXPORT const char * mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
unsigned char extension
Definition: mediaformat.h:259
constexpr TagCreationFlags & operator+=(TagCreationFlags &lhs, TagCreationFlags rhs)
Definition: settings.h:55
constexpr bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
Definition: mediaformat.h:292
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
constexpr MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
Definition: mediaformat.h:275
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.