StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
StormByte::Multimedia::Property::AVRational Class Reference

Pair {num, den} matching libavutil AVRational. More...

#include <StormByte/multimedia/property/av_rational.hxx>

Public Member Functions

constexpr AVRational () noexcept=default
 {0, 1} — unknown / unset.
 
constexpr AVRational (int num, int den) noexcept
 {num, den} like the C aggregate.
 
constexpr bool Valid () const noexcept
 True when both sides are positive.
 
constexpr double ToDouble () const noexcept
 av_q2dnum / den as double.
 
std::int64_t Rescale (std::int64_t ticks, const AVRational &dst) const noexcept
 av_rescale_q(ticks, *this, dst).
 
constexpr bool operator== (const AVRational &other) const noexcept
 Equality.
 
constexpr bool operator!= (const AVRational &other) const noexcept
 Inequality.
 

Public Attributes

int num = 0
 Numerator (AVRational.num)
 
int den = 1
 Denominator (AVRational.den)
 

Detailed Description

Pair {num, den} matching libavutil AVRational.

Public fields so fps.num, fps.den and AVRational{24000, 1001} read like the C API. This is not libav's header: plugins that include libavutil/rational.h still use AVRational for the C struct. Convert with {r.num, r.den}.

23.976 fps is {24000, 1001}. 24 fps is {24, 1}. A time base of 1 ms is {1, 1000}.

Constructor & Destructor Documentation

◆ AVRational() [1/2]

constexpr StormByte::Multimedia::Property::AVRational::AVRational ( )
constexprdefaultnoexcept

{0, 1} — unknown / unset.

◆ AVRational() [2/2]

constexpr StormByte::Multimedia::Property::AVRational::AVRational ( int  num,
int  den 
)
inlineconstexprnoexcept

{num, den} like the C aggregate.

Parameters
numNumerator.
denDenominator.

Member Function Documentation

◆ operator!=()

constexpr bool StormByte::Multimedia::Property::AVRational::operator!= ( const AVRational other) const
inlineconstexprnoexcept

Inequality.

Parameters
otherOther rational.
Returns
true if num or den differ.

◆ operator==()

constexpr bool StormByte::Multimedia::Property::AVRational::operator== ( const AVRational other) const
inlineconstexprnoexcept

Equality.

Parameters
otherOther rational.
Returns
true if num and den match.

◆ Rescale()

std::int64_t StormByte::Multimedia::Property::AVRational::Rescale ( std::int64_t  ticks,
const AVRational dst 
) const
noexcept

av_rescale_q(ticks, *this, dst).

Parameters
ticksSource ticks.
dstDestination time base.
Returns
Scaled ticks, or AV_NOPTS_VALUE when either side is invalid.

◆ ToDouble()

constexpr double StormByte::Multimedia::Property::AVRational::ToDouble ( ) const
inlineconstexprnoexcept

av_q2dnum / den as double.

Returns
Quotient, or 0 if den == 0.

◆ Valid()

constexpr bool StormByte::Multimedia::Property::AVRational::Valid ( ) const
inlineconstexprnoexcept

True when both sides are positive.

Returns
true if num > 0 && den > 0.

Member Data Documentation

◆ den

int StormByte::Multimedia::Property::AVRational::den = 1

Denominator (AVRational.den)

◆ num

int StormByte::Multimedia::Property::AVRational::num = 0

Numerator (AVRational.num)


The documentation for this class was generated from the following file: