StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
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:
Collaboration diagram for StormByte::Multimedia::FFmpeg::Sws:

Public Member Functions

 Sws (Sws &&other) noexcept=default
 Move constructor.
 ~Sws () noexcept override
 Destructor.
Sws & operator= (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).
virtual ~AVPointer () noexcept=default
 Destructor.
constexpr AVPointer & operator= (const AVPointer &) noexcept=delete
 Copy assignment (deleted).

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.

Friends

class AVFrame

Additional Inherited Members

Protected Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::SwsContext >
constexpr const std::decay_t< ::SwsContext > * Get () const noexcept
 Const 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()

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

SWS_BICUBIC.

◆ Bilinear()

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()

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

SWS_FAST_BILINEAR.

◆ Lanczos()

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

SWS_LANCZOS.

◆ Open()

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()

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.

◆ AVFrame

friend class AVFrame
friend

The documentation for this class was generated from the following file:
  • lib/public/StormByte/multimedia/ffmpeg/Sws.hxx