#[non_exhaustive]pub struct FlvHeader<'a> {
pub has_audio: bool,
pub has_video: bool,
pub data_offset: u32,
pub extra: &'a [u8],
}Expand description
The FLV file header (§E.2), including the PreviousTagSize0 that always
follows it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.has_audio: boolTypeFlags bit 0 (§E.2): the file carries audio tags.
has_video: boolTypeFlags bit 2 (§E.2): the file carries video tags.
data_offset: u32DataOffset as it was on the wire (§E.2): the first byte after the
header. FLV_DATA_OFFSET on every header this crate writes; an
input may declare a larger one (extra header bytes the caller skips),
and keeping it makes a parse/serialize round trip byte-exact.
extra: &'a [u8]The DataOffset - 9 extra header bytes between the fixed 9-byte
header and the PreviousTagSize0 that the parser skipped (§E.2).
Empty on every header this crate writes.
Implementations§
Source§impl<'a> FlvHeader<'a>
impl<'a> FlvHeader<'a>
Sourcepub fn new(has_audio: bool, has_video: bool) -> Self
pub fn new(has_audio: bool, has_video: bool) -> Self
A header declaring the given track kinds, with the standard
DataOffset.
Sourcepub fn type_flags(&self) -> u8
pub fn type_flags(&self) -> u8
The TypeFlags byte (§E.2) this header puts on the wire.
Sourcepub fn first_tag_offset(&self) -> usize
pub fn first_tag_offset(&self) -> usize
Offset of the first tag’s header: past the DataOffset the header
declares and its PreviousTagSize0 (§E.2). A DataOffset shorter
than the header itself is clamped to FLV_HEADER_LEN, since the
first tag cannot start inside the header.
Trait Implementations§
impl<'a> Copy for FlvHeader<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for FlvHeader<'a>
Available on crate feature serde only.
impl<'de: 'a, 'a> Deserialize<'de> for FlvHeader<'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 FlvHeader<'a>
Source§impl<'a> Serialize for FlvHeader<'a>
impl<'a> Serialize for FlvHeader<'a>
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).