pub struct ModEx {
pub mod_ex_type: u8,
pub data: Vec<u8>,
}Expand description
One entry in the Enhanced RTMP v2 ModEx prelude chain
(enhanced-rtmp-v2.pdf §“ExVideoTagHeader” / §“ExAudioTagHeader”).
On the wire each entry is modExDataSize (1-byte UI8 + 1, or a
16-bit UI16 + 1 escape when the 8-bit form would be 256),
followed by modExDataSize bytes of modExData, then a single
byte whose high nibble is the mod_ex_type
(UB[4]) and whose low nibble is the next PacketType (UB[4]).
The decoded struct keeps only the per-entry payload; the trailing
nibble byte is reconstructed from the chain order + the tag’s real
packet type when re-encoding.
Fields§
§mod_ex_type: u8AudioPacketModExType / VideoPacketModExType — the high
nibble of the byte that follows the data. One of
MOD_EX_TYPE_* (only TimestampOffsetNano = 0 defined today).
data: Vec<u8>Raw modExData bytes (1..=65536 bytes). For
TimestampOffsetNano this is at least 3 bytes whose first
three big-endian bytes are the UI24 nanosecond offset.
Implementations§
Source§impl ModEx
impl ModEx
Sourcepub fn timestamp_offset_nano(&self) -> Option<u32>
pub fn timestamp_offset_nano(&self) -> Option<u32>
Decode the TimestampOffsetNano value (bytesToUI24 of the
first three data bytes) when this entry is that subtype.
Returns None for any other mod_ex_type or if data is
shorter than the spec-mandated three bytes.
Sourcepub fn timestamp_offset_nano_entry(nano: u32) -> ModEx
pub fn timestamp_offset_nano_entry(nano: u32) -> ModEx
Build a TimestampOffsetNano ModEx entry from a nanosecond
offset (0..=999_999 ns per spec) encoded as a bytesToUI24
3-byte big-endian payload.