Android: cameras in the Stream Studio through Camera2
The studio listed only the test pattern on Android. voelin-media gains a camera provider hook (like the external screen capture): the app registers Camera2, whose cameras the studio's picker lists first (front ones first, with their YUV sizes and highest frame rate), and a camera source opens one. CameraCapture.kt asks for the CAMERA permission when a camera is first opened (the source shows why if it is refused), opens the camera into an ImageReader (YUV_420_888) at the wished size or the nearest one (16:9 first, 1280x720 by default) with a fitting frame-rate range, and hands each frame's planes to Rust as direct buffers valid during the call, with the clockwise turn that makes it upright for the screen's current rotation (front cameras turn the other way). Rust takes the planes as YuvPlanes: an upright planar or NV12 picture goes to the studio's sink as it is, converted straight from the camera's memory; NV21 (what most cameras give) and turned pictures are gathered into I420 in a buffer each camera keeps, so a running camera allocates nothing per frame. Errors after the start (permission refused, camera taken by another app) go to the source's feed. Front and back: a camera's default mirroring now follows the camera (a back camera is not mirrored, what faces the user is), and the source menu gains Switch camera, which moves a camera source to the next camera (and its name with it, if it was named after the camera). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5da3f94479
commit
1eabbb4704
12 files changed
+972
-15
No files matched your search
@@ -13,6 +13,8 @@
|
||||
//! native methods it calls back (`Native`)
|
||||
//! - `capture` (Android): screen and system-audio capture through
|
||||
//! MediaProjection, registered as `voelin_media` capture providers
|
||||
//! - `camera` (Android): the Stream Studio's cameras through Camera2,
|
||||
//! registered as its camera provider
|
||||
//! - `secrets` (Android): passwords encrypted with an Android Keystore key
|
||||
//! - `egl` (Android): keeps EGL extension slots for Skia, without which the
|
||||
//! UI cannot draw on Mesa-based Android (Waydroid)
|
||||
@@ -27,6 +29,8 @@ mod app;
|
||||
#[cfg(target_os = "android")]
|
||||
mod bridge;
|
||||
#[cfg(target_os = "android")]
|
||||
mod camera;
|
||||
#[cfg(target_os = "android")]
|
||||
mod capture;
|
||||
#[cfg(target_os = "android")]
|
||||
mod egl;
|
||||
|
||||
Reference in new issue
Block a user