tagparser/aspectratio.h

59 lines
1.2 KiB
C
Raw Normal View History

2016-02-17 20:19:05 +01:00
#ifndef MEDIA_ASPECTRATIO_H
#define MEDIA_ASPECTRATIO_H
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 Media {
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.
*/
constexpr AspectRatio::AspectRatio() :
2016-02-17 20:19:05 +01:00
type(0),
numerator(0),
denominator(0)
{}
/*!
* \brief Constructs a aspect ratio with the specified \a numerator and \a denominator.
*/
constexpr AspectRatio::AspectRatio(uint16 numerator, uint16 denominator) :
2016-02-17 20:19:05 +01:00
type(0xFF),
numerator(numerator),
denominator(denominator)
{}
/*!
* \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;
}
}
#endif // MEDIA_ASPECTRATIO_H