StormByte-Multimedia 0.0.9999
C++26 multimedia processing module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Multimedia::File Class Reference

Read-only consultation snapshot of a media source. More...

#include <StormByte/multimedia/file.hxx>

Public Types

using DurationProgress = std::function<void(double)>
 Observer receiving monotone byte-based duration scan percentages.

Public Member Functions

 File (const File &)=delete
 File (File &&other) noexcept
 Move constructor.
 ~File () noexcept
 Destructor.
File & operator= (const File &)=delete
File & operator= (File &&)=delete
StormByte::Safe::String Path () const
 Path label: stored path, or reader.Path() if borrowed.
const class Container & Container () const noexcept
 Detected container.
const Multimedia::Streams & Streams () const noexcept
 Real streams in container order.
const Multimedia::Attachments & Attachments () const noexcept
 Container attachments (covers, fonts).
const Metadata::File & Metadata () const noexcept
 Container-level tags captured at Open.
const std::optional< Property::Duration > & Duration () const noexcept
 Container duration.
const std::optional< Property::Duration > & Duration (const DurationProgress &progress) const noexcept
 Resolve duration while reporting packet scan progress.

Static Public Member Functions

static ExpectedFile Open (const std::filesystem::path &path, std::optional< std::chrono::nanoseconds > duration=std::nullopt) noexcept
 Opens and probes path.
static ExpectedFile Open (StormByte::Buffer::IO::BufferedLocationReader &reader, std::optional< std::chrono::nanoseconds > duration=std::nullopt) noexcept
 Opens and probes reader with AVIO only.

Friends

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

Detailed Description

Read-only consultation snapshot of a media source.

Public media file snapshot.

File lists a locator, container, streams (HDR / HDR10+ and other mapped properties), attachments, metadata and duration. It has no write API and is not part of the tube. There is no public Reader().

Open(path) creates a temporary local file leaf and drops it after probing so the handle is not held (Windows locking). Open(reader) probes any BufferedLocationReader with AVIO and keeps a borrowed reference; the caller retains ownership. Duration() uses that reader or builds another temporary local reader from the stored path. Path() returns the stored path or the borrowed reader locator.

Open probes headers and a bounded run of video packets for HDR10+. It does not read the whole source for Duration.

See also
StormByte::Buffer::IO::BufferedLocationReader

Member Typedef Documentation

◆ DurationProgress

using StormByte::Multimedia::File::DurationProgress = std::function<void(double)>

Observer receiving monotone byte-based duration scan percentages.

Constructor & Destructor Documentation

◆ File() [1/2]

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

◆ File() [2/2]

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

Move constructor.

Parameters
otherFile to take.

◆ ~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() [1/2]

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 extra I/O, and stream durations stay as probed.

◆ Duration() [2/2]

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

Resolve duration while reporting packet scan progress.

Parameters
progressByte-position observer; not called for a cached or supplied duration.
Returns
Resolved duration, or empty if unavailable.

◆ Metadata()

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

Container-level tags captured at Open.

Returns
Metadata snapshot.

◆ Open() [1/2]

ExpectedFile StormByte::Multimedia::File::Open ( const std::filesystem::path & path,
std::optional< std::chrono::nanoseconds > duration = std::nullopt )
staticnoexcept

Opens and probes path.

Temporary reader is dropped.

Parameters
pathMedia file.
durationAuthoritative duration; empty means scan on first Duration().
Returns
Snapshot or FileOpenException.

◆ Open() [2/2]

ExpectedFile StormByte::Multimedia::File::Open ( StormByte::Buffer::IO::BufferedLocationReader & reader,
std::optional< std::chrono::nanoseconds > duration = std::nullopt )
staticnoexcept

Opens and probes reader with AVIO only.

Parameters
readerExisting origin. Not taken. Rewound before return.
durationAuthoritative duration; empty means scan on first Duration().
Returns
Snapshot or FileOpenException.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Path()

StormByte::Safe::String StormByte::Multimedia::File::Path ( ) const

Path label: stored path, or reader.Path() if borrowed.

Returns
Label.

◆ Streams()

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

Real streams in container order.

Attached pictures are omitted.

Returns
Immutable list.

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

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

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