StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
Public Types | Friends | List of all members
StormByte::Multimedia::Pipeline::Packet Class Reference

One compressed access unit. More...

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

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

Public Types

using PointerType = std::shared_ptr< Packet >
 

Public Member Functions

Timing
const std::optional< Property::Duration > & Pts () const noexcept
 Presentation timestamp on the stream clock.
 
const std::optional< Property::Duration > & Dts () const noexcept
 Decode timestamp on the stream clock.
 
const std::optional< Property::Duration > & Duration () const noexcept
 Packet duration on the stream clock.
 
bool KeyFrame () const noexcept
 Whether this is a key frame / key packet.
 
Lineage
const std::optional< std::uint64_t > & Serial () const noexcept
 Monotonic lineage id assigned when the unit enters the pipe.
 
std::uint64_t Part () const noexcept
 Sub-id inside Serial when one demuxed unit yields several frames.
 
Codec
const StormByte::Multimedia::CodecCodec () const noexcept
 Registry codec of this access unit.
 
Payload
const StormByte::Buffer::FIFO & Payload () const noexcept
 Owned compressed payload.
 
StormByte::Buffer::FIFO & Payload () noexcept
 Owned compressed payload (mutable).
 
const std::vector< SideData > & Attachments () const noexcept
 Side-data blobs bound to this access unit.
 
std::vector< SideData > & Attachments () noexcept
 Side-data blobs bound to this access unit (mutable).
 
- Public Member Functions inherited from StormByte::Multimedia::Pipeline::Item
Kind Kind () const noexcept
 Whether this unit is a frame or a packet.
 
enum StormByte::Multimedia::Type Type () const noexcept
 Media of this access unit.
 
int Track () const noexcept
 Origin track index.
 
enum Producer Producer () const noexcept
 Stage that created this unit.
 
virtual ~Item () noexcept=default
 Destructor.
 

Friends

class Backend::Pipeline::Packet
 
class Decoder
 
class Demuxer
 
class Encoder
 
class Filter::FFmpeg
 
class Muxer
 

Construction

 Packet () noexcept
 Empty packet (no payload, track -1, type Unknown).
 
 Packet (int track, enum Type type, enum Producer producer, StormByte::Buffer::FIFO payload, std::optional< Property::Duration > pts, std::optional< Property::Duration > dts, std::optional< Property::Duration > duration, bool key_frame, std::vector< SideData > attachments, const StormByte::Multimedia::Codec *codec, std::uint64_t serial, std::uint64_t part) noexcept
 Builds a packet.
 
 Packet (Packet &&other) noexcept
 Move constructor.
 
 ~Packet () noexcept override
 Destructor.
 
Packetoperator= (Packet &&other) noexcept
 Move assignment.
 

Additional Inherited Members

- Protected Member Functions inherited from StormByte::Multimedia::Pipeline::Item
 Item (const Item &other) noexcept=default
 Copy constructor.
 
 Item (Item &&other) noexcept=default
 Move constructor.
 
Itemoperator= (const Item &other) noexcept=default
 Copy assignment.
 
Itemoperator= (Item &&other) noexcept=default
 Move assignment.
 

Detailed Description

One compressed access unit.

In libav that is an AVPacket: compressed bytes for one picture, one audio block or one subtitle event. In Multimedia it is what packet filters, Remuxer and Muxer see — origin track, timestamps, payload, side data and the Registry StormByte::Multimedia::Codec of that AU. The Packet does not open a codec.

See also
Item
Frame

Member Typedef Documentation

◆ PointerType

Constructor & Destructor Documentation

◆ Packet() [1/3]

Empty packet (no payload, track -1, type Unknown).

◆ Packet() [2/3]

StormByte::Multimedia::Pipeline::Packet::Packet ( int  track,
enum Type  type,
enum Producer  producer,
StormByte::Buffer::FIFO  payload,
std::optional< Property::Duration pts,
std::optional< Property::Duration dts,
std::optional< Property::Duration duration,
bool  key_frame,
std::vector< SideData attachments,
const StormByte::Multimedia::Codec codec,
std::uint64_t  serial,
std::uint64_t  part 
)
noexcept

Builds a packet.

Parameters
trackOrigin container stream index.
typeMedia of this access unit.
producerStep that created this unit.
payloadOwned compressed bytes.
ptsPresentation timestamp, if known.
dtsDecode timestamp, if known.
durationPacket duration, if known.
key_frameWhether this is a key frame.
attachmentsSide-data blobs that must reach the muxer.
codecRegistry codec of this AU, or nullptr.
serialLineage id born at the demuxer for this origin track.
partSub-id inside serial. Zero when the demuxed unit did not split.

Encoder stamps the destination codec. Demuxer stamps the source stream codec. There is no public setter.

◆ Packet() [3/3]

Move constructor.

Parameters
otherPacket to take.

other becomes the empty sentinel.

◆ ~Packet()

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

Destructor.

Member Function Documentation

◆ Attachments() [1/2]

const std::vector< SideData > & StormByte::Multimedia::Pipeline::Packet::Attachments ( ) const
inlinenoexcept

Side-data blobs bound to this access unit.

Returns
Blobs (HdrPlus, captions, …). Empty when none.

◆ Attachments() [2/2]

std::vector< SideData > & StormByte::Multimedia::Pipeline::Packet::Attachments ( )
inlinenoexcept

Side-data blobs bound to this access unit (mutable).

Returns
Blobs.

◆ Codec()

const StormByte::Multimedia::Codec * StormByte::Multimedia::Pipeline::Packet::Codec ( ) const
inlinenoexcept

Registry codec of this access unit.

Returns
Pointer owned by Registry, or nullptr on the sentinel.

◆ Dts()

const std::optional< Property::Duration > & StormByte::Multimedia::Pipeline::Packet::Dts ( ) const
inlinenoexcept

Decode timestamp on the stream clock.

Returns
Dts, or empty.

◆ Duration()

const std::optional< Property::Duration > & StormByte::Multimedia::Pipeline::Packet::Duration ( ) const
inlinenoexcept

Packet duration on the stream clock.

Returns
Duration, or empty.

◆ KeyFrame()

bool StormByte::Multimedia::Pipeline::Packet::KeyFrame ( ) const
inlinenoexcept

Whether this is a key frame / key packet.

Returns
true if marked as a key frame.

◆ operator=()

Packet & StormByte::Multimedia::Pipeline::Packet::operator= ( Packet &&  other)
noexcept

Move assignment.

Parameters
otherPacket to take.
Returns
*this.

other becomes the empty sentinel.

◆ Part()

std::uint64_t StormByte::Multimedia::Pipeline::Packet::Part ( ) const
inlinenoexcept

Sub-id inside Serial when one demuxed unit yields several frames.

Returns
Zero when the unit did not split; 0, 1, … after a split.

Downstream stages copy this value. It is not a pipe-wide counter.

◆ Payload() [1/2]

const StormByte::Buffer::FIFO & StormByte::Multimedia::Pipeline::Packet::Payload ( ) const
inlinenoexcept

Owned compressed payload.

Returns
FIFO (not thread-safe).

◆ Payload() [2/2]

StormByte::Buffer::FIFO & StormByte::Multimedia::Pipeline::Packet::Payload ( )
inlinenoexcept

Owned compressed payload (mutable).

Returns
FIFO (not thread-safe).

◆ Pts()

const std::optional< Property::Duration > & StormByte::Multimedia::Pipeline::Packet::Pts ( ) const
inlinenoexcept

Presentation timestamp on the stream clock.

Returns
Pts, or empty.

◆ Serial()

const std::optional< std::uint64_t > & StormByte::Multimedia::Pipeline::Packet::Serial ( ) const
inlinenoexcept

Monotonic lineage id assigned when the unit enters the pipe.

Returns
Serial born at the demuxer for this origin track; empty on the sentinel.

This is not a decoded-frame count and not an FFmpeg nb_frames / nb_read_frames figure. It identifies one demuxed access unit as it travels Demuxer → … → Muxer. Downstream stages copy it. Part distinguishes several frames born from the same serial.

Friends And Related Symbol Documentation

◆ Backend::Pipeline::Packet

friend class Backend::Pipeline::Packet
friend

◆ Decoder

friend class Decoder
friend

◆ Demuxer

friend class Demuxer
friend

◆ Encoder

friend class Encoder
friend

◆ Filter::FFmpeg

friend class Filter::FFmpeg
friend

◆ Muxer

friend class Muxer
friend

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