Skip to main content

GraphicsCaptureApiHandler

Trait GraphicsCaptureApiHandler 

Source
pub trait GraphicsCaptureApiHandler: Sized {
    type Flags;
    type Error: Send + Sync;

    // Required methods
    fn new(ctx: Context<Self::Flags>) -> Result<Self, Self::Error>;
    fn on_frame_arrived(
        &mut self,
        frame: &mut Frame<'_>,
        capture_control: InternalCaptureControl,
    ) -> Result<(), Self::Error>;

    // Provided methods
    fn start<T: TryInto<GraphicsCaptureItemType>>(
        settings: Settings<Self::Flags, T>,
    ) -> Result<(), GraphicsCaptureApiError<Self::Error>>
       where Self: Send + 'static,
             <Self as GraphicsCaptureApiHandler>::Flags: Send { ... }
    fn start_free_threaded<T: TryInto<GraphicsCaptureItemType> + Send + 'static>(
        settings: Settings<Self::Flags, T>,
    ) -> Result<CaptureControl<Self, Self::Error>, GraphicsCaptureApiError<Self::Error>>
       where Self: Send + 'static,
             <Self as GraphicsCaptureApiHandler>::Flags: Send { ... }
    fn on_closed(&mut self) -> Result<(), Self::Error> { ... }
}
Expand description

Trait implemented by types that handle graphics capture events.

Required Associated Types§

Source

type Flags

The type of flags used to get the values from the settings.

Source

type Error: Send + Sync

The type of error that can occur during capture. The error will be returned from the CaptureControl and GraphicsCaptureApiHandler::start functions.

Required Methods§

Source

fn new(ctx: Context<Self::Flags>) -> Result<Self, Self::Error>

Function that will be called to create the struct. The flags can be passed from settings.

Source

fn on_frame_arrived( &mut self, frame: &mut Frame<'_>, capture_control: InternalCaptureControl, ) -> Result<(), Self::Error>

Called every time a new frame is available.

Provided Methods§

Source

fn start<T: TryInto<GraphicsCaptureItemType>>( settings: Settings<Self::Flags, T>, ) -> Result<(), GraphicsCaptureApiError<Self::Error>>
where Self: Send + 'static, <Self as GraphicsCaptureApiHandler>::Flags: Send,

Starts the capture and takes control of the current thread.

Source

fn start_free_threaded<T: TryInto<GraphicsCaptureItemType> + Send + 'static>( settings: Settings<Self::Flags, T>, ) -> Result<CaptureControl<Self, Self::Error>, GraphicsCaptureApiError<Self::Error>>
where Self: Send + 'static, <Self as GraphicsCaptureApiHandler>::Flags: Send,

Starts the capture without taking control of the current thread.

Source

fn on_closed(&mut self) -> Result<(), Self::Error>

Optional handler called when the capture item (usually a window) closes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§