Tag Parser  8.0.0
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 #include <c++utilities/conversion/types.h>
8 
9 #include <string>
10 
11 namespace TagParser {
12 
14  constexpr AspectRatio();
15  AspectRatio(byte aspectRatioType);
16  constexpr AspectRatio(uint16 numerator, uint16 denominator);
17  constexpr bool isValid() const;
18  constexpr bool isExtended() const;
19  std::string toString() const;
20 
21  byte type;
22  uint16 numerator;
23  uint16 denominator;
24 };
25 
30  : type(0)
31  , numerator(0)
32  , denominator(0)
33 {
34 }
35 
40 constexpr AspectRatio::AspectRatio(uint16 numerator, uint16 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 ConversionUtilities::argsToString(numerator, " : ", denominator);
69 }
70 
71 } // namespace TagParser
72 
73 #endif // TAG_PARSER_ASPECTRATIO_H
std::string toString() const
Returns the string representation "numerator : denominator".
Definition: aspectratio.h:66
constexpr AspectRatio()
Constructs an invalid aspect ratio.
Definition: aspectratio.h:29
constexpr bool isValid() const
Returns an indication whether the aspect ratio is present and valid.
Definition: aspectratio.h:50
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The AspectRatio struct defines an aspect ratio.
Definition: aspectratio.h:13
constexpr bool isExtended() const
Returns whether numerator and denominator must be read from extended SAR header.
Definition: aspectratio.h:58