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
@@ -14,7 +14,7 @@ use voelin_core::Command;
|
||||
|
||||
use crate::foreground::Foreground;
|
||||
use crate::host::EngineHost;
|
||||
use crate::{bridge, capture, egl, secrets};
|
||||
use crate::{bridge, camera, capture, egl, secrets};
|
||||
|
||||
/// Store setting (`bool`): the user's opt-in to local crash reports (read
|
||||
/// before the settings service starts, straight from the database).
|
||||
@@ -77,6 +77,7 @@ fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
// Before Slint creates the first window surface.
|
||||
egl::reserve_skia_extension_slots();
|
||||
capture::register();
|
||||
camera::register();
|
||||
watch_voice(host);
|
||||
});
|
||||
if let Err(e) = bridge::request_permissions() {
|
||||
|
||||
Reference in new issue
Block a user