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 | Static Public Member Functions | List of all members
StormByte::Multimedia::FFmpeg::Sws Class Reference

RAII SwsContext for video scale / convert. More...

#include <StormByte/multimedia/ffmpeg/Sws.hxx>

Inheritance diagram for StormByte::Multimedia::FFmpeg::Sws:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Multimedia::FFmpeg::Sws:
Collaboration graph
[legend]

Public Member Functions

 Sws (Sws &&other) noexcept=default
 Move constructor.
 
 ~Sws () noexcept override
 Destructor.
 
Swsoperator= (Sws &&other) noexcept=default
 Move assignment.
 
 operator bool () const noexcept
 Whether a scaler context is open.
 
bool Ensure (int src_w, int src_h, int src_fmt, int dst_w, int dst_h, int dst_fmt, int flags=0) noexcept
 Reopens if geometry, format or flags changed.
 
bool Scale (const AVFrame &src, AVFrame &dst) const noexcept
 Scales src into dst.
 
- Public Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::SwsContext >
constexpr AVPointer () noexcept=delete
 Default constructor (deleted).
 
constexpr AVPointer (const AVPointer &) noexcept=delete
 Copy constructor (deleted).
 
constexpr AVPointer (AVPointer &&other) noexcept
 Move constructor.
 
virtual ~AVPointer () noexcept=default
 Destructor.
 
constexpr AVPointeroperator= (const AVPointer &) noexcept=delete
 Copy assignment (deleted).
 
constexpr AVPointeroperator= (AVPointer &&other) noexcept
 Move assignment.
 

Static Public Member Functions

static int Bilinear () noexcept
 SWS_BILINEAR.
 
static int Bicubic () noexcept
 SWS_BICUBIC.
 
static int FastBilinear () noexcept
 SWS_FAST_BILINEAR.
 
static int Point () noexcept
 SWS_POINT.
 
static int Lanczos () noexcept
 SWS_LANCZOS.
 
static Sws Open (int src_w, int src_h, int src_fmt, int dst_w, int dst_h, int dst_fmt, int flags=0) noexcept
 Opens a scaler.
 

Additional Inherited Members

- Protected Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::SwsContext >
constexpr AVPointer (std::decay_t< ::SwsContext > *ptr) noexcept
 Adopts ptr.
 
constexpr const std::decay_t< ::SwsContext > * Get () const noexcept
 Const view of the raw FFmpeg pointer.
 
constexpr std::decay_t< ::SwsContext > * Get () noexcept
 Mutable view of the raw FFmpeg pointer.
 
constexpr std::decay_t< ::SwsContext > * Detach () noexcept
 Yields the raw pointer and leaves this wrapper empty.
 
- Protected Attributes inherited from StormByte::Multimedia::FFmpeg::AVPointer<::SwsContext >
std::decay_t< ::SwsContext > * m_ptr
 Owned FFmpeg pointer.
 

Detailed Description

RAII SwsContext for video scale / convert.

Constructor & Destructor Documentation

◆ Sws()

StormByte::Multimedia::FFmpeg::Sws::Sws ( Sws &&  other)
defaultnoexcept

Move constructor.

Transfers the scaler.

Parameters
otherSource scaler; left empty.

◆ ~Sws()

StormByte::Multimedia::FFmpeg::Sws::~Sws ( )
overridenoexcept

Destructor.

Frees the SwsContext.

Member Function Documentation

◆ Bicubic()

static int StormByte::Multimedia::FFmpeg::Sws::Bicubic ( )
staticnoexcept

SWS_BICUBIC.

◆ Bilinear()

static int StormByte::Multimedia::FFmpeg::Sws::Bilinear ( )
staticnoexcept

SWS_BILINEAR.

Default when Open / Ensure get 0.

◆ Ensure()

bool StormByte::Multimedia::FFmpeg::Sws::Ensure ( int  src_w,
int  src_h,
int  src_fmt,
int  dst_w,
int  dst_h,
int  dst_fmt,
int  flags = 0 
)
noexcept

Reopens if geometry, format or flags changed.

Parameters
src_wSource width in pixels.
src_hSource height in pixels.
src_fmtSource pixel format as int.
dst_wDestination width in pixels.
dst_hDestination height in pixels.
dst_fmtDestination pixel format as int.
flagsBilinear, Bicubic, … 0 = Bilinear.
Returns
false if the scaler could not be (re)opened.

◆ FastBilinear()

static int StormByte::Multimedia::FFmpeg::Sws::FastBilinear ( )
staticnoexcept

SWS_FAST_BILINEAR.

◆ Lanczos()

static int StormByte::Multimedia::FFmpeg::Sws::Lanczos ( )
staticnoexcept

SWS_LANCZOS.

◆ Open()

static Sws StormByte::Multimedia::FFmpeg::Sws::Open ( int  src_w,
int  src_h,
int  src_fmt,
int  dst_w,
int  dst_h,
int  dst_fmt,
int  flags = 0 
)
staticnoexcept

Opens a scaler.

Empty wrapper on failure.

Parameters
src_wSource width in pixels.
src_hSource height in pixels.
src_fmtSource pixel format as int.
dst_wDestination width in pixels.
dst_hDestination height in pixels.
dst_fmtDestination pixel format as int.
flagsBilinear, Bicubic, … 0 = Bilinear.
Returns
Open scaler, or empty on failure.

◆ operator bool()

StormByte::Multimedia::FFmpeg::Sws::operator bool ( ) const
explicitnoexcept

Whether a scaler context is open.

Returns
true if sws_scale can run.

◆ operator=()

Sws & StormByte::Multimedia::FFmpeg::Sws::operator= ( Sws &&  other)
defaultnoexcept

Move assignment.

Frees *this, then takes other.

Parameters
otherSource scaler; left empty.
Returns
*this.

◆ Point()

static int StormByte::Multimedia::FFmpeg::Sws::Point ( )
staticnoexcept

SWS_POINT.

◆ Scale()

bool StormByte::Multimedia::FFmpeg::Sws::Scale ( const AVFrame src,
AVFrame dst 
) const
noexcept

Scales src into dst.

Both frames must already have buffers.

Parameters
srcSource frame.
dstDestination frame.
Returns
false on failure.

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