One compressed access unit. More...
#include <StormByte/multimedia/pipeline/packet.hxx>


Public Types | |
| using | PointerType = StormByte::Safe::Shared<Packet> |
| Base-heap shared owner of a packet; keep its providers loaded. | |
Public Member Functions | |
Construction | |
| Packet () | |
| Empty packet (no payload, track -1, type Unknown). | |
| Packet (int track, enum Type type, enum Producer producer, StormByte::Buffer::FIFO payload, StormByte::Safe::Optional< Property::Duration > pts, StormByte::Safe::Optional< Property::Duration > dts, StormByte::Safe::Optional< Property::Duration > duration, bool key_frame, StormByte::Safe::Vector< SideData > attachments, const StormByte::Multimedia::Codec *codec, std::uint64_t serial, std::uint64_t part) | |
| Builds a packet. | |
| Packet (const Packet &other) | |
| Copy. | |
| Packet (Packet &&other) noexcept | |
| Move constructor. | |
| ~Packet () noexcept override | |
| Destructor. | |
| Packet & | operator= (const Packet &other) |
| Copy assignment. | |
| Packet & | operator= (Packet &&other) noexcept |
| Move assignment. | |
Timing | |
| const StormByte::Safe::Optional< Property::Duration > & | Pts () const noexcept |
| Presentation timestamp on the stream clock. | |
| const StormByte::Safe::Optional< Property::Duration > & | Dts () const noexcept |
| Decode timestamp on the stream clock. | |
| const StormByte::Safe::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 StormByte::Safe::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::Codec * | Codec () 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). | |
| StormByte::ByteSize | BufferingWeight () const noexcept |
| Estimates the compressed payload weight for queue accounting. | |
| const StormByte::Safe::Vector< SideData > & | Attachments () const noexcept |
| Side-data blobs bound to this access unit. | |
| StormByte::Safe::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 |
| Allows the backend holder to access the packet's media storage. | |
| class | Decoder |
| Allows the decoder to access the compressed backend packet. | |
| class | Demuxer |
| Allows the demuxer to populate compressed media and metadata. | |
| class | Encoder |
| Allows the encoder to populate encoded media and metadata. | |
| class | Filter::FFmpeg |
| Allows FFmpeg filters to update compressed media and metadata. | |
| class | Muxer |
| Allows the muxer to access the compressed backend packet. | |
| class | Remuxer |
Additional Inherited Members | |
| Protected Types inherited from StormByte::Safe::Clonable< Item > | |
| typedef SmartPointer | PointerType |
| Item (const Item &other) noexcept=default | |
| Copy constructor. | |
| Item (Item &&other) noexcept=default | |
| Move constructor. | |
| Item & | operator= (const Item &other) noexcept=default |
| Copy assignment. | |
| Item & | operator= (Item &&other) noexcept=default |
| Move assignment. | |
| Protected Member Functions inherited from StormByte::Safe::Clonable< Item > | |
| constexpr | Clonable ()=default |
| constexpr Clonable & | operator= (const Clonable &)=default |
| virtual constexpr | ~Clonable () noexcept=default |
| Static Protected Member Functions inherited from StormByte::Safe::Clonable< Item > | |
| static PointerType | MakePointer (Args &&... args) |
One compressed access unit.
Compressed bytes for one picture, audio block or subtitle event. Packet filters, Remuxer and Muxer can inspect the origin track, timestamps, payload, side data and the Registry StormByte::Multimedia::Codec of that AU. The Packet does not open a codec.
Copies and Clone share media buffers rather than duplicating compressed bytes. Metadata accessors borrow their wrappers until this packet is modified or destroyed. Safe optional arrow access returns a read-only snapshot for the current full expression. Mutable collection access uses write-back proxies.
Base-heap shared owner of a packet; keep its providers loaded.
Empty packet (no payload, track -1, type Unknown).
| StormByte::Exception | If safe metadata storage cannot be allocated. |
| StormByte::Multimedia::Pipeline::Packet::Packet | ( | int | track, |
| enum Type | type, | ||
| enum Producer | producer, | ||
| StormByte::Buffer::FIFO | payload, | ||
| StormByte::Safe::Optional< Property::Duration > | pts, | ||
| StormByte::Safe::Optional< Property::Duration > | dts, | ||
| StormByte::Safe::Optional< Property::Duration > | duration, | ||
| bool | key_frame, | ||
| StormByte::Safe::Vector< SideData > | attachments, | ||
| const StormByte::Multimedia::Codec * | codec, | ||
| std::uint64_t | serial, | ||
| std::uint64_t | part ) |
Builds a packet.
| track | Origin container stream index. |
| type | Media of this access unit. |
| producer | Step that created this unit. |
| payload | Owned compressed bytes. |
| pts | Presentation timestamp, if known. |
| dts | Decode timestamp, if known. |
| duration | Packet duration, if known. |
| key_frame | Whether this is a key frame. |
| attachments | Side-data blobs that must reach the muxer. |
| codec | Registry codec of this AU, or nullptr. |
| serial | Lineage id born at the demuxer for this origin track. |
| part | Sub-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.
| StormByte::Exception | If safe lineage storage cannot be allocated. |
| StormByte::Multimedia::Pipeline::Packet::Packet | ( | const Packet & | other | ) |
Copy.
Metadata and FIFO handle are copied; the libav packet is referenced (av_packet_ref).
| other | Source packet. |
Not a deep copy of compressed bytes. Clone uses this constructor.
| StormByte::Exception | If safe metadata storage cannot be copied. |
| std::bad_alloc | If the private backend holder cannot be allocated. |
|
noexcept |
|
overridenoexcept |
Destructor.
|
inlinenoexcept |
Side-data blobs bound to this access unit.
|
inlinenoexcept |
Side-data blobs bound to this access unit (mutable).
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Decode timestamp on the stream clock.
|
inlinenoexcept |
Packet duration on the stream clock.
|
inlinenoexcept |
Whether this is a key frame / key packet.
Copy assignment.
Same as the copy constructor.
| other | Source packet. |
| StormByte::Exception | If safe metadata storage cannot be copied. |
| std::bad_alloc | If the private backend holder cannot be allocated. |
|
inlinenoexcept |
Sub-id inside Serial when one demuxed unit yields several frames.
Downstream stages copy this value. It is not a pipe-wide counter.
|
inlinenoexcept |
Owned compressed payload.
|
inlinenoexcept |
Owned compressed payload (mutable).
|
inlinenoexcept |
Presentation timestamp on the stream clock.
|
inlinenoexcept |
Monotonic lineage id assigned when the unit enters the pipe.
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.
|
friend |
Allows the backend holder to access the packet's media storage.
|
friend |
Allows the decoder to access the compressed backend packet.
|
friend |
Allows the demuxer to populate compressed media and metadata.
|
friend |
Allows the encoder to populate encoded media and metadata.
|
friend |
Allows FFmpeg filters to update compressed media and metadata.
|
friend |
Allows the muxer to access the compressed backend packet.
|
friend |