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§
Sourcefn formats(&self) -> Vec<CameraFormat>
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.
Sourcefn start(
&self,
format: &CameraFormat,
outputs: CameraOutputs,
) -> CameraStartFuture
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; on Android, which gives a camera one JPEG
stream, a session that joins takes photos at the size the first session set, or none where
it set none. It fails for what can happen at any time: the camera in use, unplugged, or not
allowed; for a format the camera does not list; and, with
CameraError::NotSupported, for outputs the system cannot feed, such as upright frames
on Android.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".