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

Snapshot of a media source: path or Consumer, container, streams and tags. More...

#include <StormByte/multimedia/file.hxx>

Public Member Functions

 File (const File &)=delete
 Copy constructor (deleted).
 
 File (File &&) noexcept
 Move constructor.
 
 ~File () noexcept
 Destructor.
 
Fileoperator= (const File &)=delete
 Copy assignment (deleted).
 
Fileoperator= (File &&)=delete
 Move assignment (deleted: Container is a reference).
 
const std::filesystem::path & Path () const noexcept
 Filesystem path passed to Open, or empty if the origin is a Consumer.
 
const class ContainerContainer () const noexcept
 Detected container.
 
const Multimedia::StreamsStreams () const noexcept
 Real streams in container order.
 
const Multimedia::AttachmentsAttachments () const noexcept
 Container attachments (covers, fonts).
 
const Metadata::FileMetadata () const noexcept
 Container-level tags captured at Open.
 
const std::optional< Property::Duration > & Duration () const noexcept
 Container duration.
 

Static Public Member Functions

static ExpectedFile Open (const std::filesystem::path &path) noexcept
 Opens and probes path.
 
static ExpectedFile Open (const std::filesystem::path &path, std::chrono::nanoseconds duration) noexcept
 Opens and probes path with an already known duration.
 
static ExpectedFile Open (StormByte::Buffer::Consumer consumer) noexcept
 Opens and probes a Consumer.
 
static ExpectedFile Open (StormByte::Buffer::Consumer consumer, std::chrono::nanoseconds duration) noexcept
 Opens and probes a Consumer with an already known duration.
 

Friends

class Pipeline::Demuxer
 

Detailed Description

Snapshot of a media source: path or Consumer, container, streams and tags.

Public media file snapshot.

File is move-only. Open() probes with private FFmpeg RAII and drops the demuxer before return. A Consumer origin is kept; its Ring is exclusive to this File for its lifetime. avformat attached pictures (AV_DISPOSITION_ATTACHED_PIC) are stored in Attachments(), not Streams().

Constructor & Destructor Documentation

◆ File() [1/2]

StormByte::Multimedia::File::File ( const File )
delete

Copy constructor (deleted).

◆ File() [2/2]

StormByte::Multimedia::File::File ( File &&  )
noexcept

Move constructor.

◆ ~File()

StormByte::Multimedia::File::~File ( )
noexcept

Destructor.

Member Function Documentation

◆ Attachments()

const Multimedia::Attachments & StormByte::Multimedia::File::Attachments ( ) const
noexcept

Container attachments (covers, fonts).

Not listed in Streams().

Returns
Attachments captured at Open.

◆ Container()

const class Container & StormByte::Multimedia::File::Container ( ) const
inlinenoexcept

Detected container.

Returns
Registry container.

◆ Duration()

const std::optional< Property::Duration > & StormByte::Multimedia::File::Duration ( ) const
noexcept

Container duration.

Returns
Duration, or empty if it cannot be determined.

Returns the header value, the duration passed to Open, or a value cached after the first scan. The first call may read the whole source when Open was used without a duration: even if the container header has a duration, streams that lack one are filled from packet timestamps. After a successful scan the result is reused on this instance. If Open(..., duration) was used, this is that value, there is no I/O, and stream durations stay as probed.

◆ Metadata()

const Metadata::File & StormByte::Multimedia::File::Metadata ( ) const
inlinenoexcept

Container-level tags captured at Open.

Returns
Metadata snapshot.

◆ Open() [1/4]

static ExpectedFile StormByte::Multimedia::File::Open ( const std::filesystem::path &  path)
staticnoexcept

Opens and probes path.

Parameters
pathMedia file.
Returns
Snapshot or FileOpenException.

◆ Open() [2/4]

static ExpectedFile StormByte::Multimedia::File::Open ( const std::filesystem::path &  path,
std::chrono::nanoseconds  duration 
)
staticnoexcept

Opens and probes path with an already known duration.

Parameters
pathMedia file.
durationAuthoritative container duration in nanoseconds.
Returns
Snapshot or FileOpenException.

◆ Open() [3/4]

static ExpectedFile StormByte::Multimedia::File::Open ( StormByte::Buffer::Consumer  consumer)
staticnoexcept

Opens and probes a Consumer.

Parameters
consumerShared ring handle (copied and kept).
Returns
Snapshot or FileOpenException.

◆ Open() [4/4]

static ExpectedFile StormByte::Multimedia::File::Open ( StormByte::Buffer::Consumer  consumer,
std::chrono::nanoseconds  duration 
)
staticnoexcept

Opens and probes a Consumer with an already known duration.

Parameters
consumerShared ring handle (copied and kept).
durationAuthoritative container duration in nanoseconds.
Returns
Snapshot or FileOpenException.

◆ operator=() [1/2]

File & StormByte::Multimedia::File::operator= ( const File )
delete

Copy assignment (deleted).

Returns
*this.

◆ operator=() [2/2]

File & StormByte::Multimedia::File::operator= ( File &&  )
delete

Move assignment (deleted: Container is a reference).

Returns
*this.

◆ Path()

const std::filesystem::path & StormByte::Multimedia::File::Path ( ) const
noexcept

Filesystem path passed to Open, or empty if the origin is a Consumer.

Returns
Path.

◆ Streams()

const Multimedia::Streams & StormByte::Multimedia::File::Streams ( ) const
inlinenoexcept

Real streams in container order.

Attached pictures are omitted.

Returns
Immutable list.

Friends And Related Symbol Documentation

◆ Pipeline::Demuxer

friend class Pipeline::Demuxer
friend

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