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

source

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.

source

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.

source

pub fn send_frame( &mut self, frame: &mut Frame<'_> ) -> Result<(), VideoEncoderError>

Sends a video frame to the video encoder for encoding.

ยงArguments
  • frame - A mutable reference to the Frame to be encoded.
ยงReturns

Returns Ok(()) if the frame is successfully sent for encoding, or a VideoEncoderError if an error occurs.

source

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.

source

pub fn finish(self) -> Result<(), VideoEncoderError>

Finishes encoding the video and performs any necessary cleanup.

ยงReturns

Returns Ok(()) if the encoding is successfully finished, or a VideoEncoderError if an error occurs.

Trait Implementationsยง

sourceยง

impl Drop for VideoEncoder

sourceยง

fn drop(&mut self)

Executes the destructor for this type. Read more
sourceยง

impl Send for VideoEncoder

Auto Trait Implementationsยง

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> 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> IntoEither for T

sourceยง

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 more
sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
sourceยง

impl<T> Pointable for T

sourceยง

const ALIGN: usize = _

The alignment of pointer.
ยง

type Init = T

The type for initializers.
sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

ยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

ยง

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.