pub struct Encoder { /* private fields */ }Expand description
H.264 encoder. Build one with Encoder::new, feed it raw RGBA frames
via encode_rgba, and publish the resulting Annex-B
packets through Producer.
Implementations§
Source§impl Encoder
impl Encoder
pub fn new(config: &Config) -> Result<Self, Error>
Sourcepub fn encode_rgba(
&mut self,
rgba: &[u8],
width: u32,
height: u32,
keyframe: bool,
) -> Result<Vec<Bytes>, Error>
pub fn encode_rgba( &mut self, rgba: &[u8], width: u32, height: u32, keyframe: bool, ) -> Result<Vec<Bytes>, Error>
Encode one tightly-packed RGBA frame (width * height * 4 bytes),
returning zero or more Annex-B H.264 packets. Set keyframe to force an
IDR (e.g. on resume so a re-subscribing viewer can start decoding at
once). The frame is scaled/converted to the encoder’s resolution.
Auto Trait Implementations§
impl !RefUnwindSafe for Encoder
impl !Send for Encoder
impl !Sync for Encoder
impl !UnwindSafe for Encoder
impl Freeze for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more