pub struct MediaFrame { /* private fields */ }Expand description
A an abstraction of a media frame owning an internal buffer. Can optionally have meta data (e.g. a header) associated to it.
Implementations§
Source§impl MediaFrame
impl MediaFrame
Sourcepub fn new<P>(frame_counter: &mut impl FrameCounter, payload: P) -> Self
pub fn new<P>(frame_counter: &mut impl FrameCounter, payload: P) -> Self
Creates a new media frame by copying the data of a payload buffer and assigning it the given frame count.
Sourcepub fn with_meta_data<P, M>(
frame_counter: &mut impl FrameCounter,
payload: P,
meta_data: M,
) -> Self
pub fn with_meta_data<P, M>( frame_counter: &mut impl FrameCounter, payload: P, meta_data: M, ) -> Self
Creates a new media frame and assigns it the given frame count. Payload and meta data are copied into an internal buffer.
Sourcepub fn counter(&self) -> Counter
pub fn counter(&self) -> Counter
Frame count for the Sframe scheme associated to this media frame
Sourcepub fn encrypt<A, D>(&self, key: &EncryptionKey<A, D>) -> Result<EncryptedFrame>
pub fn encrypt<A, D>(&self, key: &EncryptionKey<A, D>) -> Result<EncryptedFrame>
Encrypts the media frame with the sframe key according to RFC 9605 4.4.3.
Dynamically allocates memory for the resulting EncryptedFrame.
The associated meta data is not encrypted but considered for the authentication tag.
Returns an crate::error::SframeError when encryption fails
Sourcepub fn encrypt_into<'obuf, A, D>(
&self,
key: &EncryptionKey<A, D>,
buffer: &'obuf mut impl FrameBuffer,
) -> Result<EncryptedFrameView<'obuf>>
pub fn encrypt_into<'obuf, A, D>( &self, key: &EncryptionKey<A, D>, buffer: &'obuf mut impl FrameBuffer, ) -> Result<EncryptedFrameView<'obuf>>
Encrypts the media frame with the sframe key according to RFC 9605 4.4.3
and stores the result into the provided buffer. An EncryptedFrameView on the buffer is returned on success.
The associated meta data is not encrypted but considered for the authentication tag.
Returns an crate::error::SframeError when encryption fails.
Trait Implementations§
Source§impl AsRef<[u8]> for MediaFrame
impl AsRef<[u8]> for MediaFrame
Source§impl Clone for MediaFrame
impl Clone for MediaFrame
Source§fn clone(&self) -> MediaFrame
fn clone(&self) -> MediaFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more