Tag Parser 12.5.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
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 {
200};
201
218
225
226enum PcmVersion : unsigned char { PcmIntBe = 1, PcmIntLe, PcmFloatIeee };
227
235
236enum ImageSubtitle : unsigned char { ImgSubBmp = 1 };
237
238} // namespace SubFormats
239
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)
270 , sub(sub)
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
296{
297 return this->general == general;
298}
299
304{
305 return this->general != general;
306}
307
311constexpr MediaFormat::operator bool() const
312{
314}
315
316} // namespace TagParser
317
318#endif // TAG_PARSER_MEDIAFORMAT_H
std::string_view abbreviation() const
Returns the abbreviation of the media format as C-style string.
constexpr bool operator==(GeneralMediaFormat general) const
Returns whether the media format is the specified general media format.
std::string_view shortAbbreviation() const
Returns a short abbreviation of the media format as C-style string.
std::string_view name() const
Returns the name of the media format as C-style string.
std::string_view extensionName() const
Returns the abbreviation of the media format as C-style string.
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:14
Encapsulates extension formats.
Encapsulates sub formats.
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
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.