MythTV master
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MythAVRational Class Reference

C++ wrapper for FFmpeg libavutil AVRational. More...

#include <libmythtv/mythavrational.h>

Public Member Functions

 MythAVRational (int n=0, int d=1)
 
 MythAVRational (AVRational q)
 
AVRational get_q () const
 
long long toFixed (long long base) const
 Convert the rational number to fixed point. More...
 
double toDouble () const
 
QString toString () const
 
bool isNonzero () const
 
bool isValid () const
 
MythAVRational reduce (int64_t max) const
 
MythAVRational reduce (int64_t max, bool &exact) const
 
MythAVRational invert () const
 
MythAVRationaloperator+= (MythAVRational rhs)
 
MythAVRationaloperator-= (MythAVRational rhs)
 
MythAVRationaloperator*= (MythAVRational rhs)
 
MythAVRationaloperator/= (MythAVRational rhs)
 

Static Public Member Functions

static MythAVRational fromDouble (double d, int64_t max)
 Convert a double to a MythAVRational. More...
 
static int cmp (MythAVRational a, MythAVRational b)
 

Private Attributes

AVRational m_q {.num = 0, .den = 1}
 

Detailed Description

C++ wrapper for FFmpeg libavutil AVRational.

Definition at line 14 of file mythavrational.h.

Constructor & Destructor Documentation

◆ MythAVRational() [1/2]

MythAVRational::MythAVRational ( int  n = 0,
int  d = 1 
)
inlineexplicit

Definition at line 17 of file mythavrational.h.

Referenced by fromDouble(), and invert().

◆ MythAVRational() [2/2]

MythAVRational::MythAVRational ( AVRational  q)
inlineexplicit

Definition at line 18 of file mythavrational.h.

Member Function Documentation

◆ cmp()

static int MythAVRational::cmp ( MythAVRational  a,
MythAVRational  b 
)
inlinestatic

Definition at line 59 of file mythavrational.h.

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

◆ fromDouble()

static MythAVRational MythAVRational::fromDouble ( double  d,
int64_t  max 
)
inlinestatic

Convert a double to a MythAVRational.

Note
This is not an overload of the constructor since that would create calls to ambiguous overloads.

Definition at line 25 of file mythavrational.h.

◆ get_q()

AVRational MythAVRational::get_q ( ) const
inline

Definition at line 30 of file mythavrational.h.

Referenced by operator*(), operator+(), operator-(), and operator/().

◆ invert()

MythAVRational MythAVRational::invert ( ) const
inline

Definition at line 57 of file mythavrational.h.

Referenced by DTVRecorder::UpdateFramesWritten().

◆ isNonzero()

bool MythAVRational::isNonzero ( ) const
inline

◆ isValid()

bool MythAVRational::isValid ( ) const
inline
Returns
True, if the denominator is not zero; 0/0 is indeterminate and x/0 is undefined.

Definition at line 44 of file mythavrational.h.

Referenced by DecoderBase::SaveTotalDuration().

◆ operator*=()

MythAVRational & MythAVRational::operator*= ( MythAVRational  rhs)
inline

Definition at line 98 of file mythavrational.h.

◆ operator+=()

MythAVRational & MythAVRational::operator+= ( MythAVRational  rhs)
inline

Definition at line 96 of file mythavrational.h.

◆ operator-=()

MythAVRational & MythAVRational::operator-= ( MythAVRational  rhs)
inline

Definition at line 97 of file mythavrational.h.

◆ operator/=()

MythAVRational & MythAVRational::operator/= ( MythAVRational  rhs)
inline

Definition at line 99 of file mythavrational.h.

◆ reduce() [1/2]

MythAVRational MythAVRational::reduce ( int64_t  max) const
inline

Definition at line 46 of file mythavrational.h.

Referenced by reduce().

◆ reduce() [2/2]

MythAVRational MythAVRational::reduce ( int64_t  max,
bool exact 
) const
inline

Definition at line 51 of file mythavrational.h.

◆ toDouble()

double MythAVRational::toDouble ( ) const
inline

Definition at line 36 of file mythavrational.h.

Referenced by DTVRecorder::UpdateFramesWritten().

◆ toFixed()

long long MythAVRational::toFixed ( long long  base) const
inline

Convert the rational number to fixed point.

Definition at line 32 of file mythavrational.h.

Referenced by AvFormatDecoder::HandleGopStart(), and DecoderBase::SaveTotalDuration().

◆ toString()

QString MythAVRational::toString ( void  ) const
inline

Definition at line 37 of file mythavrational.h.

Referenced by DTVRecorder::UpdateFramesWritten().

Member Data Documentation

◆ m_q

AVRational MythAVRational::m_q {.num = 0, .den = 1}
private

Definition at line 66 of file mythavrational.h.

Referenced by cmp(), get_q(), invert(), isNonzero(), isValid(), reduce(), toDouble(), toFixed(), and toString().


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