Implement the AVFoundation driver#4
Conversation
…ive BGRA frames, and update avf-test CLI
# Conflicts: # src/shared/error.rs
There was a problem hiding this comment.
⚠️ CI failed
Show all
| Platform | Name | Status | Details |
|---|---|---|---|
| All | Formatting | ✅ | Details |
| macOS | Build library | ❌ | Details |
| macOS | Build library (no default features) | ⏩ | Details |
| macOS | Build binaries | ⏩ | Details |
| macOS | Build tests | ⏩ | Details |
| macOS | Build examples | ⏩ | Details |
| macOS | Run tests | ⏩ | Details |
| macOS | Run doctests | ⏩ | Details |
| Linux | Build library | ❌ | Details |
| Linux | Build library (no default features) | ⏩ | Details |
| Linux | Build binaries | ⏩ | Details |
| Linux | Build tests | ⏩ | Details |
| Linux | Build examples | ⏩ | Details |
| Linux | Run tests | ⏩ | Details |
| Linux | Run doctests | ⏩ | Details |
| Windows | Build library | ❌ | Details |
| Windows | Build library (no default features) | ⏩ | Details |
| Windows | Build binaries | ⏩ | Details |
| Windows | Build tests | ⏩ | Details |
| Windows | Build examples | ⏩ | Details |
| Windows | Run tests | ⏩ | Details |
| Windows | Run doctests | ⏩ | Details |
=============================================
| Platform | Name | Status | Details |
|---|---|---|---|
| macOS | Build library | ❌ | Details |
| Linux | Build library | ❌ | Details |
| Windows | Build library | ❌ | Details |
There was a problem hiding this comment.
Pull request overview
This PR implements an AVFoundation-based camera driver for iOS and macOS, enabling native video capture on Apple platforms. The implementation adds frame capture callbacks, configures capture sessions with device selection and format settings, and provides an FFI layer for Swift integration.
Key Changes:
- Implemented the
AvfCameraDriverwith full AVFoundation capture session management including device discovery, format configuration, and BGRA frame delivery - Added
FrameandFrameCallbackabstractions to support asynchronous frame delivery from camera drivers - Created iOS FFI layer (
ffi.rs) exposing C-ABI functions for camera operations and AVCaptureSession access
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vendor/rust-core-video-sys | Added submodule for Core Video bindings |
| src/shared/open.rs | Updated open_camera to accept frame callback and refined platform-specific driver selection with proper cfg guards |
| src/shared/mod.rs | Exposed new frame module and constrained ffmpeg feature to supported platforms |
| src/shared/frame.rs | Introduced Frame struct and PixelFormat enum for representing video frame data |
| src/shared/error.rs | Added DriverError variant for platform-specific driver failures |
| src/shared/drivers/ffmpeg.rs | Removed redundant compile-time platform check |
| src/shared/drivers/avf.rs | Complete AVFoundation driver implementation with device discovery, format configuration, and frame capture |
| src/shared/driver.rs | Added FrameCallback type alias for frame delivery |
| src/lib.rs | Exposed iOS FFI module |
| src/ffi.rs | New iOS FFI layer with C-compatible functions for camera control and session access |
| Cargo.toml | Added objc2-core-media feature, vendored core-video-sys, and configured library output types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub fn open_camera( | ||
| input_url: impl AsRef<str>, | ||
| config: CameraConfig, | ||
| callback: FrameCallback, |
There was a problem hiding this comment.
The callback parameter is now required in open_camera, but several driver implementations (ffmpeg, dshow, v4l2) do not appear to use it. This creates an inconsistent API where callers must provide a callback that may be ignored. Consider making the callback optional or ensuring all drivers support it.
| callback: FrameCallback, | |
| callback: Option<FrameCallback>, |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
⚠️ CI failed
Show all
| Platform | Name | Status | Details |
|---|---|---|---|
| All | Formatting | ✅ | Details |
| Linux | Build library | ❌ | Details |
| Linux | Build library (no default features) | ⏩ | Details |
| Linux | Build binaries | ⏩ | Details |
| Linux | Build tests | ⏩ | Details |
| Linux | Build examples | ⏩ | Details |
| Linux | Run tests | ⏩ | Details |
| Linux | Run doctests | ⏩ | Details |
| Windows | Build library | ❌ | Details |
| Windows | Build library (no default features) | ⏩ | Details |
| Windows | Build binaries | ⏩ | Details |
| Windows | Build tests | ⏩ | Details |
| Windows | Build examples | ⏩ | Details |
| Windows | Run tests | ⏩ | Details |
| Windows | Run doctests | ⏩ | Details |
| macOS | Build library | ❌ | Details |
| macOS | Build library (no default features) | ⏩ | Details |
| macOS | Build binaries | ⏩ | Details |
| macOS | Build tests | ⏩ | Details |
| macOS | Build examples | ⏩ | Details |
| macOS | Run tests | ⏩ | Details |
| macOS | Run doctests | ⏩ | Details |
=============================================
| Platform | Name | Status | Details |
|---|---|---|---|
| Linux | Build library | ❌ | Details |
| Windows | Build library | ❌ | Details |
| macOS | Build library | ❌ | Details |
|
@oleksandrvoyager Lots of merge conflicts now, what do you suggest to do? |
# Conflicts: # Cargo.lock # Cargo.toml # src/shared/driver.rs # src/shared/drivers/avf.rs # src/shared/drivers/ffmpeg.rs # src/shared/error.rs # src/shared/frame.rs # src/shared/open.rs
There was a problem hiding this comment.
⚠️ CI failed
Show all
| Platform | Name | Status | Details |
|---|---|---|---|
| All | Formatting | ❌ | Details |
| Windows | Build library | ❌ | Details |
| Windows | Build library (no default features) | ⏩ | Details |
| Windows | Build binaries | ⏩ | Details |
| Windows | Build tests | ⏩ | Details |
| Windows | Build examples | ⏩ | Details |
| Windows | Run tests | ⏩ | Details |
| Windows | Run doctests | ⏩ | Details |
| Linux | Build library | ❌ | Details |
| Linux | Build library (no default features) | ⏩ | Details |
| Linux | Build binaries | ⏩ | Details |
| Linux | Build tests | ⏩ | Details |
| Linux | Build examples | ⏩ | Details |
| Linux | Run tests | ⏩ | Details |
| Linux | Run doctests | ⏩ | Details |
| macOS | Build library | ❌ | Details |
| macOS | Build library (no default features) | ⏩ | Details |
| macOS | Build binaries | ⏩ | Details |
| macOS | Build tests | ⏩ | Details |
| macOS | Build examples | ⏩ | Details |
| macOS | Run tests | ⏩ | Details |
| macOS | Run doctests | ⏩ | Details |
=============================================
| Platform | Name | Status | Details |
|---|---|---|---|
| All | Formatting | ❌ | Details |
| Windows | Build library | ❌ | Details |
| Linux | Build library | ❌ | Details |
| macOS | Build library | ❌ | Details |
No description provided.