Struct windows_capture::encoder::VideoEncoder
source ยท pub struct VideoEncoder { /* private fields */ }Expand description
The VideoEncoder struct represents a video encoder that can be used to encode video frames and save them to a specified file path.
Implementationsยง
sourceยงimpl VideoEncoder
impl VideoEncoder
sourcepub fn new<P: AsRef<Path>>(
encoder_type: VideoEncoderType,
encoder_quality: VideoEncoderQuality,
width: u32,
height: u32,
path: P
) -> Result<Self, VideoEncoderError>
pub fn new<P: AsRef<Path>>( encoder_type: VideoEncoderType, encoder_quality: VideoEncoderQuality, width: u32, height: u32, path: P ) -> Result<Self, VideoEncoderError>
Creates a new VideoEncoder instance with the specified parameters.
ยงArguments
encoder_type- The type of video encoder to use.encoder_quality- The quality of the video encoder.width- The width of the video frames.height- The height of the video frames.path- The file path where the encoded video will be saved.
ยงReturns
Returns a Result containing the VideoEncoder instance if successful, or a
VideoEncoderError if an error occurs.
sourcepub fn new_from_stream<P: AsRef<Path>>(
encoder_type: VideoEncoderType,
encoder_quality: VideoEncoderQuality,
width: u32,
height: u32,
stream: IRandomAccessStream
) -> Result<Self, VideoEncoderError>
pub fn new_from_stream<P: AsRef<Path>>( encoder_type: VideoEncoderType, encoder_quality: VideoEncoderQuality, width: u32, height: u32, stream: IRandomAccessStream ) -> Result<Self, VideoEncoderError>
Creates a new VideoEncoder instance with the specified parameters.
ยงArguments
encoder_type- The type of video encoder to use.encoder_quality- The quality of the video encoder.width- The width of the video frames.height- The height of the video frames.stream- The stream where the encoded video will be saved.
ยงReturns
Returns a Result containing the VideoEncoder instance if successful, or a
VideoEncoderError if an error occurs.
sourcepub fn send_frame(
&mut self,
frame: &mut Frame<'_>
) -> Result<(), VideoEncoderError>
pub fn send_frame( &mut self, frame: &mut Frame<'_> ) -> Result<(), VideoEncoderError>
sourcepub fn send_frame_buffer(
&mut self,
buffer: &[u8],
timespan: i64
) -> Result<(), VideoEncoderError>
pub fn send_frame_buffer( &mut self, buffer: &[u8], timespan: i64 ) -> Result<(), VideoEncoderError>
Sends a video frame to the video encoder for encoding.
ยงArguments
buffer- A reference to the byte slice to be encoded Windows API expect this to be Bgra and bottom-top.timespan- The timespan that correlates to the frame buffer.
ยงReturns
Returns Ok(()) if the frame is successfully sent for encoding, or a VideoEncoderError
if an error occurs.
Trait Implementationsยง
sourceยงimpl Drop for VideoEncoder
impl Drop for VideoEncoder
impl Send for VideoEncoder
Auto Trait Implementationsยง
impl Freeze for VideoEncoder
impl !RefUnwindSafe for VideoEncoder
impl Sync for VideoEncoder
impl Unpin for VideoEncoder
impl !UnwindSafe for VideoEncoder
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
sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more