tagparser/aspectratio.cpp

29 lines
955 B
C++
Raw Normal View History

2016-02-17 20:19:05 +01:00
#include "./aspectratio.h"
using namespace std;
namespace TagParser {
2016-02-17 20:19:05 +01:00
/*!
* \struct TagParser::AspectRatio
2016-02-17 20:19:05 +01:00
* \brief The AspectRatio struct defines an aspect ratio.
*/
/*!
* \brief Constructs a PAR form the specified AVC aspectRatioType.
*/
2019-03-13 19:06:42 +01:00
AspectRatio::AspectRatio(std::uint8_t aspectRatioType)
2016-02-17 20:19:05 +01:00
{
2018-03-07 01:17:50 +01:00
static const AspectRatio predefinedPars[] = { AspectRatio(), AspectRatio(1, 1), AspectRatio(12, 11), AspectRatio(10, 11), AspectRatio(16, 11),
AspectRatio(40, 33), AspectRatio(24, 11), AspectRatio(20, 11), AspectRatio(32, 11), AspectRatio(80, 33), AspectRatio(18, 11),
AspectRatio(15, 11), AspectRatio(64, 33), AspectRatio(160, 99), AspectRatio(4, 3), AspectRatio(3, 2), AspectRatio(2, 1) };
if (aspectRatioType < (sizeof(predefinedPars) / sizeof(AspectRatio))) {
2016-02-17 20:19:05 +01:00
*this = predefinedPars[aspectRatioType];
} else {
numerator = denominator = 0;
}
type = aspectRatioType;
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser