avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Go to the documentation of this file.
8 #if __cplusplus > 201703L
17 #define AV_TIME_BASE_Q_CPP AVRational{1, AV_TIME_BASE}
28 Rational(
int numerator,
int denominator = 1) noexcept;
29 Rational(
const AVRational &value) noexcept;
32 AVRational&
getValue() noexcept {
return m_value; }
33 const AVRational&
getValue() const noexcept {
return m_value; }
34 void setValue(
const AVRational &newValue) noexcept { m_value = newValue; }
36 void setNumerator(
int numerator) noexcept { m_value.num = numerator; }
41 double getDouble() const noexcept {
return (
double)m_value.num / (double)m_value.den; }
45 int64_t
rescale(int64_t srcValue,
const Rational &dstBase)
const noexcept;
47 void dump() const noexcept;
49 Rational& operator= (const AVRational &value) noexcept;
50 Rational& operator= (
double value) noexcept;
52 bool operator== (const
Rational &other) const noexcept;
53 #if __cplusplus > 201703L
54 std::strong_ordering operator<=>(
const Rational &other)
const noexcept
56 switch (threewaycmp(other)) {
58 return std::strong_ordering::less;
60 return std::strong_ordering::equal;
62 return std::strong_ordering::greater;
64 return std::strong_ordering::equal;
68 return threewaycmp(other) != 0;
71 return threewaycmp(other) < 0;
74 return threewaycmp(other) > 0;
77 return (*
this < other) || (*
this == other);
80 return (*
this > other) || (*
this == other);
91 operator const AVRational&() const noexcept
97 int threewaycmp(
const Rational &other)
const noexcept;
106 std::enable_if_t<std::is_floating_point_v<T> || std::is_integral_v<T>,
Rational>
113 std::enable_if_t<std::is_floating_point_v<T> || std::is_integral_v<T>,
Rational>
132 stream >> temp.num >> ch >> temp.den;
139 catch (
const std::exception &e)
Definition: rational.h:24
AVRational & getValue() noexcept
Definition: rational.h:32
bool operator<=(const Rational &other) const noexcept
Definition: rational.h:76
@ RationalMaxPrecision
Definition: rational.h:21
int getNumerator() const noexcept
Definition: rational.h:39
int64_t rescale(int64_t srcValue, const Rational &dstBase) const noexcept
Definition: rational.cpp:36
Rational operator/(const Rational &value) const noexcept
Definition: rational.cpp:76
bool operator>(const Rational &other) const noexcept
Definition: rational.h:73
Rational() noexcept
Definition: rational.cpp:10
int getDenominator() const noexcept
Definition: rational.h:40
Rational operator-(const Rational &value) const noexcept
Definition: rational.cpp:64
Rational operator+(const Rational &value) const noexcept
Definition: rational.cpp:58
std::ostream & operator<<(std::ostream &stream, const Rational &value)
Definition: rational.h:118
bool operator>=(const Rational &other) const noexcept
Definition: rational.h:79
static Rational fromDouble(double value, int maxPrecision=RationalMaxPrecision) noexcept
Definition: rational.cpp:30
auto operator/(T num, Rational value) -> std::enable_if_t< std::is_floating_point_v< T >||std::is_integral_v< T >, Rational >
Definition: rational.h:105
void dump() const noexcept
Definition: rational.cpp:41
void setNumerator(int numerator) noexcept
Definition: rational.h:36
double operator()() const noexcept
Definition: rational.cpp:82
const AVRational & getValue() const noexcept
Definition: rational.h:33
Definition: audioresampler.cpp:8
bool operator<(const Rational &other) const noexcept
Definition: rational.h:70
double getDouble() const noexcept
Definition: rational.h:41
void setValue(const AVRational &newValue) noexcept
Definition: rational.h:34
bool operator!=(const Rational &other) const noexcept
Definition: rational.h:67
void setDenominator(int denominator) noexcept
Definition: rational.h:37
std::istream & operator>>(std::istream &stream, Rational &value)
Definition: rational.h:125
Rational operator*(const Rational &value) const noexcept
Definition: rational.cpp:70