Tag Parser 12.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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,
53 Gif,
54 Gpp2Cmf,
55 Hevc,
59 Jpeg,
64 Mpc,
71 OggKate,
72 Opus,
73 Pcm,
74 Png,
75 ProRes,
76 Qcelp,
79 RealAudio,
80 RealVideo,
81 Sa0c,
82 Smv,
83 Speex,
86 Systems,
88 Theora,
89 Tiff,
90 TimedText,
91 Tta,
93 Vc1,
94 VobBtn,
95 VobSub,
96 Vorbis,
97 Vp8,
98 Vp9,
99 WavPack,
102 Vcc,
103};
104
110namespace SubFormats {
111
112enum : unsigned char { None };
113
114enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
115
116enum AacProfile : unsigned char {
130
131enum Mpeg2VideoProfile : unsigned char {
139
140enum Mpeg4VideoProfile : unsigned char {
201
202enum AvcProfile : unsigned char {
218
219enum DtsSpecifier : unsigned char {
224};
225
226enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
227
228enum TextSubtitle : unsigned char {
235
236enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
237
238} // namespace SubFormats
239
243namespace ExtensionFormats {
245}
246
248public:
249 constexpr MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
250
251 std::string_view name() const;
252 std::string_view abbreviation() const;
253 std::string_view shortAbbreviation() const;
254 std::string_view extensionName() const;
255 constexpr operator bool() const;
256 constexpr MediaFormat &operator+=(const MediaFormat &other);
257 constexpr bool operator==(GeneralMediaFormat general) const;
258 constexpr bool operator!=(GeneralMediaFormat general) const;
259
261 unsigned char sub;
262 unsigned char extension;
263};
264
268constexpr MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
269 : general(general)
270 , sub(sub)
271 , extension(extension)
272{
273}
274
279{
280 if (other) {
281 general = other.general;
282 if (other.sub) {
283 sub = other.sub;
284 }
285 if (other.extension) {
286 extension = other.extension;
287 }
288 }
289 return *this;
290}
291
295constexpr bool MediaFormat::operator==(GeneralMediaFormat general) const
296{
297 return this->general == general;
298}
299
303constexpr bool MediaFormat::operator!=(GeneralMediaFormat general) const
304{
305 return this->general != general;
306}
307
311constexpr MediaFormat::operator bool() const
312{
313 return general != GeneralMediaFormat::Unknown;
314}
315
316} // namespace TagParser
317
318#endif // TAG_PARSER_MEDIAFORMAT_H
The MediaFormat class specifies the format of media data.
constexpr bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
unsigned char extension
GeneralMediaFormat general
constexpr MediaFormat & operator+=(const MediaFormat &other)
"Adds" information from another instance to the object.
constexpr MediaFormat(GeneralMediaFormat general=GeneralMediaFormat::Unknown, unsigned char sub=0, unsigned char extension=0)
Constructs a new media format.
constexpr bool operator!=(GeneralMediaFormat general) const
Returns whether the media format is not the specified general media format.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:13
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
constexpr bool operator!=(std::uint8_t lhs, FlacMetaDataBlockType type)
constexpr bool operator==(std::uint8_t lhs, FlacMetaDataBlockType type)
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.