feat(GTK4/Camera): Add camera frame callback support#1648
Conversation
This patch fixes a linking error where the symbol aws_lc_0_40_0_poly_Rq_mul was undefined when building Perry on Linux x86_64. Root Cause: - aws-lc-sys-0.40.0 was missing crypto/hrss/asm/poly_rq_mul.S from its Linux x86_64 build configuration - This file provides the poly_Rq_mul function called from hrss.c Changes: - Added crypto/hrss/asm/poly_rq_mul.S to aws-lc-sys-0.40.0's linux_x86_64 build - Added [patch.crates-io] section to Cargo.toml to use patched aws-lc-sys - Removed unused build.rs from perry-stdlib (emitted unconsumed directive) Long-term fix: Upgrade to aws-lc-sys >= 0.41.0 once available
|
Love this, will dig in soon! |
0ec23da to
d192a42
Compare
|
Superseded by #1940, which is a cleaned-up, rebased version of this work. The feature itself (GTK4/GStreamer CameraView preview + frame callbacks) is preserved with your authorship via Thanks for the contribution! Closing in favor of #1940. |
Implements the GTK4/GStreamer CameraView backend on Linux: a `v4l2src → videoconvert → appsink` pipeline drives live preview and per-frame callbacks for real-time processing (e.g. QR detection). - New `crates/perry-ui-gtk4/src/camera.rs`: pipeline, color-space converters (YUY2/BGR/BGRA/ABGR/RGB/RGB16/NV12/I420), and the register/unregister frame-callback API. - Replaces the Linux camera no-op stubs with real implementations. - Adds `cameraRegisterFrameCallback` / `cameraUnregisterFrameCallback` dispatch rows + manifest entries + perry/ui .d.ts declarations. Frame bytes handed to the deferred idle callback are an owned copy, kept alive for the whole synchronous JS call (matching the audio-callback buffer-lifetime contract) — a borrowed pointer into `last_frame` would dangle when the next 16ms tick overwrites it before the lower-priority idle handler runs. Co-authored-by: Lebei2046 <lebei2046@users.noreply.github.com>
…1940) Implements the GTK4/GStreamer CameraView backend on Linux: a `v4l2src → videoconvert → appsink` pipeline drives live preview and per-frame callbacks for real-time processing (e.g. QR detection). - New `crates/perry-ui-gtk4/src/camera.rs`: pipeline, color-space converters (YUY2/BGR/BGRA/ABGR/RGB/RGB16/NV12/I420), and the register/unregister frame-callback API. - Replaces the Linux camera no-op stubs with real implementations. - Adds `cameraRegisterFrameCallback` / `cameraUnregisterFrameCallback` dispatch rows + manifest entries + perry/ui .d.ts declarations. Frame bytes handed to the deferred idle callback are an owned copy, kept alive for the whole synchronous JS call (matching the audio-callback buffer-lifetime contract) — a borrowed pointer into `last_frame` would dangle when the next 16ms tick overwrites it before the lower-priority idle handler runs. Co-authored-by: Lebei2046 <lebei2046@users.noreply.github.com>
Summary
Adds camera frame callback support to the GTK4 CameraView implementation, enabling real-time frame processing for use cases like QR code detection and computer vision applications.
Description
This PR enhances the Perry UI framework's CameraView widget with frame callback capabilities, allowing developers to process camera frames in real-time. The implementation includes proper thread safety mechanisms to prevent RefCell panics and supports multiple video formats.
Changes Made
Core Implementation:
register_frame_callback()andunregister_frame_callback()APIs in camera.rsFiles Modified:
crates/perry-ui-gtk4/src/camera.rstypes/perry/ui/index.d.tsTechnical Details
Screenshots/Output
A demo application demonstrating the camera callback feature can be found at chatroom-perry, which showcases real-time QR code detection using the new frame callback API.
Testing
Related Issues