Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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
11namespace TagParser {
12
13struct TAG_PARSER_EXPORT AspectRatio {
14 constexpr explicit AspectRatio();
15 explicit AspectRatio(std::uint8_t aspectRatioType);
16 constexpr explicit 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
40constexpr AspectRatio::AspectRatio(std::uint16_t numerator, std::uint16_t denominator)
41 : type(0xFF)
42 , numerator(numerator)
43 , denominator(denominator)
44{
45}
46
50constexpr bool AspectRatio::isValid() const
51{
52 return type && numerator && denominator;
53}
54
58constexpr bool AspectRatio::isExtended() const
59{
60 return type == 0xFF;
61}
62
66inline std::string AspectRatio::toString() const
67{
68 return CppUtilities::argsToString(numerator, " : ", denominator);
69}
70
71} // namespace TagParser
72
73#endif // TAG_PARSER_ASPECTRATIO_H
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
std::uint16_t numerator
Definition aspectratio.h:22
std::string toString() const
Returns the string representation "numerator : denominator".
Definition aspectratio.h:66
std::uint16_t denominator
Definition aspectratio.h:23
constexpr bool isExtended() const
Returns whether numerator and denominator must be read from extended SAR header.
Definition aspectratio.h:58
constexpr bool isValid() const
Returns an indication whether the aspect ratio is present and valid.
Definition aspectratio.h:50
constexpr AspectRatio()
Constructs an invalid aspect ratio.
Definition aspectratio.h:29