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
size.cpp
Go to the documentation of this file.
1#include "./size.h"
2
3namespace TagParser {
4
6constexpr Size fromHeightAndAspectRatio(std::uint32_t height, std::uint32_t numerator = 4, std::uint32_t denominator = 3)
7{
8 return Size(height * numerator / denominator, height);
9}
11
17std::string_view Size::abbreviation() const
18{
19 if (*this >= fromHeightAndAspectRatio(4320)) {
20 return "8k";
21 } else if (*this >= fromHeightAndAspectRatio(2160)) {
22 return "4k";
23 } else if (*this >= fromHeightAndAspectRatio(1080)) {
24 return "1080p";
25 } else if (*this >= fromHeightAndAspectRatio(720)) {
26 return "720p";
27 } else if (*this >= fromHeightAndAspectRatio(576)) {
28 return "576p";
29 } else if (*this >= fromHeightAndAspectRatio(480)) {
30 return "480p";
31 } else if (*this >= fromHeightAndAspectRatio(320)) {
32 return "320p";
33 } else if (*this >= fromHeightAndAspectRatio(240)) {
34 return "240p";
35 }
36 return "<240p";
37}
38
39} // namespace TagParser
The Size class defines the size of a two-dimensional object using integer point precision.
Definition size.h:17
std::string_view abbreviation() const
Returns an abbreviation for the current instance, eg.
Definition size.cpp:17
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10