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::AVFormatContext Class Reference

RAII input format context (demuxer). More...

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

Inheritance diagram for StormByte::Multimedia::FFmpeg::AVFormatContext:
Collaboration diagram for StormByte::Multimedia::FFmpeg::AVFormatContext:

Public Member Functions

 AVFormatContext (const AVFormatContext &other)=delete
 Copy constructor (deleted).
 AVFormatContext (AVFormatContext &&other) noexcept
 Move constructor.
 ~AVFormatContext () noexcept override
 Destructor.
AVFormatContext & operator= (const AVFormatContext &other)=delete
 Copy assignment (deleted).
AVFormatContext & operator= (AVFormatContext &&other) noexcept
 Move assignment.
const char * FormatName () const noexcept
 Demuxer format name (iformat->name).
const char * Tag (const char *key) const noexcept
 Looks up a container metadata tag.
std::optional< std::chrono::nanoseconds > Duration () const noexcept
 Container duration in nanoseconds.
OperationResult ReadPacket (AVPacket &packet) noexcept
 Reads the next packet.
Streams Streams () const noexcept
 Non-owning stream views.
std::optional< AVBSF > Mp4ToAnnexB (int codec_id, int stream_id, const AVCodecParameters &params) const noexcept
 Returns an mp4→Annex-B BSF when the container and codec require it.
 operator bool () const noexcept
 Whether an input context is open.
void DiscardUnwanted (const std::unordered_set< int > &wanted) noexcept
 Marks streams not in wanted as AVDISCARD_ALL.
Public Member Functions inherited from StormByte::Multimedia::FFmpeg::AVPointer<::AVFormatContext >
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 ExpectedAVFormatContext Open (const std::filesystem::path &path)
 Opens a file and finds stream info.
static ExpectedAVFormatContext Open (StormByte::Buffer::Consumer consumer)
 Opens a Consumer and finds stream info.

Friends

class StormByte::Multimedia::Backend::Pipeline::Demuxer

Additional Inherited Members

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

Detailed Description

RAII input format context (demuxer).

Constructor & Destructor Documentation

◆ AVFormatContext() [1/2]

StormByte::Multimedia::FFmpeg::AVFormatContext::AVFormatContext ( const AVFormatContext & other)
delete

Copy constructor (deleted).

Parameters
otherUnused.

◆ AVFormatContext() [2/2]

StormByte::Multimedia::FFmpeg::AVFormatContext::AVFormatContext ( AVFormatContext && other)
noexcept

Move constructor.

Parameters
otherSource context.

◆ ~AVFormatContext()

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

Destructor.

Member Function Documentation

◆ DiscardUnwanted()

void StormByte::Multimedia::FFmpeg::AVFormatContext::DiscardUnwanted ( const std::unordered_set< int > & wanted)
noexcept

Marks streams not in wanted as AVDISCARD_ALL.

Parameters
wantedOrigin indexes to keep (AVDISCARD_DEFAULT).

◆ Duration()

std::optional< std::chrono::nanoseconds > StormByte::Multimedia::FFmpeg::AVFormatContext::Duration ( ) const
noexcept

Container duration in nanoseconds.

Returns
Duration, or empty if unknown.

◆ FormatName()

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

Demuxer format name (iformat->name).

Returns
Name (may be comma-separated ids), or nullptr.

◆ Mp4ToAnnexB()

std::optional< AVBSF > StormByte::Multimedia::FFmpeg::AVFormatContext::Mp4ToAnnexB ( int codec_id,
int stream_id,
const AVCodecParameters & params ) const
noexcept

Returns an mp4→Annex-B BSF when the container and codec require it.

Parameters
codec_idCodec id.
stream_idStream index (time base).
paramsCodec parameters.
Returns
BSF or nullopt.

◆ Open() [1/2]

ExpectedAVFormatContext StormByte::Multimedia::FFmpeg::AVFormatContext::Open ( const std::filesystem::path & path)
static

Opens a file and finds stream info.

Parameters
pathMedia path.
Returns
Context or DecoderError.

◆ Open() [2/2]

ExpectedAVFormatContext StormByte::Multimedia::FFmpeg::AVFormatContext::Open ( StormByte::Buffer::Consumer consumer)
static

Opens a Consumer and finds stream info.

Parameters
consumerShared ring handle (copied into the I/O adapter).
Returns
Context or DecoderError.

◆ operator bool()

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

Whether an input context is open.

Returns
true after a successful Open().

◆ operator=() [1/2]

AVFormatContext & StormByte::Multimedia::FFmpeg::AVFormatContext::operator= ( AVFormatContext && other)
noexcept

Move assignment.

Parameters
otherSource context.
Returns
*this.

◆ operator=() [2/2]

AVFormatContext & StormByte::Multimedia::FFmpeg::AVFormatContext::operator= ( const AVFormatContext & other)
delete

Copy assignment (deleted).

Parameters
otherUnused.
Returns
*this.

◆ ReadPacket()

OperationResult StormByte::Multimedia::FFmpeg::AVFormatContext::ReadPacket ( AVPacket & packet)
noexcept

Reads the next packet.

Parameters
packetDestination packet.
Returns
Operation result.

◆ Streams()

Streams StormByte::Multimedia::FFmpeg::AVFormatContext::Streams ( ) const
noexcept

Non-owning stream views.

Returns
Set of streams.

◆ Tag()

const char * StormByte::Multimedia::FFmpeg::AVFormatContext::Tag ( const char * key) const
noexcept

Looks up a container metadata tag.

Parameters
keyDictionary key (e.g. "title").
Returns
Value, or nullptr if missing.

◆ StormByte::Multimedia::Backend::Pipeline::Demuxer

friend class StormByte::Multimedia::Backend::Pipeline::Demuxer
friend

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