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

Reads interleaved packets from a File origin. More...

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

Inheritance diagram for StormByte::Multimedia::Pipeline::Demuxer:
Collaboration diagram for StormByte::Multimedia::Pipeline::Demuxer:

Public Member Functions

 operator bool () const noexcept
 true if open, not failed and not at EOF.
Lifecycle
 Demuxer (std::shared_ptr< StormByte::Logger::Log > log) noexcept
 Demuxer.
 Demuxer (const Demuxer &other)=delete
 Copy constructor.
 Demuxer (Demuxer &&other) noexcept=delete
 Move constructor.
 ~Demuxer () noexcept override
 Destructor.
Demuxer & operator= (const Demuxer &other)=delete
 Copy assignment.
Demuxer & operator= (Demuxer &&other) noexcept=delete
 Move assignment.
Source
bool Eof () const noexcept
 Whether the last read hit EOF.
std::optional< Property::Duration > Position () const noexcept
 Presentation time of the last emitted packet.
Progress::Pointer Progress () const noexcept
 Job clock for this tube (measure, analytics, All).
Public Member Functions inherited from StormByte::Multimedia::Pipeline::Step
 Step (const Step &other)=delete
 Step (Step &&other) noexcept=delete
virtual ~Step () noexcept
 Destructor.
Step & operator= (const Step &other)=delete
Step & operator= (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 Kinds & Receives () const noexcept
 Kinds this step consumes.
const Kinds & Produces () const noexcept
 Kinds this step emits.
State Status () const noexcept
 Current lifecycle value.
virtual bool Ready () const noexcept
 Whether this step can take work.
void Stop () noexcept
 Asks the worker to leave and closes all hoppers.
virtual std::size_t InputCeiling () const noexcept
 Ceiling of this step's input hopper.
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::Demuxer
class Backend::Pipeline::Detail::Worker::Demux
class Decoder
class Filters
class Muxer
Decoder & operator>> (Demuxer &demuxer, Decoder &decoder)
 Binds one origin track of demuxer to decoder.
Demuxer & operator>> (class Plan &&plan, Demuxer &demuxer)
 Hands plan to demuxer.
Muxer & operator>> (Demuxer &demuxer, Muxer &muxer)
 Binds demuxer as remux origin and forwards its attachments.
Remuxer & operator>> (Demuxer &demuxer, Remuxer &remuxer)
 Binds origin track remuxer.In() from demuxer onto remuxer.

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.
virtual void Wait () noexcept
 Sleeps on Wake until hopper Ready, Failed, Stopping or WakeNow.
virtual void AfterWait () noexcept
 Work on the waiting worker after Wait unblocks.
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
 Scoped module logger (ThreadedLog preferred).
enum Producer m_name
 UseLog leaf / default Label.
Kinds m_receives
 Receives.
Kinds m_produces
 Produces.

Detailed Description

Reads interleaved packets from a File origin.

Reads interleaved compressed packets from the Plan origin.

Only tracks listed in the bound Plan enter the tube. An origin stream omitted from Plan::add is never pushed.

A Filter::ProcessTwoPasses leaf tells Filters to call Measure before the first read. During that pass only the listed tracks are emitted and hoppers stay open at EoF. ReachedEof then asks Filters to CloseMeasureSource. Decode workers drain and Reset; Filters then LeaveMeasure and Rewind. The same Demuxer instance continues with ordinary Process (the same path as a job that never measured). Transcoder is not involved.

After measure EoF the demux worker Wait s until Rewind clears Measuring. That wake is WakeNow (!Measuring()), not hopper Ready.

The tube clock (Progress) is created here because a tube has exactly one Demuxer. Filters and the Muxer write the same shared object. Progress() returns a const handle the user may keep after the tube dies.

Notice: origin path at Setup, eof once (Process after measure, or the only pass). Debug: bind to a decoder and Process min/max at source EoF. LowLevel unit lines always; the shared logger throttles. Each Read+Emit is timed by the Source pumper.

Wrap assigns the next Packet::Serial for that origin track and Part zero. That id is pipe lineage, not an FFmpeg frame count.

Constructor & Destructor Documentation

◆ Demuxer() [1/3]

StormByte::Multimedia::Pipeline::Demuxer::Demuxer ( std::shared_ptr< StormByte::Logger::Log > log)
explicitnoexcept

Demuxer.

Launches; Setup waits for a Plan.

Parameters
logShared logger. Empty pointer means no log.

◆ Demuxer() [2/3]

Copy constructor.

Parameters
otherSource demuxer.

◆ Demuxer() [3/3]

Move constructor.

Parameters
otherDemuxer to take.

◆ ~Demuxer()

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

Destructor.

Step::Join Halt s before backends die.

Member Function Documentation

◆ Eof()

bool StormByte::Multimedia::Pipeline::Demuxer::Eof ( ) const
noexcept

Whether the last read hit EOF.

Returns
true at end of source of the Process pass.

Measure EoF does not stick. Rewind clears it.

◆ operator bool()

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

true if open, not failed and not at EOF.

Returns
Open and readable.

◆ operator=() [1/2]

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

Copy assignment.

Parameters
otherSource demuxer.
Returns
*this.

◆ operator=() [2/2]

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

Move assignment.

Parameters
otherDemuxer to take.
Returns
*this.

◆ Position()

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

Presentation time of the last emitted packet.

Returns
Pts, or empty until a packet with Pts arrives.

◆ Progress()

Progress::Pointer StormByte::Multimedia::Pipeline::Demuxer::Progress ( ) const
noexcept

Job clock for this tube (measure, analytics, All).

Not Demuxer-only: Filters and the Muxer write the same object. Shared so the user can keep it after the tube dies. No public setters.

Returns
Const shared handle. Never empty.

◆ Backend::Pipeline::Demuxer

friend class Backend::Pipeline::Demuxer
friend

◆ Backend::Pipeline::Detail::Worker::Demux

friend class Backend::Pipeline::Detail::Worker::Demux
friend

◆ Decoder

friend class Decoder
friend

◆ Filters

friend class Filters
friend

◆ Muxer

friend class Muxer
friend

◆ operator>> [1/4]

Demuxer & operator>> ( class Plan && plan,
Demuxer & demuxer )
friend

Hands plan to demuxer.

Not a Step bind.

Parameters
planIntention (moved).
demuxerDestination.
Returns
demuxer.

Stores the Plan on the Demuxer and wakes it. Does not call Plan::Check and does not bind hoppers.

◆ operator>> [2/4]

Decoder & operator>> ( Demuxer & demuxer,
Decoder & decoder )
friend

Binds one origin track of demuxer to decoder.

Parameters
demuxerOrigin demuxer.
decoderDestination decoder.
Returns
decoder.

◆ operator>> [3/4]

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. Also shares the tube Progress clock.

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

◆ operator>> [4/4]

Remuxer & operator>> ( Demuxer & demuxer,
Remuxer & remuxer )
friend

Binds origin track remuxer.In() from demuxer onto remuxer.

Parameters
demuxerOrigin demuxer.
remuxerDestination remuxer.
Returns
remuxer.

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