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::Pipeline::Muxer Class Referencefinal

Writes interleaved packets to a destination container. More...

#include <StormByte/multimedia/pipeline/muxer.hxx>

Inheritance diagram for StormByte::Multimedia::Pipeline::Muxer:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Multimedia::Pipeline::Muxer:
Collaboration graph
[legend]

Public Member Functions

 operator bool () const noexcept
 true if the destination is bound and the muxer has not failed.
 
bool Closed () const noexcept
 true after Finish flushed the trailer, or after Fail.
 
std::optional< Property::DurationPosition () const noexcept
 Presentation time of the last packet written.
 
const ContainerDestination () const noexcept
 Destination container.
 
bool Armed () const noexcept
 Whether every muxable Plan track has a reserved hopper.
 
bool Ready () const noexcept override
 Open finished without Fail or Stop, and Armed.
 
std::size_t InputCeiling () const noexcept override
 Ceiling of the muxer input hopper.
 
Lifecycle
 Muxer (std::shared_ptr< StormByte::Logger::Log > log, const Container &container) noexcept
 Muxer for container.
 
 Muxer (const Muxer &other)=delete
 Copy constructor.
 
 Muxer (Muxer &&other) noexcept=delete
 Move constructor.
 
 ~Muxer () noexcept override
 Destructor.
 
Muxeroperator= (const Muxer &other)=delete
 Copy assignment.
 
Muxeroperator= (Muxer &&other) noexcept=delete
 Move assignment.
 
Stream tags
std::optional< std::string > Language (int output_index) const noexcept
 Language tag for mux output output_index.
 
void Language (int output_index, std::string language) noexcept
 Sets the language tag for mux output output_index.
 
std::optional< std::string > Title (int output_index) const noexcept
 Title tag for mux output output_index.
 
void Title (int output_index, std::string title) noexcept
 Sets the title tag for mux output output_index.
 
- Public Member Functions inherited from StormByte::Multimedia::Pipeline::Step
 Step (const Step &other)=delete
 
 Step (Step &&other) noexcept=delete
 
virtual ~Step () noexcept
 Destructor.
 
Stepoperator= (const Step &other)=delete
 
Stepoperator= (Step &&other) noexcept=delete
 
std::condition_variable & Wake () noexcept
 Consumer condition variable.
 
const std::shared_ptr< class Plan > & Plan () const noexcept
 Bound job intention, if any.
 
const KindsReceives () const noexcept
 Kinds this step consumes.
 
const KindsProduces () const noexcept
 Kinds this step emits.
 
State Status () const noexcept
 Current lifecycle value.
 
void Stop () noexcept
 Asks the worker to leave and closes all hoppers.
 
bool Failed () const noexcept
 Whether this step has failed.
 
const std::optional< std::string > & Error () const noexcept
 Failure text.
 
void Fail (std::string reason) noexcept
 Marks Failed, closes all hoppers and wakes the worker.
 

Friends

class Backend::Pipeline::Detail::Muxer::Matroska::Container
 
class Backend::Pipeline::Muxer
 
class Backend::Pipeline::Detail::Worker::Mux
 
Encoderoperator>> (Encoder &encoder, Muxer &muxer) noexcept
 Reserves encoder as an output track of muxer.
 
Muxeroperator>> (const File &file, Muxer &muxer) noexcept
 Snapshots attachments of file onto muxer.
 
Muxeroperator>> (Demuxer &demuxer, Muxer &muxer) noexcept
 Binds demuxer as remux origin and forwards its attachments.
 
Muxeroperator>> (Muxer &muxer, const std::filesystem::path &path) noexcept
 Binds the output path of muxer.
 
Remuxeroperator>> (Remuxer &remuxer, Muxer &muxer) noexcept
 Reserves remuxer as an output track of muxer.
 

Additional Inherited Members

- Protected Member Functions inherited from StormByte::Multimedia::Pipeline::Step
Backend::Pipeline::Pipe & pipe () noexcept
 In / out hoppers of this stage.
 
const Backend::Pipeline::Pipe & pipe () const noexcept
 In / out hoppers of this stage.
 
 Step (std::shared_ptr< StormByte::Logger::Log > log, enum Producer name, Kinds receives, Kinds produces) noexcept
 Step in State::Created.
 
void Emit (Item::PointerType item) noexcept
 Write item to the Pipe (item >> pipe).
 
Item::PointerType CloneItem (const Item &item) const noexcept
 Deep-copies item through Item::Clone.
 
void Wait () noexcept
 Sleeps on Wake until hopper Ready, Failed or Stopping.
 
void Launch () noexcept
 Starts the pumper: Setup, Ready, Pump.
 
void Halt () noexcept
 Stop and join the pumper.
 
bool Stopping () const noexcept
 Worker must return (Stop, Halt or Fail).
 
void RecordWork (std::int64_t microseconds) noexcept
 Adds one Process duration to the step summary.
 
std::int64_t LastWork () const noexcept
 Duration of the last timed Process, or 0.
 
void DumpWork () noexcept
 Writes min/max Process time at Debug.
 
Backend::Pipeline::Host & Face () noexcept
 Owner surface for the Pumper and Worker.
 
void Mount (std::unique_ptr< Backend::Pipeline::Pumper > pumper, std::unique_ptr< Backend::Pipeline::Worker > worker) noexcept
 Takes ownership of pumper and binds worker.
 
virtual std::string Label () const noexcept
 Display name of this step.
 
- Protected Attributes inherited from StormByte::Multimedia::Pipeline::Step
std::shared_ptr< StormByte::Logger::Log > m_log
 
enum Producer m_name
 UseLog leaf / default Label.
 
Kinds m_receives
 Receives.
 
Kinds m_produces
 Produces.
 

Detailed Description

Writes interleaved packets to a destination container.

Notice: destination path when bound, closed once. LowLevel writes always; the shared logger throttles. Remux and encode lanes share this worker.

Does not write the container header until Armed is true. Ready is Status Ready and Armed.

Constructor & Destructor Documentation

◆ Muxer() [1/3]

StormByte::Multimedia::Pipeline::Muxer::Muxer ( std::shared_ptr< StormByte::Logger::Log >  log,
const Container container 
)
explicitnoexcept

Muxer for container.

Destination path is bound later.

Parameters
logShared logger. Empty pointer means no log.
containerWritable registry container.

◆ Muxer() [2/3]

Copy constructor.

Parameters
otherSource muxer.

◆ Muxer() [3/3]

Move constructor.

Parameters
otherMuxer to take.

◆ ~Muxer()

StormByte::Multimedia::Pipeline::Muxer::~Muxer ( )
overridenoexcept

Destructor.

Step::Join Halt s before backends die.

Member Function Documentation

◆ Armed()

bool StormByte::Multimedia::Pipeline::Muxer::Armed ( ) const
noexcept

Whether every muxable Plan track has a reserved hopper.

Counts Video, Audio and Subtitle entries in Plan::Tracks. Attachments are written at header time and are not hoppers. true when reserved slots equal that count. false with no Plan, or while operator>> is still running.

Does not Fail. The owner of the graph (Filters::Close or Transcoder) checks this after wiring and Fails the Muxer if it is still false.

Returns
Arming state of the output graph.

◆ Closed()

bool StormByte::Multimedia::Pipeline::Muxer::Closed ( ) const
noexcept

true after Finish flushed the trailer, or after Fail.

Returns
Muxer will not accept more packets.

◆ Destination()

const Container & StormByte::Multimedia::Pipeline::Muxer::Destination ( ) const
noexcept

Destination container.

Returns
Registry container passed to the constructor.

◆ InputCeiling()

std::size_t StormByte::Multimedia::Pipeline::Muxer::InputCeiling ( ) const
inlineoverridevirtualnoexcept

Ceiling of the muxer input hopper.

Returns
Max queued packets. Never 0.

Reimplemented from StormByte::Multimedia::Pipeline::Step.

◆ Language() [1/2]

std::optional< std::string > StormByte::Multimedia::Pipeline::Muxer::Language ( int  output_index) const
noexcept

Language tag for mux output output_index.

Parameters
output_indexMux destination order key.
Returns
Tag, or empty.

◆ Language() [2/2]

void StormByte::Multimedia::Pipeline::Muxer::Language ( int  output_index,
std::string  language 
)
noexcept

Sets the language tag for mux output output_index.

Parameters
output_indexMux destination order key.
languageBCP-47 / ISO tag. Empty clears.

◆ operator bool()

StormByte::Multimedia::Pipeline::Muxer::operator bool ( ) const
explicitnoexcept

true if the destination is bound and the muxer has not failed.

Returns
Open and writable.

◆ operator=() [1/2]

Muxer & StormByte::Multimedia::Pipeline::Muxer::operator= ( const Muxer other)
delete

Copy assignment.

Parameters
otherSource muxer.
Returns
*this.

◆ operator=() [2/2]

Muxer & StormByte::Multimedia::Pipeline::Muxer::operator= ( Muxer &&  other)
deletenoexcept

Move assignment.

Parameters
otherMuxer to take.
Returns
*this.

◆ Position()

std::optional< Property::Duration > StormByte::Multimedia::Pipeline::Muxer::Position ( ) const
noexcept

Presentation time of the last packet written.

Returns
Pts of the last video packet, or of audio if no video has been written yet.

◆ Ready()

bool StormByte::Multimedia::Pipeline::Muxer::Ready ( ) const
overridevirtualnoexcept

Open finished without Fail or Stop, and Armed.

Returns
Step Status is Ready and every muxable Plan track is reserved.

Reimplemented from StormByte::Multimedia::Pipeline::Step.

◆ Title() [1/2]

std::optional< std::string > StormByte::Multimedia::Pipeline::Muxer::Title ( int  output_index) const
noexcept

Title tag for mux output output_index.

Parameters
output_indexMux destination order key.
Returns
Title, or empty.

◆ Title() [2/2]

void StormByte::Multimedia::Pipeline::Muxer::Title ( int  output_index,
std::string  title 
)
noexcept

Sets the title tag for mux output output_index.

Parameters
output_indexMux destination order key.
titleStream title. Empty clears.

Friends And Related Symbol Documentation

◆ Backend::Pipeline::Detail::Muxer::Matroska::Container

friend class Backend::Pipeline::Detail::Muxer::Matroska::Container
friend

◆ Backend::Pipeline::Detail::Worker::Mux

friend class Backend::Pipeline::Detail::Worker::Mux
friend

◆ Backend::Pipeline::Muxer

friend class Backend::Pipeline::Muxer
friend

◆ operator>> [1/5]

Muxer & operator>> ( const File file,
Muxer muxer 
)
friend

Snapshots attachments of file onto muxer.

Parameters
fileSource file.
muxerDestination.
Returns
muxer.

◆ operator>> [2/5]

Muxer & operator>> ( Demuxer demuxer,
Muxer muxer 
)
friend

Binds demuxer as remux origin and forwards its attachments.

Required when any remux track is reserved. Without it the muxer cannot clone origin codec parameters.

Parameters
demuxerOrigin demuxer. Must outlive header write.
muxerDestination.
Returns
muxer.

◆ operator>> [3/5]

Encoder & operator>> ( Encoder encoder,
Muxer muxer 
)
friend

Reserves encoder as an output track of muxer.

Parameters
encoderLive encoder.
muxerDestination.
Returns
encoder.

◆ operator>> [4/5]

Muxer & operator>> ( Muxer muxer,
const std::filesystem::path &  path 
)
friend

Binds the output path of muxer.

Parameters
muxerMuxer.
pathDestination file.
Returns
muxer.

◆ operator>> [5/5]

Remuxer & operator>> ( Remuxer remuxer,
Muxer muxer 
)
friend

Reserves remuxer as an output track of muxer.

Parameters
remuxerLive remuxer.
muxerDestination.
Returns
remuxer.

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