Skip to main content

Module camera

Module camera 

Source
Expand description

Camera-capture POD types — CaptureStreamId + CameraConfig + CameraFacing + StreamState + … . The stateful CameraStream / CameraManager (which own the shared ImageRef texture) live in azul_layout::managers::camera. POD types for the camera-capture surface (SUPER_PLAN_2 §4 Priority 6 + research/01).

Camera frames are GPU textures, not scalar samples, so the stateful side is heavier than the sensors’: azul_layout::managers::camera owns a CameraStream per capture, each holding a shared ImageRef texture the capture thread writes into (zero-copy - clones see new bytes via the ImageRef Arc). A CameraPreview node renders that texture and, by appearing in the DOM, declares “I need the camera” to the permission layer (research/01 §“permission-as-DOM”).

Defined here in azul-core so the config / id / status types cross the FFI without azul-layout (or AVFoundation / Camera2) as a dependency - these are what an app passes to start_camera and reads back from a stream. The Nv12 zero-copy output format is a RawImageFormat addition deferred to the backend tick; configs default to BGRA8.

Structs§

CameraConfig
Requested capture configuration - the input to start_camera. Zero width/height/fps mean “let the backend pick its default”.
CaptureStats
Runtime stats for a capture stream - surfaced for HUD / debugging.
CaptureStreamId
Identifies one camera capture stream - assigned by start_camera, used to read the stream back (get_camera_frame) and to stop / pause / flip it.

Enums§

CameraFacing
Which physical camera to open.
CaptureErrorCode
Why a capture stream failed (StreamState::Error).
CaptureOrientation
Rotation / mirroring the capture needs relative to the display (the sensor’s native orientation rarely matches the UI’s).
StreamState
Lifecycle of a capture stream.