avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Go to the documentation of this file.
22 template<
typename Duration,
typename =
typename Duration::period>
25 using Ratio =
typename Duration::period;
27 static_assert(Ratio::num <= INT_MAX,
"To prevent precision lost, ratio numerator must be less then INT_MAX");
28 static_assert(Ratio::den <= INT_MAX,
"To prevent precision lost, ratio denominator must be less then INT_MAX");
30 m_timestamp = duration.count();
31 m_timebase =
Rational(
static_cast<int>(Ratio::num),
32 static_cast<int>(Ratio::den));
39 operator
bool() const noexcept;
43 operator
double() const noexcept;
44 double seconds() const noexcept;
49 template<typename Duration>
52 using Ratio =
typename Duration::period;
54 static_assert(Ratio::num <= INT_MAX,
"To prevent precision lost, ratio numerator must be less then INT_MAX");
55 static_assert(Ratio::den <= INT_MAX,
"To prevent precision lost, ratio denominator must be less then INT_MAX");
57 Rational dstTimebase(
static_cast<int>(Ratio::num),
58 static_cast<int>(Ratio::den));
59 auto ts = m_timebase.
rescale(m_timestamp, dstTimebase);
81 return av_compare_ts(left.timestamp(), left.timebase(),
82 right.timestamp(), right.timebase()) > 0;
89 return av_compare_ts(left.timestamp(), left.timebase(),
90 right.timestamp(), right.timebase()) < 0;
97 return av_compare_ts(left.timestamp(), left.timebase(),
98 right.timestamp(), right.timebase()) == 0;
110 return av_compare_ts(left.timestamp(), left.timebase(),
111 right.timestamp(), right.timebase()) >= 0;
117 return av_compare_ts(left.timestamp(), left.timebase(),
118 right.timestamp(), right.timebase()) <= 0;
125 Timestamp
operator+(
const Timestamp& left,
const Timestamp &right) noexcept;
126 Timestamp
operator-(
const Timestamp& left,
const Timestamp &right) noexcept;
127 Timestamp
operator*(
const Timestamp& left,
const Timestamp &right) noexcept;
128 Timestamp
operator/(
const Timestamp& left,
const Timestamp &right) noexcept;
Timestamp(const Duration &duration)
Create AvCpp/FFmpeg compatible timestamp value from the std::chrono::duration/boost::chrono::duration...
Definition: timestamp.h:23
bool isNoPts() const noexcept
Definition: timestamp.cpp:39
Definition: rational.h:24
Timestamp & operator/=(const Timestamp &other)
Definition: timestamp.cpp:78
Timestamp & operator+=(const Timestamp &other)
Definition: timestamp.cpp:57
Timestamp operator*(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.cpp:116
int64_t rescale(int64_t srcValue, const Rational &dstBase) const noexcept
Definition: rational.cpp:36
bool operator==(const Dictionary::Entry &lhs, const Dictionary::Entry &rhs)
Definition: dictionary.cpp:382
Timestamp() noexcept
Definition: timestamp.cpp:9
Timestamp operator+(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.cpp:90
Duration toDuration() const
Convert to the std::chrono::duration compatible value.
Definition: timestamp.h:50
constexpr auto TimeBaseQ
Definition: avutils.h:56
constexpr auto NoPts
Definition: avutils.h:54
double seconds() const noexcept
Definition: timestamp.cpp:49
bool operator>(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.h:79
bool operator>=(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.h:108
std::ostream & operator<<(std::ostream &stream, const Rational &value)
Definition: rational.h:118
Timestamp operator-(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.cpp:104
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
bool isValid() const noexcept
Definition: timestamp.cpp:34
Definition: audioresampler.cpp:8
Timestamp & operator-=(const Timestamp &other)
Definition: timestamp.cpp:64
Timestamp & operator*=(const Timestamp &other)
Definition: timestamp.cpp:71
The Timestamp class represents timestamp value and it timebase.
Definition: timestamp.h:13
bool operator<(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.h:87
bool operator!=(const Dictionary::Entry &lhs, const Dictionary::Entry &rhs)
Definition: dictionary.cpp:387
const Rational & timebase() const noexcept
Definition: timestamp.cpp:29
bool operator<=(const Timestamp &left, const Timestamp &right) noexcept
Definition: timestamp.h:115
int64_t timestamp() const noexcept
Definition: timestamp.cpp:19