crates/camera/README.md
Cross-platform camera capture API that provides a unified interface across macOS (AVFoundation) and Windows (Media Foundation/DirectShow) backends. Offers simple yet low-level access to camera devices with consistent device enumeration, format negotiation, and callback-based frame capture.
Provides a single, ergonomic API for camera capture that abstracts platform differences while maintaining access to native capabilities. Designed to handle the complexity of different camera ecosystems on macOS and Windows through platform-specific backends while exposing a consistent Rust interface.
list_cameras() call returns all available cameras across platformsFormat abstraction over native format representationslist_cameras() - Enumerate all cameras with unified CameraInfo objectsCameraInfo::model_id(), CameraInfo::display_name() - Cross-platform device metadataCameraInfo::formats() - Iterator over platform-normalized Format objectsCameraInfo::start_capturing(format, callback) - Begin capture with unified callback interfaceRecordingHandle::stop_capturing() - Stop capture session and cleanup resourcesCapturedFrame::native() - Access platform-specific frame data when neededFormat::width(), Format::height(), Format::frame_rate() - Cross-platform format propertiesFormat::native() - Direct access to underlying AVFoundation/Media Foundation format objectsThe ModelID system provides device identification within each platform, modeled after Chromium's VideoCaptureDeviceDescriptor::model_id. It combines vendor ID (VID) and product ID (PID) to create a unique identifier that remains stable across sessions and system reboots on the same platform.
Bridges macOS AVFoundation and Windows Media Foundation/DirectShow through a unified device enumeration and capture interface.
Platform-specific modules (macos.rs, windows.rs) handle the underlying capture mechanics and expose them through common traits and callbacks,
while the main library provides a consistent API surface that abstracts away platform differences without sacrificing access to native functionality when needed.