Tag Parser  8.3.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 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  Meta,
22 };
23 
24 TAG_PARSER_EXPORT const char *mediaTypeName(MediaType mediaType);
25 
29 enum class GeneralMediaFormat : unsigned int {
30  Unknown,
31  Aac,
32  Ac3,
33  Ac4,
34  AdpcmAcm,
35  AfxStream,
36  Alac,
37  Als,
38  Amr,
39  Avc,
40  Av1,
41  Bitmap,
42  Daala,
43  Dirac,
44  DolbyMlp,
45  Dts,
46  DtsHd,
47  DvbSub,
48  EAc3,
49  Evrc,
50  Flac,
52  Gif,
53  Gpp2Cmf,
54  Hevc,
55  ImaadpcmAcm,
58  Jpeg,
62  MonkeysAudio,
63  Mpc,
64  Mpeg1Audio,
65  Mpeg1Video,
66  Mpeg2Audio,
67  Mpeg2Video,
69  Mpeg4Video,
70  OggKate,
71  Opus,
72  Pcm,
73  Png,
74  ProRes,
75  Qcelp,
78  RealAudio,
79  RealVideo,
80  Sa0c,
81  Smv,
82  Speex,
85  Systems,
86  TextSubtitle,
87  Theora,
88  Tiff,
89  TimedText,
90  Tta,
92  Vc1,
93  VobBtn,
94  VobSub,
95  Vorbis,
96  Vp8,
97  Vp9,
98  WavPack,
101 };
102 
108 namespace SubFormats {
109 
110 enum : unsigned char { None };
111 
112 enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
113 
114 enum AacProfile : unsigned char {
127 };
128 
129 enum Mpeg2VideoProfile : unsigned char {
136 };
137 
138 enum Mpeg4VideoProfile : unsigned char {
198 };
199 
200 enum AvcProfile : unsigned char {
215 };
216 
217 enum DtsSpecifier : unsigned char {
222 };
223 
224 enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
225 
226 enum TextSubtitle : unsigned char {
232 };
233 
234 enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
235 
236 } // namespace SubFormats
237 
241 namespace ExtensionFormats {
243 }
244 
246 public:
247  constexpr MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
248 
249  const char *name() const;
250  const char *abbreviation() const;
251  const char *shortAbbreviation() const;
252  const char *extensionName() const;
253  constexpr operator bool() const;
254  constexpr MediaFormat &operator+=(const MediaFormat &other);
255  constexpr bool operator==(GeneralMediaFormat general) const;
256  constexpr bool operator!=(GeneralMediaFormat general) const;
257 
259  unsigned char sub;
260  unsigned char extension;
261 };
262 
266 constexpr MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
267  : general(general)
268  , sub(sub)
269  , extension(extension)
270 {
271 }
272 
277 {
278  if (other) {
279  general = other.general;
280  if (other.sub) {
281  sub = other.sub;
282  }
283  if (other.extension) {
284  extension = other.extension;
285  }
286  }
287  return *this;
288 }
289 
293 constexpr bool MediaFormat::operator==(GeneralMediaFormat general) const
294 {
295  return this->general == general;
296 }
297 
301 constexpr bool MediaFormat::operator!=(GeneralMediaFormat general) const
302 {
303  return this->general != general;
304 }
305 
309 constexpr MediaFormat::operator bool() const
310 {
311  return general != GeneralMediaFormat::Unknown;
312 }
313 
314 } // namespace TagParser
315 
316 #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:301
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,...
Definition: mediaformat.h:29
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:245
GeneralMediaFormat general
Definition: mediaformat.h:258
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:266
TAG_PARSER_EXPORT const char * mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
unsigned char extension
Definition: mediaformat.h:260
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:293
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:276
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.