Tag Parser 12.1.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
104
110namespace SubFormats {
111
112enum : unsigned char { None };
113
114enum Mpeg1AudioLayer : unsigned char { Mpeg1Layer1 = 1, Mpeg1Layer2, Mpeg1Layer3 };
115
130
139
140enum Mpeg4VideoProfile : unsigned char {
201
218
225
226enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
227
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.