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 Namespace Reference

Demux / decode / filter / encode / mux types. More...

Namespaces

namespace  Filter
 Forward so this RAII type can friend the filter base.
namespace  Config
 Per-track intention stored by Plan.

Classes

class  DecoderFlags
 Bitmask of DecoderFlag. More...
class  Decoder
 Decodes packets of one origin track into frames. More...
class  Demuxer
 Reads interleaved packets from a File origin. More...
class  Encoder
 Encodes frames of one output track into packets. More...
class  PlanException
 Thrown when Plan::Check finds a malformed plan. More...
class  Filters
 Optional facade: Between stretches, Add filters, Close. More...
class  Frame
 One decoded access unit. More...
class  Item
 Facade shared by Frame and Packet. More...
class  Muxer
 Writes interleaved packets to a destination container. More...
class  Packet
 One compressed access unit. More...
class  Plan
 Closed job intention: source File, destination container and tracks that enter the tube. More...
class  Progress
 Job clock for one tube. More...
class  Remuxer
 Forwards compressed packets of one origin track to the muxer. More...
class  SideData
 One side-data blob attached to a Frame or Packet. More...
class  Step
 One stage with a Backend::Pipeline::Pipe (in / out). More...
class  Track
 One source stream that enters the tube. More...
class  Tracks
 Ordered tube tracks. More...
class  TrackSettled
 What an encoder actually opened. More...
class  Transcoder
 Facade that maps tracks and runs one file-to-file job. More...
class  Kinds
 Bitmask of Kind. More...

Typedefs

using CheckResult = StormByte::Expected<void, PlanException>
 Outcome of Plan::Check.

Enumerations

enum class  DecoderFlag : std::uint8_t { HeuristicsHDR10 = 1u << 0 }
 Decoder behaviour bits. More...
enum class  SideDataKind {
  MasteringDisplay , ContentLight , HdrPlus , HdrVivid ,
  A53CC , Stereo3D , DisplayMatrix , IccProfile ,
  S12MTimecode , Spherical , SeiUnregistered , FilmGrain ,
  DolbyVisionRpu , DolbyVision , AmbientViewing , Other
}
 Known libav side-data kinds on a Frame or Packet. More...
enum class  Status {
  Stopped , Running , Paused , Done ,
  Error , Aborted
}
 Lifecycle of a Transcoder instance. More...
enum class  Kind : std::uint8_t { Packet = 1 << 0 , Frame = 1 << 1 }
 Whether an Item is a decoded frame or a compressed packet. More...
enum class  Producer : std::uint8_t {
  Demuxer , Decoder , Remuxer , Filter ,
  Route , Filters , Encoder , Muxer
}
 Named stage of the tube. More...
enum class  State : std::uint8_t {
  Created , Ready , Stopping , Stopped ,
  Failed
}
 Lifecycle of the stage thread. More...

Functions

Decoder & operator>> (Demuxer &demuxer, Decoder &decoder)
 Binds one origin track of demuxer to decoder.
Encoder & operator>> (Encoder &encoder, Muxer &muxer)
 Reserves encoder as an output track of muxer.
Remuxer & operator>> (Remuxer &remuxer, Muxer &muxer)
 Reserves remuxer as an output track of muxer.
Muxer & operator>> (Muxer &muxer, const std::filesystem::path &path)
 Binds the output path of muxer.
Muxer & operator>> (const File &file, Muxer &muxer)
 Snapshots attachments of file onto muxer.
Muxer & operator>> (Demuxer &demuxer, Muxer &muxer)
 Binds demuxer as remux origin and forwards its attachments.
Demuxer & operator>> (Plan &&plan, Demuxer &demuxer)
 Hands plan to demuxer.
Remuxer & operator>> (Demuxer &demuxer, Remuxer &remuxer)
 Binds origin track remuxer.In() from demuxer onto remuxer.
class Step & operator>> (Step &from, Step &to)
 Shares Plan and binds every output hopper of from onto to.
constexpr const char * ToString (Kind kind) noexcept
 Converts a single Kind flag to a string literal.
constexpr const char * ToString (Producer producer) noexcept
 Converts a Producer to a string literal.

Variables

const DecoderFlags Heuristics {DecoderFlag::HeuristicsHDR10}
 All current heuristic bits.

Detailed Description

Demux / decode / filter / encode / mux types.

Typedef Documentation

◆ CheckResult

using StormByte::Multimedia::Pipeline::CheckResult = StormByte::Expected<void, PlanException>

Outcome of Plan::Check.

Enumeration Type Documentation

◆ DecoderFlag

enum class StormByte::Multimedia::Pipeline::DecoderFlag : std::uint8_t
strong

Decoder behaviour bits.

Empty mask is passthrough.

Enumerator
HeuristicsHDR10 

◆ Kind

enum class StormByte::Multimedia::Pipeline::Kind : std::uint8_t
strong

Whether an Item is a decoded frame or a compressed packet.

Distinct from StormByte::Multimedia::Type (Video / Audio / Subtitle). Values are bit flags. 0 is not a valid kind. Combine with Kinds. ToString understands a single flag only.

Enumerator
Packet 

StormByte::Multimedia::Pipeline::Packet

Frame 

StormByte::Multimedia::Pipeline::Frame

◆ Producer

enum class StormByte::Multimedia::Pipeline::Producer : std::uint8_t
strong

Named stage of the tube.

Used as Item origin and as Step display name for logs. Filter covers Filter::FFmpeg and its Process / Packet / Analytics leaves.

Enumerator
Demuxer 

Demuxer

Decoder 

Decoder

Remuxer 

Remuxer

Filter 

Filter::FFmpeg

Route 

Route

Filters 

Filters

Encoder 

Encoder

Muxer 

Muxer

◆ SideDataKind

Known libav side-data kinds on a Frame or Packet.

Unmapped libav types use SideDataKind::Other and keep the FFmpeg name in SideData::Name.

Enumerator
MasteringDisplay 

Mastering display metadata.

ContentLight 

MaxCLL / MaxFALL.

HdrPlus 

HDR10+ dynamic metadata.

HdrVivid 

HDR Vivid dynamic metadata.

A53CC 

CEA-708 / A53 captions.

Stereo3D 

Stereo 3D.

DisplayMatrix 

Display matrix.

IccProfile 

ICC profile.

S12MTimecode 

SMPTE ST 12-1 timecode.

Spherical 

Spherical mapping.

SeiUnregistered 

Unregistered SEI.

FilmGrain 

Film grain parameters.

DolbyVisionRpu 

Dolby Vision RPU.

DolbyVision 

Dolby Vision metadata.

AmbientViewing 

Ambient viewing environment.

Other 

Unknown; Name() is set.

◆ State

enum class StormByte::Multimedia::Pipeline::State : std::uint8_t
strong

Lifecycle of the stage thread.

Values are mutually exclusive.

This is the state of this stage, not of the job and not of the bound neighbor. A neighbor learns that this stage is dead because the shared hopper is Eof, not by reading this enum.

Owned by the Pumper. A Worker has no State: it only Fail()s into the Host. Step::Status forwards to the Pumper.

Created Constructor finished. The object is usable: Plan can be bound, operator>> can wire hoppers, Stop/Fail are legal. Setup/Open has not returned. Pump must not take units from the input hopper. Launch has usually already spawned the thread; the thread is blocked inside Setup (waiting for a Plan, an origin, a path, …). This is the only state in which Setup may run to completion.

Ready Setup returned. The backend (if any) can take work. Pump may pop and call Process. There is no separate "running" value: pumping is what a Ready thread does, not a new phase. Fail or Stop may still fire from here. When the input hopper reaches Eof and Pump returns without Stop(), Launch moves Ready → Stopped. That is how a stage ends in a live tube (Analytics after the last look, Muxer after the last packet). Filters::Idle and Transcoder wait that Stopped before Reports / OnDone.

Stopping Stop() was called, or Halt() from a destructor. Hoppers are Eof and waiters are notified. The thread has not joined yet. Pump and Setup must return. This is not a failure; the last Process({}) flush may still run.

Stopped The thread has left. Hoppers stay Eof. Reached from Stopping after Halt/Stop, or from Ready after a natural hopper Eof. The tube is not reused: there is no restart back to Created.

Failed Fail() latched a reason. Hoppers are Eof. Terminal, like Stopped, but Error() is set. May be entered from Created (Setup never succeeded) or from Ready. Does not pass through Stopping.

Legal moves: Created→Ready, Created→Failed, Created→Stopping, Ready→Stopping, Ready→Failed, Ready→Stopped, Stopping→Stopped. Failed and Stopped do not leave.

Source EOF is not a State. Demuxer keeps m_eof next to this.

Enumerator
Created 
Ready 
Stopping 
Stopped 
Failed 

◆ Status

Lifecycle of a Transcoder instance.

Open leaves the job Stopped. Run starts the coordinator. OnStart may return Stopped / Error / Aborted to bail without starting the job.

Enumerator
Stopped 

Open succeeded; Run has not started, or OnStart declined.

Running 

Coordinator is alive and not paused.

Paused 

Pause(); coordinator blocks until Resume or Cancel.

Done 

Finished and flushed.

Error 

A stage failed; Error() has text.

Aborted 

Cancel() while Running/Paused, or OnStart returned Aborted.

Function Documentation

◆ operator>>() [1/9]

Muxer & StormByte::Multimedia::Pipeline::operator>> ( const File & file,
Muxer & muxer )
noexcept

Snapshots attachments of file onto muxer.

Parameters
fileSource file.
muxerDestination.
Returns
muxer.

◆ operator>>() [2/9]

Decoder & StormByte::Multimedia::Pipeline::operator>> ( Demuxer & demuxer,
Decoder & decoder )
noexcept

Binds one origin track of demuxer to decoder.

Parameters
demuxerOrigin demuxer.
decoderDestination decoder.
Returns
decoder.

◆ operator>>() [3/9]

Muxer & StormByte::Multimedia::Pipeline::operator>> ( Demuxer & demuxer,
Muxer & muxer )
noexcept

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/9]

Remuxer & StormByte::Multimedia::Pipeline::operator>> ( Demuxer & demuxer,
Remuxer & remuxer )
noexcept

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

Parameters
demuxerOrigin demuxer.
remuxerDestination remuxer.
Returns
remuxer.

◆ operator>>() [5/9]

Encoder & StormByte::Multimedia::Pipeline::operator>> ( Encoder & encoder,
Muxer & muxer )
noexcept

Reserves encoder as an output track of muxer.

Parameters
encoderLive encoder.
muxerDestination.
Returns
encoder.

◆ operator>>() [6/9]

Muxer & StormByte::Multimedia::Pipeline::operator>> ( Muxer & muxer,
const std::filesystem::path & path )
noexcept

Binds the output path of muxer.

Parameters
muxerMuxer.
pathDestination file.
Returns
muxer.

◆ operator>>() [7/9]

Demuxer & StormByte::Multimedia::Pipeline::operator>> ( Plan && plan,
Demuxer & demuxer )
noexcept

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>>() [8/9]

Remuxer & StormByte::Multimedia::Pipeline::operator>> ( Remuxer & remuxer,
Muxer & muxer )
noexcept

Reserves remuxer as an output track of muxer.

Parameters
remuxerLive remuxer.
muxerDestination.
Returns
remuxer.

◆ operator>>() [9/9]

class Step & StormByte::Multimedia::Pipeline::operator>> ( Step & from,
Step & to )
noexcept

Shares Plan and binds every output hopper of from onto to.

Demuxer fan-out is not this operator. A demuxer binds one origin index at a time from the leaf operator>>.

Does not bind the analytics tap.

Parameters
fromProducer step.
toConsumer step.
Returns
to.

◆ ToString() [1/2]

const char * StormByte::Multimedia::Pipeline::ToString ( Kind kind)
constexprnoexcept

Converts a single Kind flag to a string literal.

Parameters
kindValue to convert.
Returns
"Frame", "Packet", or "Invalid" for a mask or zero.

◆ ToString() [2/2]

const char * StormByte::Multimedia::Pipeline::ToString ( Producer producer)
constexprnoexcept

Converts a Producer to a string literal.

Parameters
producerValue to convert.
Returns
Null-terminated name, or "Invalid".

Variable Documentation

◆ Heuristics

const DecoderFlags StormByte::Multimedia::Pipeline::Heuristics {DecoderFlag::HeuristicsHDR10}
inline

All current heuristic bits.