pub trait WindowsCaptureHandler: Sized {
    type Flags;

    // Required methods
    fn new(flags: Self::Flags) -> Result<Self, Box<dyn Error + Send + Sync>>;
    fn on_frame_arrived(
        &mut self,
        frame: Frame<'_>,
        capture_control: InternalCaptureControl
    ) -> Result<(), Box<dyn Error + Send + Sync>>;
    fn on_closed(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>;

    // Provided methods
    fn start(
        settings: WindowsCaptureSettings<Self::Flags>
    ) -> Result<(), Box<dyn Error + Send + Sync>>
       where Self: Send + 'static,
             <Self as WindowsCaptureHandler>::Flags: Send { ... }
    fn start_free_threaded(
        settings: WindowsCaptureSettings<Self::Flags>
    ) -> CaptureControl
       where Self: Send + 'static,
             <Self as WindowsCaptureHandler>::Flags: Send { ... }
    fn stop(&self) { ... }
}
Expand description

Event Handler Trait

Required Associated Types§

source

type Flags

To Get The Message From The Settings

Required Methods§

source

fn new(flags: Self::Flags) -> Result<Self, Box<dyn Error + Send + Sync>>

Function That Will Be Called To Create The Struct The Flags Can Be Passed From Settings

source

fn on_frame_arrived( &mut self, frame: Frame<'_>, capture_control: InternalCaptureControl ) -> Result<(), Box<dyn Error + Send + Sync>>

Called Every Time A New Frame Is Available

source

fn on_closed(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>

Called When The Capture Item Closes Usually When The Window Closes, Capture Session Will End After This Function Ends

Provided Methods§

source

fn start( settings: WindowsCaptureSettings<Self::Flags> ) -> Result<(), Box<dyn Error + Send + Sync>>where Self: Send + 'static, <Self as WindowsCaptureHandler>::Flags: Send,

Starts The Capture And Takes Control Of The Current Thread

source

fn start_free_threaded( settings: WindowsCaptureSettings<Self::Flags> ) -> CaptureControlwhere Self: Send + 'static, <Self as WindowsCaptureHandler>::Flags: Send,

Starts The Capture Without Taking Control Of The Current Thread

source

fn stop(&self)

Call To Stop The Capture Thread, You Might Receive A Few More Frames Before It Stops

Object Safety§

This trait is not object safe.

Implementors§