Skip to main content

CompressedFrame

Struct CompressedFrame 

Source
pub struct CompressedFrame<F: PacketFormat> { /* private fields */ }
Expand description

One owned compressed frame that has been admitted for sending.

Construction checks packet bounds and, where present, the envelope’s codec fields. The application supplies a decodable codec bitstream. The SDK can write to the bytes, so sending takes the frame exclusively or by value.

Implementations§

Source§

impl CompressedFrame<VideoPacketFormat>

Source

pub fn new( format: VideoPacketFormat, bytes: Vec<u8>, ) -> Result<Self, Rejected<Vec<u8>>>

Take ownership of one frame’s bytes: a packet envelope for H.264 and HEVC (see PacketEnvelope::encode), a SpeedHQ frame otherwise.

§Errors

Returns the bytes with Error::InvalidFrame if their extent or envelope is invalid, or for a frame the SDK does not deliver (see VideoCodec).

Source§

impl CompressedFrame<AudioPacketFormat>

Source

pub fn new( format: AudioPacketFormat, bytes: Vec<u8>, ) -> Result<Self, Rejected<Vec<u8>>>

Take ownership of one audio frame’s bytes: a packet envelope for AAC (see PacketEnvelope::encode), one bare packet for Opus.

§Errors

Returns the bytes with Error::InvalidFrame if their extent is invalid, the delivery parameters are unsupported (see AudioCodec), or the AAC envelope is malformed or disagrees with those parameters.

Source§

impl<F: PacketFormat> CompressedFrame<F>

Source

pub fn timecode(&self) -> Timecode

The timecode: crate::Timecode::SYNTHESIZE on a frame built for sending without an explicit timecode.

Source

pub fn set_timecode(&mut self, timecode: Timecode)

Replace the frame’s timecode.

Source

pub fn metadata(&self) -> Option<&str>

The per-frame metadata, if any. Unreadable received text is omitted.

Source

pub fn metadata_status(&self) -> FrameMetadataStatus

Cached metadata presence or the reason unreadable text was withheld.

Source

pub fn set_metadata( &mut self, metadata: impl Into<String>, ) -> Result<(), Rejected<String>>

Replace frame metadata. Use Self::clear_metadata to remove it.

Invalid replacement text leaves the existing metadata unchanged.

§Errors

Returns the unchanged text in crate::Rejected, with crate::Error::InvalidCString for an interior NUL, or crate::Error::InvalidFrame when the emitted C string would exceed the metadata size cap. NulError retains only the prefix through the first NUL; crate::Rejected::into_inner returns all text.

Source

pub fn clear_metadata(&mut self)

Remove the frame metadata.

Source

pub fn data(&self) -> &[u8] ⓘ

The codec bytes.

Source

pub fn format(&self) -> F

The packet’s codec and media format.

Source

pub fn timestamp(&self) -> Option<ReceivedTimestamp>

Source-dependent timestamp preserved when relaying a received frame.

Source

pub fn envelope(&self) -> Option<PacketEnvelope<'_>>

The validated envelope, if the codec uses one.

Source

pub fn into_data(self) -> Vec<u8> ⓘ

Take the codec bytes, retaining the original allocation and capacity.

Trait Implementations§

Source§

impl<F: Clone + PacketFormat> Clone for CompressedFrame<F>

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<F: PacketFormat> Debug for CompressedFrame<F>

Source§

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

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

impl<F: PacketFormat> From<CompressedFrame<F>> for ReceivedPacket<F>

Source§

fn from(frame: CompressedFrame<F>) -> Self

Converts to this type from the input type.
Source§

impl From<CompressedFrame<VideoPacketFormat>> for QueuedVideoFrame

Source§

fn from(v: CompressedFrame<VideoPacketFormat>) -> Self

Converts to this type from the input type.
Source§

impl<F: PacketFormat> TryFrom<&CompressedRef<'_, F>> for CompressedFrame<F>

Source§

type Error = Error

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

fn try_from(packet: &CompressedRef<'_, F>) -> Result<Self>

Performs the conversion.
Source§

impl<F: PacketFormat> TryFrom<ReceivedPacket<F>> for CompressedFrame<F>

Source§

type Error = Rejected<ReceivedPacket<F>>

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

fn try_from(packet: ReceivedPacket<F>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<F> Freeze for CompressedFrame<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for CompressedFrame<F>
where F: RefUnwindSafe,

§

impl<F> Send for CompressedFrame<F>

§

impl<F> Sync for CompressedFrame<F>

§

impl<F> Unpin for CompressedFrame<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for CompressedFrame<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for CompressedFrame<F>
where F: 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> 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.