Skip to main content

Crate camera

Crate camera 

Source
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§

AvFoundationOptions
Values for AvFoundationOptions.
BackendAttempt
One typed failure captured while evaluating a fallback backend policy.
BackendDeviceInfo
Backend-neutral device metadata returned by a custom provider.
BackendId
Stable identifier for a built-in or application-provided camera backend.
Camera2Options
Values for Camera2Options.
CameraError
One public error type returned by every camera operation.
CameraSystem
Enumeration is isolated from the async executor. Explicit backend requests never fall back to another device namespace.
Capture
Values for Capture.
CaptureBuilder
Values for CaptureBuilder.
CaptureMode
Values for CaptureMode.
CaptureModeRange
Values for CaptureModeRange.
CapturePlan
Values for CapturePlan.
CaptureRequest
Values for CaptureRequest.
CaptureRequestBuilder
Values for CaptureRequestBuilder.
CapturedFrame
Cheaply shared immutable frame. RGB/native bytes never change while retained.
ColorInfo
Values for ColorInfo.
ControlDescriptor
Capabilities and access rules for one camera control.
ControlOutcome
Result of applying one item from a batch of control changes.
ControlRange
Numeric limits and optional default for a camera control.
ConversionCapability
Values for ConversionCapability.
ConversionRequest
Describes the RGB image a consumer actually needs.
DeviceCapabilities
Values for DeviceCapabilities.
DeviceId
Backend-scoped device identity. Persistence preserves the backend namespace; IdentityStability still tells callers whether the native part is stable across enumeration cycles or process restarts.
DeviceInfo
Values for DeviceInfo.
DeviceSnapshot
Values for DeviceSnapshot.
DeviceWatcher
Values for DeviceWatcher.
DimensionRange
Values for DimensionRange.
EventReceiver
Values for EventReceiver.
FrameInterval
Values for FrameInterval.
FrameIntervalRange
Values for FrameIntervalRange.
FrameKey
Values for FrameKey.
FrameLayout
Values for FrameLayout.
FrameMetrics
Values for FrameMetrics.
FrameRate
Positive rational frame rate that preserves values such as 30_000/1_001.
FrameReceiver
Each receiver owns its cursor/queue. Dropping next() before it resolves does not consume a frame. Stop wakes all receivers with StreamStopped.
FrameSink
Bounded frame destination supplied to an application-provided backend.
Kelvin
Validated white-balance temperature in kelvin.
MemoryBudget
Values for MemoryBudget.
NegotiatedCapture
Values for NegotiatedCapture.
Orientation
Values for Orientation.
PlaneLayout
Values for PlaneLayout.
ReconnectPolicy
Values for ReconnectPolicy.
RgbConverter
Values for RgbConverter.
RgbView
Values for RgbView.
SourceTimestamp
Values for SourceTimestamp.
StateWatcher
Values for StateWatcher.
StreamStats
Stream statistics.
SubscriptionOptions
Values for SubscriptionOptions.
SystemBuilder
Configures backend selection, backend-specific options, and custom providers.
UsbIdentity
Values for UsbIdentity.
V4l2Options
Values for V4l2Options.
WritableFrameLease
Writable storage borrowed directly from the framework’s bounded frame pool. commit makes it immutable and visible to subscribers; dropping it returns the slot to the pool without publishing.

Enums§

BackendAvailability
Compile-time and target support status for a backend.
BackendOptions
Possible values for BackendOptions.
BackendPolicy
Policy used to select which compiled backend may satisfy an operation.
Camera2RequestTemplate
Possible values for Camera2RequestTemplate.
CameraErrorKind
Stable semantic category intended for caller-side branching.
CameraFacing
Possible values for CameraFacing.
CapabilityKnowledge
Possible values for CapabilityKnowledge.
CapabilityRangeKind
Possible values for CapabilityRangeKind.
CaptureFormat
Possible values for CaptureFormat.
CaptureProfile
Possible values for CaptureProfile.
ClockDomain
Possible values for ClockDomain.
ColorMatrix
Possible values for ColorMatrix.
ColorPrimaries
Possible values for ColorPrimaries.
ColorRange
Possible values for ColorRange.
ControlId
Backend-neutral identifier for a camera control.
ControlMode
Common operating modes for automatic and manual controls.
ControlReadback
Indicates whether a returned value is measured, requested, or unavailable.
ControlUnit
Unit or representation used by a numeric control value.
ControlValue
Numeric or mode value accepted by the control API.
DeviceSelector
Possible values for DeviceSelector.
Exposure
Possible values for Exposure.
Focus
Possible values for Focus.
IdentityStability
Possible values for IdentityStability.
LateFramePolicy
Possible values for LateFramePolicy.
NegotiationPriority
Possible values for NegotiationPriority.
OperationStage
Possible values for OperationStage.
OverflowPolicy
Possible values for OverflowPolicy.
PermissionStatus
Current camera authorization state as reported by the selected platform.
PixelFormat
Possible values for PixelFormat.
RecoveryHint
Conservative action a caller can take without inspecting backend text.
SessionEvent
Possible values for SessionEvent.
SessionState
Possible values for SessionState.
TransferFunction
Possible values for TransferFunction.
WhiteBalance
Possible values for WhiteBalance.

Traits§

BackendDevice
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.
BackendProvider
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§

CameraResult
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.