Expand description
Async cross-platform camera capture with owned sessions and immutable frames.
use camera::{CameraSystem, CaptureProfile, DeviceSelector};
let system=CameraSystem::new();
let mut capture=system.capture(DeviceSelector::Default)
.profile(CaptureProfile::Preview)
.resolution(1280,720)
.start().await?;
let frame=capture.next_frame().await?;
println!("{} native bytes, {:?}",frame.bytes().len(),frame.layout());
capture.close().await?;Modules§
- blocking
- Synchronous facade backed by one shared Tokio runtime.
Structs§
- AvFoundation
Options - Values for
AvFoundationOptions. - Backend
Attempt - One typed failure captured while evaluating a fallback backend policy.
- Backend
Device Info - Backend-neutral device metadata returned by a custom provider.
- Backend
Id - Stable identifier for a built-in or application-provided camera backend.
- Camera2
Options - Values for
Camera2Options. - Camera
Error - One public error type returned by every camera operation.
- Camera
System - Enumeration is isolated from the async executor. Explicit backend requests never fall back to another device namespace.
- Capture
- Values for
Capture. - Capture
Builder - Values for
CaptureBuilder. - Capture
Mode - Values for
CaptureMode. - Capture
Mode Range - Values for
CaptureModeRange. - Capture
Plan - Values for
CapturePlan. - Capture
Request - Values for
CaptureRequest. - Capture
Request Builder - Values for
CaptureRequestBuilder. - Captured
Frame - Cheaply shared immutable frame. RGB/native bytes never change while retained.
- Color
Info - Values for
ColorInfo. - Control
Descriptor - Capabilities and access rules for one camera control.
- Control
Outcome - Result of applying one item from a batch of control changes.
- Control
Range - Numeric limits and optional default for a camera control.
- Conversion
Capability - Values for
ConversionCapability. - Conversion
Request - Describes the RGB image a consumer actually needs.
- Device
Capabilities - Values for
DeviceCapabilities. - Device
Id - Backend-scoped device identity. Persistence preserves the backend namespace;
IdentityStabilitystill tells callers whether the native part is stable across enumeration cycles or process restarts. - Device
Info - Values for
DeviceInfo. - Device
Snapshot - Values for
DeviceSnapshot. - Device
Watcher - Values for
DeviceWatcher. - Dimension
Range - Values for
DimensionRange. - Event
Receiver - Values for
EventReceiver. - Frame
Interval - Values for
FrameInterval. - Frame
Interval Range - Values for
FrameIntervalRange. - Frame
Key - Values for
FrameKey. - Frame
Layout - Values for
FrameLayout. - Frame
Metrics - Values for
FrameMetrics. - Frame
Rate - Positive rational frame rate that preserves values such as 30_000/1_001.
- Frame
Receiver - Each receiver owns its cursor/queue. Dropping next() before it resolves does not consume a frame. Stop wakes all receivers with StreamStopped.
- Frame
Sink - Bounded frame destination supplied to an application-provided backend.
- Kelvin
- Validated white-balance temperature in kelvin.
- Memory
Budget - Values for
MemoryBudget. - Negotiated
Capture - Values for
NegotiatedCapture. - Orientation
- Values for
Orientation. - Plane
Layout - Values for
PlaneLayout. - Reconnect
Policy - Values for
ReconnectPolicy. - RgbConverter
- Values for
RgbConverter. - RgbView
- Values for
RgbView. - Source
Timestamp - Values for
SourceTimestamp. - State
Watcher - Values for
StateWatcher. - Stream
Stats - Stream statistics.
- Subscription
Options - Values for
SubscriptionOptions. - System
Builder - Configures backend selection, backend-specific options, and custom providers.
- UsbIdentity
- Values for
UsbIdentity. - V4l2
Options - Values for
V4l2Options. - Writable
Frame Lease - Writable storage borrowed directly from the framework’s bounded frame pool.
commitmakes it immutable and visible to subscribers; dropping it returns the slot to the pool without publishing.
Enums§
- Backend
Availability - Compile-time and target support status for a backend.
- Backend
Options - Possible values for
BackendOptions. - Backend
Policy - Policy used to select which compiled backend may satisfy an operation.
- Camera2
Request Template - Possible values for
Camera2RequestTemplate. - Camera
Error Kind - Stable semantic category intended for caller-side branching.
- Camera
Facing - Possible values for
CameraFacing. - Capability
Knowledge - Possible values for
CapabilityKnowledge. - Capability
Range Kind - Possible values for
CapabilityRangeKind. - Capture
Format - Possible values for
CaptureFormat. - Capture
Profile - Possible values for
CaptureProfile. - Clock
Domain - Possible values for
ClockDomain. - Color
Matrix - Possible values for
ColorMatrix. - Color
Primaries - Possible values for
ColorPrimaries. - Color
Range - Possible values for
ColorRange. - Control
Id - Backend-neutral identifier for a camera control.
- Control
Mode - Common operating modes for automatic and manual controls.
- Control
Readback - Indicates whether a returned value is measured, requested, or unavailable.
- Control
Unit - Unit or representation used by a numeric control value.
- Control
Value - Numeric or mode value accepted by the control API.
- Device
Selector - Possible values for
DeviceSelector. - Exposure
- Possible values for
Exposure. - Focus
- Possible values for
Focus. - Identity
Stability - Possible values for
IdentityStability. - Late
Frame Policy - Possible values for
LateFramePolicy. - Negotiation
Priority - Possible values for
NegotiationPriority. - Operation
Stage - Possible values for
OperationStage. - Overflow
Policy - Possible values for
OverflowPolicy. - Permission
Status - Current camera authorization state as reported by the selected platform.
- Pixel
Format - Possible values for
PixelFormat. - Recovery
Hint - Conservative action a caller can take without inspecting backend text.
- Session
Event - Possible values for
SessionEvent. - Session
State - Possible values for
SessionState. - Transfer
Function - Possible values for
TransferFunction. - White
Balance - Possible values for
WhiteBalance.
Traits§
- Backend
Device - A device handle may keep native thread-affine objects inside its own worker. Calls are serialized by the framework and never occur on the per-frame path.
- Backend
Provider - Behavior required by
BackendProvider.
Functions§
- selected_
conversion_ path - Reports the production conversion strategy used for a valid layout/request pair. Intended for diagnostics and benchmark output, so benchmark labels cannot drift from the real dispatch conditions.
Type Aliases§
- Camera
Result - Result type returned by all core camera operations.
- Device
- Convenient result type for
Device. - Frame
- Convenient result type for
Frame. - Session
- Convenient result type for
Session.