Template Function spdl::core::serialize_packets

Function Documentation

template<MediaType media>
std::vector<uint8_t> spdl::core::serialize_packets(const Packets<media> &packets)

Serialize Packets to a byte vector for IPC (e.g., multiprocessing).

NOTE: This byte format is internal and process-local. It is only ever produced and consumed by the same build (e.g. an iterate_in_subprocess worker and its parent), and is not stable for on-disk persistence or cross-version exchange. The layout may change without a version bump; the embedded magic/version bytes are an internal sanity check, not a compatibility contract. Each packet payload is written followed by AV_INPUT_BUFFER_PADDING_SIZE zeroed bytes so it can be restored as a zero-copy view (see deserialize_packets_view).

Throws std::runtime_error if any non-serializable pointer field (AVPacket::opaque, AVPacket::opaque_ref) is non-NULL.

Template Parameters:

media – Media type (Audio, Video, or Image).

Parameters:

packetsPackets to serialize.

Returns:

Serialized byte vector.