Skip to main content

VideoTagHeader

Struct VideoTagHeader 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§frame_type: FrameType

FrameType (§E.4.3).

§codec_id: CodecId

CodecID (§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>

Source

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.

Source

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).

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for VideoTagHeader<'a>

Source§

impl Debug for VideoTagHeader<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de: 'a, 'a> Deserialize<'de> for VideoTagHeader<'a>

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> Eq for VideoTagHeader<'a>

Source§

impl<'a> Parse<'a> for VideoTagHeader<'a>

Source§

type Error = RtmpError

The error type this implementer returns. Typically the enclosing crate’s Error enum.
Source§

fn parse(bytes: &'a [u8]) -> Result<Self, RtmpError>

Parse bytes as Self. Returns Err(Self::Error) on any protocol violation or buffer underrun. Read more
Source§

impl<'a> PartialEq for VideoTagHeader<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> Serialize for VideoTagHeader<'a>

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Serialize for VideoTagHeader<'_>

Source§

type Error = RtmpError

The error type this implementer returns (usually the same as the corresponding Parse impl, but need not be).
Source§

fn serialized_len(&self) -> usize

Number of bytes serialize_into will write.
Source§

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Self::Error>

Write the serialised form into buf. Returns the number of bytes written (always equal to serialized_len()).
Source§

fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>

Allocate a 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).
Source§

fn serialize_append(&self, out: &mut Vec<u8>) -> Result<usize, Self::Error>

Append the serialised form to out, returning the number of bytes appended. out is left unchanged when the serializer fails.
Source§

impl<'a> StructuralPartialEq for VideoTagHeader<'a>

Auto Trait Implementations§

§

impl<'a> Forget for VideoTagHeader<'a>

§

impl<'a> Freeze for VideoTagHeader<'a>
where &'a [u8]: Freeze,

§

impl<'a> Move for VideoTagHeader<'a>

§

impl<'a> RefUnwindSafe for VideoTagHeader<'a>

§

impl<'a> Send for VideoTagHeader<'a>
where &'a [u8]: Send,

§

impl<'a> Sync for VideoTagHeader<'a>

§

impl<'a> Unpin for VideoTagHeader<'a>
where &'a [u8]: Unpin,

§

impl<'a> UnsafeUnpin for VideoTagHeader<'a>
where &'a [u8]: UnsafeUnpin,

§

impl<'a> UnwindSafe for VideoTagHeader<'a>
where &'a [u8]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.