avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
rational.h File Reference

Rational numbers, time bases and arithmetic on them.

#include <utility>
#include <iostream>
#include <memory>
#include <type_traits>
#include "ffmpeg.h"
#include "avutils.h"
#include <compare>

Go to the source code of this file.

Classes

class  av::Rational
 Rational number: a numerator and a denominator. More...

Namespaces

namespace  av
 Root namespace of the library.

Macros

#define AV_TIME_BASE_Q_CPP   AVRational{1, AV_TIME_BASE}
 The global FFmpeg time base as an AVRational constant.

Enumerations

enum  { RationalMaxPrecision = 5 }

Functions

template<typename T>
auto av::operator/ (T num, Rational value) -> std::enable_if_t< std::is_floating_point_v< T >||std::is_integral_v< T >, Rational >
 Divide a number by a rational.
template<typename T>
auto av::operator/ (Rational value, T num) -> std::enable_if_t< std::is_floating_point_v< T >||std::is_integral_v< T >, Rational >
 Divide a rational by a number.
std::ostream & av::operator<< (std::ostream &stream, const Rational &value)
 Print the rational as "numerator/denominator".
std::istream & av::operator>> (std::istream &stream, Rational &value)
 Read a rational written as "numerator/denominator".

Macro Definition Documentation

◆ AV_TIME_BASE_Q_CPP

#define AV_TIME_BASE_Q_CPP   AVRational{1, AV_TIME_BASE}

Used where an AVRational is required; av::TimeBaseQ is the avcpp wrapper.