Tag Parser  9.1.2
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
aspectratio.h
Go to the documentation of this file.
1 #ifndef TAG_PARSER_ASPECTRATIO_H
2 #define TAG_PARSER_ASPECTRATIO_H
3 
4 #include "./global.h"
5 
6 #include <c++utilities/conversion/stringbuilder.h>
7 
8 #include <cstdint>
9 #include <string>
10 
11 namespace TagParser {
12 
14  constexpr AspectRatio();
15  AspectRatio(std::uint8_t aspectRatioType);
16  constexpr AspectRatio(std::uint16_t numerator, std::uint16_t denominator);
17  constexpr bool isValid() const;
18  constexpr bool isExtended() const;
19  std::string toString() const;
20 
21  std::uint8_t type;
22  std::uint16_t numerator;
23  std::uint16_t denominator;
24 };
25 
30  : type(0)
31  , numerator(0)
32  , denominator(0)
33 {
34 }
35 
40 constexpr AspectRatio::AspectRatio(std::uint16_t numerator, std::uint16_t denominator)
41  : type(0xFF)
42  , numerator(numerator)
43  , denominator(denominator)
44 {
45 }
46 
50 constexpr bool AspectRatio::isValid() const
51 {
52  return type && numerator && denominator;
53 }
54 
58 constexpr bool AspectRatio::isExtended() const
59 {
60  return type == 0xFF;
61 }
62 
66 inline std::string AspectRatio::toString() const
67 {
68  return CppUtilities::argsToString(numerator, " : ", denominator);
69 }
70 
71 } // namespace TagParser
72 
73 #endif // TAG_PARSER_ASPECTRATIO_H
global.h
TagParser::AspectRatio::isExtended
constexpr bool isExtended() const
Returns whether numerator and denominator must be read from extended SAR header.
Definition: aspectratio.h:58
TagParser::AspectRatio::type
std::uint8_t type
Definition: aspectratio.h:21
TagParser
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
TagParser::AspectRatio::toString
std::string toString() const
Returns the string representation "numerator : denominator".
Definition: aspectratio.h:66
TagParser::AspectRatio::isValid
constexpr bool isValid() const
Returns an indication whether the aspect ratio is present and valid.
Definition: aspectratio.h:50
TagParser::AspectRatio::denominator
std::uint16_t denominator
Definition: aspectratio.h:23
TagParser::AspectRatio
The AspectRatio struct defines an aspect ratio.
Definition: aspectratio.h:13
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
TagParser::AspectRatio::numerator
std::uint16_t numerator
Definition: aspectratio.h:22
TagParser::AspectRatio::AspectRatio
constexpr AspectRatio()
Constructs an invalid aspect ratio.
Definition: aspectratio.h:29