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>
impl CompressedFrame<VideoPacketFormat>
Sourcepub fn new(
format: VideoPacketFormat,
bytes: Vec<u8>,
) -> Result<Self, Rejected<Vec<u8>>>
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>
impl CompressedFrame<AudioPacketFormat>
Sourcepub fn new(
format: AudioPacketFormat,
bytes: Vec<u8>,
) -> Result<Self, Rejected<Vec<u8>>>
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>
impl<F: PacketFormat> CompressedFrame<F>
Sourcepub fn timecode(&self) -> Timecode
pub fn timecode(&self) -> Timecode
The timecode: crate::Timecode::SYNTHESIZE on a frame built for
sending without an explicit timecode.
Sourcepub fn set_timecode(&mut self, timecode: Timecode)
pub fn set_timecode(&mut self, timecode: Timecode)
Replace the frame’s timecode.
Sourcepub fn metadata(&self) -> Option<&str>
pub fn metadata(&self) -> Option<&str>
The per-frame metadata, if any. Unreadable received text is omitted.
Sourcepub fn metadata_status(&self) -> FrameMetadataStatus
pub fn metadata_status(&self) -> FrameMetadataStatus
Cached metadata presence or the reason unreadable text was withheld.
Sourcepub fn set_metadata(
&mut self,
metadata: impl Into<String>,
) -> Result<(), Rejected<String>>
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.
Sourcepub fn clear_metadata(&mut self)
pub fn clear_metadata(&mut self)
Remove the frame metadata.
Sourcepub fn timestamp(&self) -> Option<ReceivedTimestamp>
pub fn timestamp(&self) -> Option<ReceivedTimestamp>
Source-dependent timestamp preserved when relaying a received frame.
Sourcepub fn envelope(&self) -> Option<PacketEnvelope<'_>>
pub fn envelope(&self) -> Option<PacketEnvelope<'_>>
The validated envelope, if the codec uses one.