#[non_exhaustive]pub struct VideoTagHeader<'a> {
pub frame_type: FrameType,
pub codec_id: CodecId,
pub avc_packet_type: Option<AvcPacketType>,
pub composition_time: Option<i32>,
pub data: &'a [u8],
}Expand description
The VideoTagHeader (§E.4.3) and, for the codecs that carry one, the
packet header of its VIDEODATA body.
AVCVIDEOPACKET (§E.4.3.2) is the only packet layout this crate decodes;
any other CodecID keeps all the bytes after the first byte as
data, because no packet header of that codec is modelled
here.
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.frame_type: FrameTypeFrameType (§E.4.3).
codec_id: CodecIdCodecID (§E.4.3).
avc_packet_type: Option<AvcPacketType>AVCPacketType: set only for CodecId::Avc (§E.4.3.2).
composition_time: Option<i32>CompositionTime, in milliseconds: set only for CodecId::Avc
(§E.4.3.2). PTS = DTS + CompositionTime.
data: &'a [u8]The coded bytes after the packet header.
Implementations§
Source§impl<'a> VideoTagHeader<'a>
impl<'a> VideoTagHeader<'a>
Sourcepub fn new(
frame_type: FrameType,
codec_id: CodecId,
avc_packet_type: Option<AvcPacketType>,
composition_time: Option<i32>,
) -> Self
pub fn new( frame_type: FrameType, codec_id: CodecId, avc_packet_type: Option<AvcPacketType>, composition_time: Option<i32>, ) -> Self
The header a publisher sent with no coded data.
Sourcepub fn has_stray_composition_time(&self) -> bool
pub fn has_stray_composition_time(&self) -> bool
Whether a CompositionTime was stated for a codec that carries none
(a VideoTagHeader from Self::parse never does).
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, RtmpError>
pub fn to_bytes(&self) -> Result<Vec<u8>, RtmpError>
The header’s own bytes plus data, the whole VIDEODATA body.
§Errors
RtmpError::FieldOverflow when a CompositionTime does not fit the
signed 24-bit field, and RtmpError::Malformed when one is stated for
a codec that carries none.
Trait Implementations§
Source§impl<'a> Clone for VideoTagHeader<'a>
impl<'a> Clone for VideoTagHeader<'a>
impl<'a> Copy for VideoTagHeader<'a>
Source§impl Debug for VideoTagHeader<'_>
impl Debug for VideoTagHeader<'_>
Source§impl<'de: 'a, 'a> Deserialize<'de> for VideoTagHeader<'a>
Available on crate feature serde only.
impl<'de: 'a, 'a> Deserialize<'de> for VideoTagHeader<'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 VideoTagHeader<'a>
Source§impl<'a> Parse<'a> for VideoTagHeader<'a>
impl<'a> Parse<'a> for VideoTagHeader<'a>
Source§impl<'a> PartialEq for VideoTagHeader<'a>
impl<'a> PartialEq for VideoTagHeader<'a>
Source§impl<'a> Serialize for VideoTagHeader<'a>
Available on crate feature serde only.
impl<'a> Serialize for VideoTagHeader<'a>
serde only.Source§impl Serialize for VideoTagHeader<'_>
impl Serialize for VideoTagHeader<'_>
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, Self::Error>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Self::Error>
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).