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 | Friends | List of all members
StormByte::Multimedia::FFmpeg::AVPacket Class Reference

RAII owner of a libav AVPacket. More...

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

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

Public Member Functions

 AVPacket () noexcept
 Allocates an empty packet.
 
 AVPacket (AVPacket &&other) noexcept=default
 Move constructor.
 
 ~AVPacket () noexcept override
 Destructor.
 
AVPacketoperator= (AVPacket &&other) noexcept=default
 Move assignment.
 
FFmpeg::AVPacket Ref () const noexcept
 New packet referencing the same data (av_packet_ref).
 
void Unref () noexcept
 Unreferences packet data (av_packet_unref).
 
bool Load (const std::uint8_t *data, int size, int stream_index, bool key_frame) noexcept
 Replaces payload for avcodec_send_packet.
 
void Timestamps (std::int64_t pts, std::int64_t dts, std::int64_t duration) noexcept
 Sets timestamps in stream time base.
 
int StreamIndex () const noexcept
 Packet stream index.
 
std::int64_t Pts () const noexcept
 Presentation timestamp in stream time base.
 
std::int64_t Dts () const noexcept
 Decode timestamp in stream time base.
 
std::int64_t Duration () const noexcept
 Packet duration in stream time base.
 
int Flags () const noexcept
 Packet flags (AV_PKT_FLAG_*).
 
const std::uint8_t * Data () const noexcept
 Compressed payload pointer.
 
int Size () const noexcept
 Compressed payload size in bytes.
 
 operator bool () const noexcept
 Whether a packet struct is owned.
 
int SideDataCount () const noexcept
 Number of side-data entries.
 
int SideDataType (int index) const noexcept
 Side-data type at index.
 
const std::uint8_t * SideData (int index, int &size) const noexcept
 Side-data payload at index.
 
void Reset (::AVPacket *raw) noexcept
 Adopts raw.
 
- Public Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVPacket >
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.
 

Friends

class AVBSF
 
class AVDecoder
 
class AVEncoder
 
class AVFormatContext
 
class StormByte::Multimedia::Backend::Pipeline::Packet
 
class StormByte::Multimedia::Pipeline::Filter::FFmpeg
 

Additional Inherited Members

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

Detailed Description

RAII owner of a libav AVPacket.

Constructor & Destructor Documentation

◆ AVPacket() [1/2]

StormByte::Multimedia::FFmpeg::AVPacket::AVPacket ( )
noexcept

Allocates an empty packet.

◆ AVPacket() [2/2]

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

Move constructor.

Transfers the libav pointer.

Parameters
otherSource packet; left empty.

◆ ~AVPacket()

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

Destructor.

Unreferences buffers and frees the struct.

Member Function Documentation

◆ Data()

const std::uint8_t * StormByte::Multimedia::FFmpeg::AVPacket::Data ( ) const
noexcept

Compressed payload pointer.

Returns
data, or nullptr if empty.

◆ Dts()

std::int64_t StormByte::Multimedia::FFmpeg::AVPacket::Dts ( ) const
noexcept

Decode timestamp in stream time base.

Returns
DTS, or AV_NOPTS_VALUE.

◆ Duration()

std::int64_t StormByte::Multimedia::FFmpeg::AVPacket::Duration ( ) const
noexcept

Packet duration in stream time base.

Returns
Duration ticks, or 0.

◆ Flags()

int StormByte::Multimedia::FFmpeg::AVPacket::Flags ( ) const
noexcept

Packet flags (AV_PKT_FLAG_*).

Returns
Flags, or 0 if empty.

◆ Load()

bool StormByte::Multimedia::FFmpeg::AVPacket::Load ( const std::uint8_t *  data,
int  size,
int  stream_index,
bool  key_frame 
)
noexcept

Replaces payload for avcodec_send_packet.

Parameters
dataCompressed bytes.
sizeByte count.
stream_indexStream index.
key_frameSets AV_PKT_FLAG_KEY when true.
Returns
false if allocation failed.

◆ operator bool()

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

Whether a packet struct is owned.

Returns
true if the wrapper holds a packet.

◆ operator=()

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

Move assignment.

Frees *this, then takes other.

Parameters
otherSource packet; left empty.
Returns
*this.

◆ Pts()

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

Presentation timestamp in stream time base.

Returns
PTS, or AV_NOPTS_VALUE.

◆ Ref()

FFmpeg::AVPacket StormByte::Multimedia::FFmpeg::AVPacket::Ref ( ) const
noexcept

New packet referencing the same data (av_packet_ref).

Returns
Referenced packet.

◆ Reset()

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

Adopts raw.

Previous packet is freed.

Parameters
rawlibav packet, or nullptr.

◆ SideData()

const std::uint8_t * StormByte::Multimedia::FFmpeg::AVPacket::SideData ( int  index,
int &  size 
) const
noexcept

Side-data payload at index.

Parameters
indexEntry index.
sizeSet to payload size on success.
Returns
Pointer, or nullptr.

◆ SideDataCount()

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

Number of side-data entries.

Returns
Count, or 0.

◆ SideDataType()

int StormByte::Multimedia::FFmpeg::AVPacket::SideDataType ( int  index) const
noexcept

Side-data type at index.

Parameters
indexEntry index.
Returns
AVPacketSideDataType as int, or -1.

◆ Size()

int StormByte::Multimedia::FFmpeg::AVPacket::Size ( ) const
noexcept

Compressed payload size in bytes.

Returns
size, or 0 if empty.

◆ StreamIndex()

int StormByte::Multimedia::FFmpeg::AVPacket::StreamIndex ( ) const
noexcept

Packet stream index.

Returns
stream_index, or -1 if empty.

◆ Timestamps()

void StormByte::Multimedia::FFmpeg::AVPacket::Timestamps ( std::int64_t  pts,
std::int64_t  dts,
std::int64_t  duration 
)
noexcept

Sets timestamps in stream time base.

Parameters
ptsPresentation timestamp, or AV_NOPTS_VALUE.
dtsDecode timestamp, or AV_NOPTS_VALUE.
durationDuration ticks, or 0.

◆ Unref()

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

Unreferences packet data (av_packet_unref).

Friends And Related Symbol Documentation

◆ AVBSF

friend class AVBSF
friend

◆ AVDecoder

friend class AVDecoder
friend

◆ AVEncoder

friend class AVEncoder
friend

◆ AVFormatContext

friend class AVFormatContext
friend

◆ StormByte::Multimedia::Backend::Pipeline::Packet

friend class StormByte::Multimedia::Backend::Pipeline::Packet
friend

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


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