Skip to main content

CameraDevice

Trait CameraDevice 

Source
pub trait CameraDevice {
    // Required methods
    fn formats(&self) -> Vec<CameraFormat>;
    fn start(
        &self,
        format: &CameraFormat,
        outputs: CameraOutputs,
    ) -> CameraStartFuture;
}
Expand description

A camera the app opened, controlled on the app’s main thread: Camera2’s CameraDevice. A session started on it runs on after it is dropped.

Required Methods§

Source

fn formats(&self) -> Vec<CameraFormat>

The formats the camera runs in, in the system’s order, each with all its outputs: Apple’s AVCaptureDevice.formats, Android’s stream configuration map.

Source

fn start( &self, format: &CameraFormat, outputs: CameraOutputs, ) -> CameraStartFuture

Starts the camera in format, one of formats, feeding outputs, which the system configures together, and answers the session once it runs, or is interrupted, from which it resumes by itself. Where the camera already runs for another session and the system runs a camera in one format at a time, the session joins that format instead, and its format says so. It fails for what can happen at any time: the camera in use, unplugged, or not allowed; and for a format the camera does not list.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§