Tag Parser 11.4.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 <string_view>
7#include <utility>
8
9namespace TagParser {
10
14enum class MediaType : unsigned int {
15 Unknown,
16 Audio,
17 Video,
18 Text,
19 Buttons,
20 Control,
21 Hint,
22 Meta,
23};
24
25TAG_PARSER_EXPORT std::string_view mediaTypeName(MediaType mediaType);
26
30enum class GeneralMediaFormat : unsigned int {
31 Unknown,
32 Aac,
33 Ac3,
34 Ac4,
35 AdpcmAcm,
36 AfxStream,
37 Alac,
38 Als,
39 Amr,
40 Avc,
41 Av1,
42 Bitmap,
43 Daala,
44 Dirac,
45 DolbyMlp,
46 Dts,
47 DtsHd,
48 DvbSub,
49 EAc3,
50 Evrc,
51 Flac,
52 FontDataStream,
53 Gif,
54 Gpp2Cmf,
55 Hevc,
56 ImaadpcmAcm,
58 InteractionStream,
59 Jpeg,
64 Mpc,
65 Mpeg1Audio,
66 Mpeg1Video,
67 Mpeg2Audio,
69 Mpeg4TimedText,
70 Mpeg4Video,
71 OggKate,
72 Opus,
73 Pcm,
74 Png,
75 ProRes,
76 Qcelp,
79 RealAudio,
80 RealVideo,
81 Sa0c,
82 Smv,
83 Speex,
84 StreamingTextStream,
85 SynthesizedTextureStream,
86 Systems,
88 Theora,
89 Tiff,
90 TimedText,
91 Tta,
93 Vc1,
94 VobBtn,
95 VobSub,
96 Vorbis,
97 Vp8,
98 Vp9,
99 WavPack,
100 WindowsMediaAudio,
102};
103
109namespace SubFormats {
110
111enum : unsigned char { None };
112
113enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
114
115enum AacProfile : unsigned char {
129
130enum Mpeg2VideoProfile : unsigned char {
138
139enum Mpeg4VideoProfile : unsigned char {
200
201enum AvcProfile : unsigned char {
217
218enum DtsSpecifier : unsigned char {
223};
224
225enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
226
227enum TextSubtitle : unsigned char {
234
235enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
236
237} // namespace SubFormats
238
242namespace ExtensionFormats {
244}
245
247public:
248 constexpr MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
249
250 std::string_view name() const;
251 std::string_view abbreviation() const;
252 std::string_view shortAbbreviation() const;
253 std::string_view extensionName() const;
254 constexpr operator bool() const;
255 constexpr MediaFormat &operator+=(const MediaFormat &other);
256 constexpr bool operator==(GeneralMediaFormat general) const;
257 constexpr bool operator!=(GeneralMediaFormat general) const;
258
260 unsigned char sub;
261 unsigned char extension;
262};
263
267constexpr MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
268 : general(general)
269 , sub(sub)
270 , extension(extension)
271{
272}
273
278{
279 if (other) {
280 general = other.general;
281 if (other.sub) {
282 sub = other.sub;
283 }
284 if (other.extension) {
285 extension = other.extension;
286 }
287 }
288 return *this;
289}
290
294constexpr bool MediaFormat::operator==(GeneralMediaFormat general) const
295{
296 return this->general == general;
297}
298
302constexpr bool MediaFormat::operator!=(GeneralMediaFormat general) const
303{
304 return this->general != general;
305}
306
310constexpr MediaFormat::operator bool() const
311{
312 return general != GeneralMediaFormat::Unknown;
313}
314
315} // namespace TagParser
316
317#endif // TAG_PARSER_MEDIAFORMAT_H
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:246
constexpr bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
Definition: mediaformat.h:294
unsigned char extension
Definition: mediaformat.h:261
GeneralMediaFormat general
Definition: mediaformat.h:259
constexpr MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
Definition: mediaformat.h:277
constexpr MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
Definition: mediaformat.h:267
constexpr bool operator!=(GeneralMediaFormat general) const
Returns whether the media format is not the specified general media format.
Definition: mediaformat.h:302
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
constexpr bool operator!=(std::uint8_t lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:23
constexpr bool operator==(std::uint8_t lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:18
@ MonkeysAudio
Definition: signature.cpp:52
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition: mediaformat.h:14
GeneralMediaFormat
The GeneralMediaFormat enum specifies the general format of media data (PCM, MPEG-4,...
Definition: mediaformat.h:30
TAG_PARSER_EXPORT std::string_view mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.