StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
StormByte::Multimedia::FFmpeg::AVFrame Class Reference

RAII owner of a libav AVFrame. More...

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

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

Public Types

enum class  VideoLayout : std::uint8_t {
  Unknown , Gray , Yuv420 , Yuv422 ,
  Yuv444
}
 Planar video family, ignoring bit depth. More...
 

Public Member Functions

 AVFrame () noexcept
 Allocates an empty frame (av_frame_alloc).
 
 AVFrame (AVFrame &&other) noexcept=default
 Move constructor.
 
 ~AVFrame () noexcept override
 Destructor.
 
AVFrameoperator= (AVFrame &&other) noexcept=default
 Move assignment.
 
 operator bool () const noexcept
 True when a libav struct is owned.
 
AVFrame Clone () const noexcept
 Independent clone (av_frame_clone).
 
bool Ref (const AVFrame &other) noexcept
 Shares buffers with other (av_frame_ref).
 
bool Copy (const AVFrame &other) noexcept
 Copies samples/planes from other (av_frame_copy).
 
bool CopyProps (const AVFrame &other) noexcept
 Copies metadata from other (av_frame_copy_props).
 
bool GetBuffer (int align=0) noexcept
 Allocates plane buffers (av_frame_get_buffer).
 
bool MakeWritable () noexcept
 Ensures unique buffers (av_frame_make_writable).
 
bool Writable () const noexcept
 Whether plane buffers are uniquely owned.
 
bool AllocVideo (int width, int height, int format, int align=0) noexcept
 Sets video geometry and format, then allocates planes.
 
bool AllocAudio (int nb_samples, int format, const AVChannelLayout &layout, int sample_rate) noexcept
 Sets audio samples, format and layout, then allocates planes.
 
void Unref () noexcept
 Unreferences frame buffers (av_frame_unref).
 
int Width () const noexcept
 Frame width in pixels.
 
void Width (int width) noexcept
 Sets frame width.
 
int Height () const noexcept
 Frame height in pixels.
 
void Height (int height) noexcept
 Sets frame height.
 
int Format () const noexcept
 Pixel or sample format.
 
void Format (int format) noexcept
 Sets pixel or sample format.
 
bool Hardware () const noexcept
 Whether the pixel format is hardware-backed.
 
VideoLayout Layout () const noexcept
 Planar layout of this frame.
 
std::int64_t Pts () const noexcept
 Presentation timestamp in stream ticks.
 
void Pts (std::int64_t pts) noexcept
 Sets presentation timestamp in stream ticks.
 
std::int64_t BestEffortTimestamp () const noexcept
 Best-effort timestamp (best_effort_timestamp).
 
void BestEffortTimestamp (std::int64_t ts) noexcept
 Sets the best-effort timestamp.
 
std::int64_t DurationTicks () const noexcept
 Duration in stream ticks.
 
void DurationTicks (std::int64_t duration) noexcept
 Sets duration in stream ticks.
 
int ColorRange () const noexcept
 Color range.
 
void ColorRange (int range) noexcept
 Sets color range.
 
int ColorSpace () const noexcept
 Matrix coefficients.
 
void ColorSpace (int space) noexcept
 Sets matrix coefficients.
 
int ColorPrimaries () const noexcept
 Color primaries.
 
void ColorPrimaries (int primaries) noexcept
 Sets color primaries.
 
int ColorTransfer () const noexcept
 Transfer characteristics.
 
void ColorTransfer (int transfer) noexcept
 Sets transfer characteristics.
 
int ChromaLocation () const noexcept
 Chroma sample location.
 
void ChromaLocation (int location) noexcept
 Sets chroma sample location.
 
AVRational SampleAspectRatio () const noexcept
 Sample aspect ratio.
 
void SampleAspectRatio (AVRational sar) noexcept
 Sets sample aspect ratio.
 
int PictType () const noexcept
 Picture type (I/P/B/…).
 
void PictType (int type) noexcept
 Sets picture type.
 
bool KeyFrame () const noexcept
 Whether this is a key frame.
 
void KeyFrame (bool key) noexcept
 Marks the frame as a key frame or not.
 
int RepeatPict () const noexcept
 Extra delay in field durations (repeat_pict).
 
void RepeatPict (int repeat) noexcept
 Sets repeat_pict.
 
bool Interlaced () const noexcept
 Whether the frame is interlaced.
 
void Interlaced (bool interlaced, bool top_first) noexcept
 Marks the frame as interlaced or progressive.
 
bool TopFieldFirst () const noexcept
 Whether the top field is first (interlaced).
 
int CropLeft () const noexcept
 Left crop in pixels.
 
int CropRight () const noexcept
 Right crop in pixels.
 
int CropTop () const noexcept
 Top crop in pixels.
 
int CropBottom () const noexcept
 Bottom crop in pixels.
 
void Crop (int left, int right, int top, int bottom) noexcept
 Sets crop window.
 
bool ApplyCropping (int flags=0) noexcept
 Applies the crop window (av_frame_apply_cropping).
 
int PlaneCount () const noexcept
 Number of video components or audio channels.
 
int PlaneWidth (int plane) const noexcept
 Width of plane accounting for chroma subsampling.
 
int PlaneHeight (int plane) const noexcept
 Height of plane accounting for chroma subsampling.
 
int BitsPerComponent () const noexcept
 Bits per component from the pixel descriptor.
 
const char * FormatName () const noexcept
 Pixel or sample format name.
 
const uint8_t * Data (int plane) const noexcept
 Const pointer to plane plane.
 
uint8_t * Data (int plane) noexcept
 Mutable pointer to plane plane.
 
int Linesize (int plane) const noexcept
 Bytes per row for plane, including padding.
 
int NbSamples () const noexcept
 Audio sample count.
 
void NbSamples (int samples) noexcept
 Sets audio sample count.
 
int SampleRate () const noexcept
 Audio sample rate in Hz.
 
void SampleRate (int rate) noexcept
 Sets audio sample rate.
 
int Channels () const noexcept
 Audio channel count.
 
AVChannelLayout ChannelLayout () const noexcept
 Channel layout owned by this frame.
 
bool CopyChannelLayout (const AVChannelLayout &layout) noexcept
 Replaces the channel layout.
 
uint8_t ** ExtendedData () noexcept
 Planar audio / video data pointers (extended_data).
 
const uint8_t *const * ExtendedData () const noexcept
 Const planar data pointers (extended_data).
 
const AVFrameSideData * SideData (int type) const noexcept
 Looks up side data.
 
AVFrameSideData * SideData (int type) noexcept
 Looks up mutable side data.
 
void RemoveSideData (int type) noexcept
 Removes side data of type.
 
int SideDataCount () const noexcept
 Number of side-data entries.
 
const AVFrameSideData * SideDataAt (int index) const noexcept
 Side data at index.
 
uint8_t * NewSideData (int type, int size) noexcept
 Allocates side data of type (av_frame_new_side_data).
 
void CopyPrimaryBuffer (StormByte::Buffer::DataType &out) const noexcept
 Packs planar video/audio into out without linesize padding.
 
void WriteHdr10 (const StormByte::Multimedia::Property::HDR10 &hdr10) noexcept
 Writes mastering display and content light from hdr10.
 
void WriteSideData (const std::vector< StormByte::Multimedia::Pipeline::SideData > &attachments) noexcept
 Copies raw SEI/side-data blobs onto the frame.
 
bool ScaleTo (AVFrame &dst, int dst_w, int dst_h, int flags=0) const noexcept
 Scales this frame into dst (allocates dst if empty).
 
void Reset (::AVFrame *raw) noexcept
 Adopts raw.
 
- Public Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVFrame >
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 FormatNone () noexcept
 AV_PIX_FMT_NONE as int.
 
static int FormatGray8 () noexcept
 AV_PIX_FMT_GRAY8 as int.
 
static int FormatRgba () noexcept
 AV_PIX_FMT_RGBA as int.
 
static AVFrame DecodeImage (const std::uint8_t *data, std::size_t size, std::string_view hint={}) noexcept
 Decodes one still image from a compressed buffer.
 

Friends

class AVDecoder
 
class AVEncoder
 
class Swr
 
class Sws
 
class StormByte::Multimedia::Backend::Pipeline::Frame
 
class StormByte::Multimedia::Pipeline::Filter::FFmpeg
 

Additional Inherited Members

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

Detailed Description

RAII owner of a libav AVFrame.

Filter authors: clone, scale, planes, props, side data, still-image decode. Do not call av_*. Get() and Detach() are not public.

Member Enumeration Documentation

◆ VideoLayout

enum class StormByte::Multimedia::FFmpeg::AVFrame::VideoLayout : std::uint8_t
strong

Planar video family, ignoring bit depth.

Packed RGB/YUV and hardware formats are Unknown. Gray is single-component (YUV400 for libvmaf).

Enumerator
Unknown 

Not a software planar YUV/gray frame.

Gray 

One component (GRAY8 / GRAY10 / …).

Yuv420 

4:2:0 (8 / 10 / 12).

Yuv422 

4:2:2 (8 / 10).

Yuv444 

4:4:4 (8 / 10).

Constructor & Destructor Documentation

◆ AVFrame() [1/2]

StormByte::Multimedia::FFmpeg::AVFrame::AVFrame ( )
noexcept

Allocates an empty frame (av_frame_alloc).

◆ AVFrame() [2/2]

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

Move constructor.

Transfers the libav pointer.

Parameters
otherSource frame; left empty.

◆ ~AVFrame()

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

Destructor.

Unreferences buffers and frees the struct.

Member Function Documentation

◆ AllocAudio()

bool StormByte::Multimedia::FFmpeg::AVFrame::AllocAudio ( int  nb_samples,
int  format,
const AVChannelLayout layout,
int  sample_rate 
)
noexcept

Sets audio samples, format and layout, then allocates planes.

Parameters
nb_samplesSample count.
formatAVSampleFormat as int.
layoutChannel layout.
sample_rateSample rate in Hz.
Returns
false on failure.

◆ AllocVideo()

bool StormByte::Multimedia::FFmpeg::AVFrame::AllocVideo ( int  width,
int  height,
int  format,
int  align = 0 
)
noexcept

Sets video geometry and format, then allocates planes.

Parameters
widthWidth in pixels.
heightHeight in pixels.
formatAVPixelFormat as int.
alignAlignment in bytes. 0 = FFmpeg default.
Returns
false on failure.

◆ ApplyCropping()

bool StormByte::Multimedia::FFmpeg::AVFrame::ApplyCropping ( int  flags = 0)
noexcept

Applies the crop window (av_frame_apply_cropping).

Parameters
flagsAV_FRAME_CROP_* flags.
Returns
false on failure.

◆ BestEffortTimestamp() [1/2]

std::int64_t StormByte::Multimedia::FFmpeg::AVFrame::BestEffortTimestamp ( ) const
noexcept

Best-effort timestamp (best_effort_timestamp).

Returns
Timestamp, or AV_NOPTS_VALUE.

◆ BestEffortTimestamp() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::BestEffortTimestamp ( std::int64_t  ts)
noexcept

Sets the best-effort timestamp.

Parameters
tsTimestamp, or AV_NOPTS_VALUE.

◆ BitsPerComponent()

int StormByte::Multimedia::FFmpeg::AVFrame::BitsPerComponent ( ) const
noexcept

Bits per component from the pixel descriptor.

Returns
Depth, or 8 if unknown.

◆ ChannelLayout()

AVChannelLayout StormByte::Multimedia::FFmpeg::AVFrame::ChannelLayout ( ) const
noexcept

Channel layout owned by this frame.

Returns
Layout, or nullptr.

◆ Channels()

int StormByte::Multimedia::FFmpeg::AVFrame::Channels ( ) const
noexcept

Audio channel count.

Returns
Channels, or 0.

◆ ChromaLocation() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::ChromaLocation ( ) const
noexcept

Chroma sample location.

Returns
AVChromaLocation as int.

◆ ChromaLocation() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::ChromaLocation ( int  location)
noexcept

Sets chroma sample location.

Parameters
locationAVChromaLocation as int.

◆ Clone()

AVFrame StormByte::Multimedia::FFmpeg::AVFrame::Clone ( ) const
noexcept

Independent clone (av_frame_clone).

Returns
New frame with copied buffers, or empty on failure.

◆ ColorPrimaries() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::ColorPrimaries ( ) const
noexcept

Color primaries.

Returns
AVColorPrimaries as int.

◆ ColorPrimaries() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::ColorPrimaries ( int  primaries)
noexcept

Sets color primaries.

Parameters
primariesAVColorPrimaries as int.

◆ ColorRange() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::ColorRange ( ) const
noexcept

Color range.

Returns
AVColorRange as int.

◆ ColorRange() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::ColorRange ( int  range)
noexcept

Sets color range.

Parameters
rangeAVColorRange as int.

◆ ColorSpace() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::ColorSpace ( ) const
noexcept

Matrix coefficients.

Returns
AVColorSpace as int.

◆ ColorSpace() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::ColorSpace ( int  space)
noexcept

Sets matrix coefficients.

Parameters
spaceAVColorSpace as int.

◆ ColorTransfer() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::ColorTransfer ( ) const
noexcept

Transfer characteristics.

Returns
AVColorTransferCharacteristic as int.

◆ ColorTransfer() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::ColorTransfer ( int  transfer)
noexcept

Sets transfer characteristics.

Parameters
transferAVColorTransferCharacteristic as int.

◆ Copy()

bool StormByte::Multimedia::FFmpeg::AVFrame::Copy ( const AVFrame other)
noexcept

Copies samples/planes from other (av_frame_copy).

Parameters
otherSource with matching geometry.
Returns
false on failure.

◆ CopyChannelLayout()

bool StormByte::Multimedia::FFmpeg::AVFrame::CopyChannelLayout ( const AVChannelLayout layout)
noexcept

Replaces the channel layout.

Parameters
layoutSource layout.
Returns
false on failure.

◆ CopyPrimaryBuffer()

void StormByte::Multimedia::FFmpeg::AVFrame::CopyPrimaryBuffer ( StormByte::Buffer::DataType &  out) const
noexcept

Packs planar video/audio into out without linesize padding.

Parameters
outDestination (cleared first).

◆ CopyProps()

bool StormByte::Multimedia::FFmpeg::AVFrame::CopyProps ( const AVFrame other)
noexcept

Copies metadata from other (av_frame_copy_props).

Parameters
otherSource frame.
Returns
false on failure.

◆ Crop()

void StormByte::Multimedia::FFmpeg::AVFrame::Crop ( int  left,
int  right,
int  top,
int  bottom 
)
noexcept

Sets crop window.

Does not apply it.

Parameters
leftLeft crop in pixels.
rightRight crop in pixels.
topTop crop in pixels.
bottomBottom crop in pixels.

◆ CropBottom()

int StormByte::Multimedia::FFmpeg::AVFrame::CropBottom ( ) const
noexcept

Bottom crop in pixels.

Returns
Crop, or 0.

◆ CropLeft()

int StormByte::Multimedia::FFmpeg::AVFrame::CropLeft ( ) const
noexcept

Left crop in pixels.

Returns
Crop, or 0.

◆ CropRight()

int StormByte::Multimedia::FFmpeg::AVFrame::CropRight ( ) const
noexcept

Right crop in pixels.

Returns
Crop, or 0.

◆ CropTop()

int StormByte::Multimedia::FFmpeg::AVFrame::CropTop ( ) const
noexcept

Top crop in pixels.

Returns
Crop, or 0.

◆ Data() [1/2]

const uint8_t * StormByte::Multimedia::FFmpeg::AVFrame::Data ( int  plane) const
noexcept

Const pointer to plane plane.

Parameters
planePlane index.
Returns
Pointer, or nullptr.

◆ Data() [2/2]

uint8_t * StormByte::Multimedia::FFmpeg::AVFrame::Data ( int  plane)
noexcept

Mutable pointer to plane plane.

Parameters
planePlane index.
Returns
Pointer, or nullptr.

◆ DecodeImage()

static AVFrame StormByte::Multimedia::FFmpeg::AVFrame::DecodeImage ( const std::uint8_t *  data,
std::size_t  size,
std::string_view  hint = {} 
)
staticnoexcept

Decodes one still image from a compressed buffer.

Parameters
dataFile bytes (PNG / JPEG / WebP / BMP).
sizeByte count.
hintPath or extension (.png, logo.jpg). Empty tries JPEG.
Returns
Frame with planes, or an empty wrapper (!frame) on failure.

Opens a decoder, sends one packet, receives one frame. Does not convert pixel format; call ScaleTo for RGBA / GRAY8. data must remain valid for the duration of the call.

◆ DurationTicks() [1/2]

std::int64_t StormByte::Multimedia::FFmpeg::AVFrame::DurationTicks ( ) const
noexcept

Duration in stream ticks.

Returns
Duration, or 0.

◆ DurationTicks() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::DurationTicks ( std::int64_t  duration)
noexcept

Sets duration in stream ticks.

Parameters
durationDuration, or 0.

◆ ExtendedData() [1/2]

const uint8_t *const * StormByte::Multimedia::FFmpeg::AVFrame::ExtendedData ( ) const
noexcept

Const planar data pointers (extended_data).

Returns
Pointer array, or nullptr.

◆ ExtendedData() [2/2]

uint8_t ** StormByte::Multimedia::FFmpeg::AVFrame::ExtendedData ( )
noexcept

Planar audio / video data pointers (extended_data).

Returns
Pointer array, or nullptr.

◆ Format() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::Format ( ) const
noexcept

Pixel or sample format.

Returns
Format as int, or AV_PIX_FMT_NONE.

◆ Format() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::Format ( int  format)
noexcept

Sets pixel or sample format.

Does not reallocate planes.

Parameters
formatFormat as int.

◆ FormatGray8()

static int StormByte::Multimedia::FFmpeg::AVFrame::FormatGray8 ( )
staticnoexcept

AV_PIX_FMT_GRAY8 as int.

Returns
Format token.

◆ FormatName()

const char * StormByte::Multimedia::FFmpeg::AVFrame::FormatName ( ) const
noexcept

Pixel or sample format name.

Returns
FFmpeg name, or "?".

◆ FormatNone()

static int StormByte::Multimedia::FFmpeg::AVFrame::FormatNone ( )
staticnoexcept

AV_PIX_FMT_NONE as int.

Returns
Format token.

◆ FormatRgba()

static int StormByte::Multimedia::FFmpeg::AVFrame::FormatRgba ( )
staticnoexcept

AV_PIX_FMT_RGBA as int.

Returns
Format token.

◆ GetBuffer()

bool StormByte::Multimedia::FFmpeg::AVFrame::GetBuffer ( int  align = 0)
noexcept

Allocates plane buffers (av_frame_get_buffer).

Parameters
alignAlignment in bytes. 0 = FFmpeg default.
Returns
false on failure.

◆ Hardware()

bool StormByte::Multimedia::FFmpeg::AVFrame::Hardware ( ) const
noexcept

Whether the pixel format is hardware-backed.

Returns
true if planes are not CPU-readable.

◆ Height() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::Height ( ) const
noexcept

Frame height in pixels.

Returns
Height, or 0.

◆ Height() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::Height ( int  height)
noexcept

Sets frame height.

Does not reallocate planes.

Parameters
heightHeight in pixels.

◆ Interlaced() [1/2]

bool StormByte::Multimedia::FFmpeg::AVFrame::Interlaced ( ) const
noexcept

Whether the frame is interlaced.

Returns
true for interlaced content.

◆ Interlaced() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::Interlaced ( bool  interlaced,
bool  top_first 
)
noexcept

Marks the frame as interlaced or progressive.

Parameters
interlacedtrue for interlaced.
top_firsttrue if the top field is first.

◆ KeyFrame() [1/2]

bool StormByte::Multimedia::FFmpeg::AVFrame::KeyFrame ( ) const
noexcept

Whether this is a key frame.

Returns
true for IDR / key frames.

◆ KeyFrame() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::KeyFrame ( bool  key)
noexcept

Marks the frame as a key frame or not.

Parameters
keytrue for a key frame.

◆ Layout()

VideoLayout StormByte::Multimedia::FFmpeg::AVFrame::Layout ( ) const
noexcept

Planar layout of this frame.

Returns
Family, or Unknown if empty / packed / hw.

◆ Linesize()

int StormByte::Multimedia::FFmpeg::AVFrame::Linesize ( int  plane) const
noexcept

Bytes per row for plane, including padding.

Parameters
planePlane index.
Returns
Linesize, or 0.

◆ MakeWritable()

bool StormByte::Multimedia::FFmpeg::AVFrame::MakeWritable ( )
noexcept

Ensures unique buffers (av_frame_make_writable).

Returns
false on failure.

◆ NbSamples() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::NbSamples ( ) const
noexcept

Audio sample count.

Returns
Samples, or 0.

◆ NbSamples() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::NbSamples ( int  samples)
noexcept

Sets audio sample count.

Does not reallocate.

Parameters
samplesSample count.

◆ NewSideData()

uint8_t * StormByte::Multimedia::FFmpeg::AVFrame::NewSideData ( int  type,
int  size 
)
noexcept

Allocates side data of type (av_frame_new_side_data).

Parameters
typeAVFrameSideDataType value.
sizePayload size in bytes.
Returns
Payload pointer, or nullptr on failure.

◆ operator bool()

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

True when a libav struct is owned.

Plane buffers may still be empty.

Returns
true if the wrapper holds a frame.

◆ operator=()

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

Move assignment.

Frees *this, then takes other.

Parameters
otherSource frame; left empty.
Returns
*this.

◆ PictType() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::PictType ( ) const
noexcept

Picture type (I/P/B/…).

Returns
AVPictureType as int.

◆ PictType() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::PictType ( int  type)
noexcept

Sets picture type.

Parameters
typeAVPictureType as int.

◆ PlaneCount()

int StormByte::Multimedia::FFmpeg::AVFrame::PlaneCount ( ) const
noexcept

Number of video components or audio channels.

Returns
Plane/component count, or 0.

◆ PlaneHeight()

int StormByte::Multimedia::FFmpeg::AVFrame::PlaneHeight ( int  plane) const
noexcept

Height of plane accounting for chroma subsampling.

Parameters
planePlane index. 0 is luma / packed.
Returns
Height in samples.

◆ PlaneWidth()

int StormByte::Multimedia::FFmpeg::AVFrame::PlaneWidth ( int  plane) const
noexcept

Width of plane accounting for chroma subsampling.

Parameters
planePlane index. 0 is luma / packed.
Returns
Width in samples.

◆ Pts() [1/2]

std::int64_t StormByte::Multimedia::FFmpeg::AVFrame::Pts ( ) const
noexcept

Presentation timestamp in stream ticks.

Returns
pts, or AV_NOPTS_VALUE.

◆ Pts() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::Pts ( std::int64_t  pts)
noexcept

Sets presentation timestamp in stream ticks.

Parameters
ptsPresentation timestamp, or AV_NOPTS_VALUE.

◆ Ref()

bool StormByte::Multimedia::FFmpeg::AVFrame::Ref ( const AVFrame other)
noexcept

Shares buffers with other (av_frame_ref).

Parameters
otherSource frame.
Returns
false on failure.

◆ RemoveSideData()

void StormByte::Multimedia::FFmpeg::AVFrame::RemoveSideData ( int  type)
noexcept

Removes side data of type.

Parameters
typeAVFrameSideDataType value.

◆ RepeatPict() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::RepeatPict ( ) const
noexcept

Extra delay in field durations (repeat_pict).

Yadif / bwdif.

Returns
Repeat count, or 0.

◆ RepeatPict() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::RepeatPict ( int  repeat)
noexcept

Sets repeat_pict.

Parameters
repeatExtra field delays.

◆ Reset()

void StormByte::Multimedia::FFmpeg::AVFrame::Reset ( ::AVFrame raw)
noexcept

Adopts raw.

Previous frame is freed.

Parameters
rawlibav frame, or nullptr.

◆ SampleAspectRatio() [1/2]

AVRational StormByte::Multimedia::FFmpeg::AVFrame::SampleAspectRatio ( ) const
noexcept

Sample aspect ratio.

Returns
SAR, or {0, 1} if unknown.

◆ SampleAspectRatio() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::SampleAspectRatio ( AVRational  sar)
noexcept

Sets sample aspect ratio.

Parameters
sarPixel aspect ratio.

◆ SampleRate() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::SampleRate ( ) const
noexcept

Audio sample rate in Hz.

Returns
Rate, or 0.

◆ SampleRate() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::SampleRate ( int  rate)
noexcept

Sets audio sample rate.

Parameters
rateSample rate in Hz.

◆ ScaleTo()

bool StormByte::Multimedia::FFmpeg::AVFrame::ScaleTo ( AVFrame dst,
int  dst_w,
int  dst_h,
int  flags = 0 
) const
noexcept

Scales this frame into dst (allocates dst if empty).

Parameters
dstDestination. Pixel format is taken from dst if set, otherwise from this frame.
dst_wDestination width.
dst_hDestination height.
flagslibswscale flags. 0 = SWS_BILINEAR.
Returns
false on failure.

◆ SideData() [1/2]

const AVFrameSideData * StormByte::Multimedia::FFmpeg::AVFrame::SideData ( int  type) const
noexcept

Looks up side data.

Parameters
typeAVFrameSideDataType value.
Returns
Side data pointer, or nullptr.

◆ SideData() [2/2]

AVFrameSideData * StormByte::Multimedia::FFmpeg::AVFrame::SideData ( int  type)
noexcept

Looks up mutable side data.

Parameters
typeAVFrameSideDataType value.
Returns
Side data pointer, or nullptr.

◆ SideDataAt()

const AVFrameSideData * StormByte::Multimedia::FFmpeg::AVFrame::SideDataAt ( int  index) const
noexcept

Side data at index.

Parameters
indexEntry index.
Returns
Pointer, or nullptr.

◆ SideDataCount()

int StormByte::Multimedia::FFmpeg::AVFrame::SideDataCount ( ) const
noexcept

Number of side-data entries.

Returns
Count, or 0.

◆ TopFieldFirst()

bool StormByte::Multimedia::FFmpeg::AVFrame::TopFieldFirst ( ) const
noexcept

Whether the top field is first (interlaced).

Returns
true if top field first.

◆ Unref()

void StormByte::Multimedia::FFmpeg::AVFrame::Unref ( )
noexcept

Unreferences frame buffers (av_frame_unref).

◆ Width() [1/2]

int StormByte::Multimedia::FFmpeg::AVFrame::Width ( ) const
noexcept

Frame width in pixels.

Returns
Width, or 0.

◆ Width() [2/2]

void StormByte::Multimedia::FFmpeg::AVFrame::Width ( int  width)
noexcept

Sets frame width.

Does not reallocate planes.

Parameters
widthWidth in pixels.

◆ Writable()

bool StormByte::Multimedia::FFmpeg::AVFrame::Writable ( ) const
noexcept

Whether plane buffers are uniquely owned.

Returns
true if a write will not alias another frame.

◆ WriteHdr10()

void StormByte::Multimedia::FFmpeg::AVFrame::WriteHdr10 ( const StormByte::Multimedia::Property::HDR10 hdr10)
noexcept

Writes mastering display and content light from hdr10.

Parameters
hdr10High-level HDR10 bag.

◆ WriteSideData()

void StormByte::Multimedia::FFmpeg::AVFrame::WriteSideData ( const std::vector< StormByte::Multimedia::Pipeline::SideData > &  attachments)
noexcept

Copies raw SEI/side-data blobs onto the frame.

Parameters
attachmentsHigh-level side data.

Friends And Related Symbol Documentation

◆ AVDecoder

friend class AVDecoder
friend

◆ AVEncoder

friend class AVEncoder
friend

◆ StormByte::Multimedia::Backend::Pipeline::Frame

friend class StormByte::Multimedia::Backend::Pipeline::Frame
friend

◆ StormByte::Multimedia::Pipeline::Filter::FFmpeg

◆ Swr

friend class Swr
friend

◆ Sws

friend class Sws
friend

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