Template Struct Packets¶
Defined in File packets.h
Struct Documentation¶
-
template<MediaType media>
struct Packets¶ Media packets template forward declaration.
Compressed media packets with metadata.
Packets structure carries compressed packets from demuxer to decoder, along with codec information and timing metadata. Similar to Frames, AVPacket pointers are managed for bulk resource release.
- Template Parameters:
media – Media type (Audio, Video, or Image).
Public Functions
-
Packets() = default¶
Default constructor.
-
Packets(const std::string &src, int index, Codec<media> &&codec, const std::optional<TimeWindow> ×tamp = {})¶
Construct packets from demuxer for one-time decoding.
Includes codec information needed to initialize the decoder.
- Parameters:
src – Source URI.
index – Stream index.
codec – Codec information.
timestamp – Optional time window user specified.
-
Packets(const std::string &src, int index, const Rational &time_base, const std::optional<TimeWindow> ×tamp = {})¶
Construct packets from demuxer for streaming.
Decoder is initialized separately, so codec is not needed here.
- Parameters:
src – Source URI.
index – Stream index.
time_base – Time base for timestamps.
timestamp – Optional time window user specified.
-
Packets(uintptr_t id, int stream_index, Rational time_base)¶
Construct packets from encoder for muxing.
- Parameters:
id – Trace ID.
stream_index – Output stream index.
time_base – Time base for timestamps.
-
~Packets() = default¶
Destructor.
Public Members
-
uintptr_t id = {}¶
Trace ID for debugging.
-
std::string src¶
Source URI or identifier.
-
int stream_index¶
Stream index in the source.
-
PacketSeries pkts¶
Series of compressed packets.
-
std::optional<TimeWindow> timestamp¶
Optional time window specified by user.
-
std::optional<Codec<media>> codec¶
Codec information for decoding. Available when packets are demuxed by demux_window method. For streaming demuxing, codec must be fetched from demuxer directly.
-
bool is_view = {false}¶
When true, the AVPacket payloads are non-owning views into external memory (e.g. a shared-memory segment), built by
deserialize_packets_view. The caller guarantees that backing memory outlives this object — analogous tostd::string_view. Cloning or re-serializing a view materializes an owning copy (FFmpeg copies whenAVPacket::buf == NULL), so derived objects are safe to outlive the backing memory.