tagparser/aspectratio.h

62 lines
1.4 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_ASPECTRATIO_H
#define TAG_PARSER_ASPECTRATIO_H
2016-02-17 20:19:05 +01:00
2016-08-29 15:43:05 +02:00
#include "./global.h"
2016-02-17 20:19:05 +01:00
#include <c++utilities/conversion/types.h>
namespace TagParser {
2016-02-17 20:19:05 +01:00
2016-08-29 15:43:05 +02:00
struct TAG_PARSER_EXPORT AspectRatio {
constexpr AspectRatio();
2016-02-17 20:19:05 +01:00
AspectRatio(byte aspectRatioType);
constexpr AspectRatio(uint16 numerator, uint16 denominator);
constexpr bool isValid() const;
constexpr bool isExtended() const;
2016-02-17 20:19:05 +01:00
byte type;
uint16 numerator;
uint16 denominator;
};
/*!
* \brief Constructs an invalid aspect ratio.
*/
2018-03-07 01:17:50 +01:00
constexpr AspectRatio::AspectRatio()
: type(0)
, numerator(0)
, denominator(0)
{
}
2016-02-17 20:19:05 +01:00
/*!
* \brief Constructs a aspect ratio with the specified \a numerator and \a denominator.
2017-08-17 19:04:58 +02:00
* \remarks Allows defining a custom aspect ratio, hence counts as "extended" (see isExtended()).
2016-02-17 20:19:05 +01:00
*/
2018-03-07 01:17:50 +01:00
constexpr AspectRatio::AspectRatio(uint16 numerator, uint16 denominator)
: type(0xFF)
, numerator(numerator)
, denominator(denominator)
{
}
2016-02-17 20:19:05 +01:00
/*!
* \brief Returns an indication whether the aspect ratio is present and valid.
*/
constexpr bool AspectRatio::isValid() const
2016-02-17 20:19:05 +01:00
{
2016-04-24 22:10:45 +02:00
return type && numerator && denominator;
2016-02-17 20:19:05 +01:00
}
/*!
* \brief Returns whether numerator and denominator must be read from extended SAR header.
*/
constexpr bool AspectRatio::isExtended() const
2016-02-17 20:19:05 +01:00
{
return type == 0xFF;
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2016-02-17 20:19:05 +01:00
#endif // TAG_PARSER_ASPECTRATIO_H