pub struct FlvTag<'a> {
pub tag_type: TagType,
pub timestamp: u32,
pub stream_id: u32,
pub body: &'a [u8],
}Expand description
One FLV tag (§E.4.1): its header fields, body, and the PreviousTagSize
that follows it, so a single value is a self-contained slice of an FLV
stream.
Fields§
§tag_type: TagTypeTagType byte (§E.4.1).
timestamp: u32Millisecond timestamp: the UI24 Timestamp field plus the UI8
TimestampExtended as its top byte (§E.4.1).
stream_id: u32StreamID (§E.4.1), zero for every tag this crate writes.
body: &'a [u8]The tag’s Data bytes (DataSize long).
Implementations§
Source§impl<'a> FlvTag<'a>
impl<'a> FlvTag<'a>
Sourcepub fn new(tag_type: TagType, timestamp: u32, body: &'a [u8]) -> Self
pub fn new(tag_type: TagType, timestamp: u32, body: &'a [u8]) -> Self
A tag on the stream every FLV stream uses (StreamID 0).
Sourcepub fn previous_tag_size(&self) -> Result<u32, RtmpError>
pub fn previous_tag_size(&self) -> Result<u32, RtmpError>
The value of the PreviousTagSize field following this tag (§E.4.1):
the tag’s header and body, excluding that field itself.
Sourcepub fn data_size(bytes: &'a [u8]) -> Result<usize, RtmpError>
pub fn data_size(bytes: &'a [u8]) -> Result<usize, RtmpError>
The tag’s declared DataSize (§E.4.1), read from bytes’ first
FLV_TAG_HEADER_LEN bytes — how many body bytes the tag claims,
whether or not they have all arrived yet.
§Errors
RtmpError::BufferTooShort if bytes does not hold a full header.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for FlvTag<'a>
Available on crate feature serde only.
impl<'de: 'a, 'a> Deserialize<'de> for FlvTag<'a>
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<'a> Eq for FlvTag<'a>
Source§impl Serialize for FlvTag<'_>
impl Serialize for FlvTag<'_>
Source§type Error = RtmpError
type Error = RtmpError
Parse impl, but need not be).Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
serialize_into will write.Source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, RtmpError>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, RtmpError>
buf. Returns the number of bytes
written (always equal to serialized_len()).Source§fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>
fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>
Vec and serialize into it, returning the serializer’s error instead of
panicking. This is the only
allocate-and-serialize entry point: there is deliberately no panicking
to_bytes (hand-built values, or values assembled from damaged wire data,
can violate a wire constraint, so the error must reach the caller).