Skip to main content

Module capture_common

Module capture_common 

Source
Expand description

Shared core for the video-ish widgets (camera/screencap/video): the VideoFrame type + the GL-texture present_frame writeback. See capture_common.rs. Shared core for the “video-ish” widgets (camera / screencap / video).

All three are identical in architecture (RefAny dataset + AfterMount background capture/decode thread + writeback that uploads each frame into a stable external GL texture + recomposites). Only the config and the worker differ. This module holds the duplicated pieces - the [VideoFrame] the worker produces and [present_frame], the GL writeback core - so each widget is a thin config+worker wrapper and there’s a single place for GL fixes + the real platform workers (AVFoundation / ScreenCaptureKit / vk-video) to plug in.

NOTE: GL code - compile-verified here; the actual texture rendering must be verified on a machine with a window + GPU.

Structs§

AudioCaptureVTable
A platform audio-capture backend (microphone), registered by the dll so MicrophoneWidget can pull real samples instead of the test tone. Like CaptureVTable but yields interleaved f32 audio rather than RGBA video.
CaptureVTable
A platform frame-capture backend (camera / screen), registered by the dll at startup so the cross-platform capture widgets can pull real frames instead of their built-in test pattern. The dll provides one per OS (v4l2 on Linux, AVFoundation on macOS, Media Foundation on Windows, ScreenCaptureKit / PipeWire / DXGI for screens, …). These are plain Rust fn pointers - the dll links azul-layout statically, so registering + calling is a Rust-to-Rust call, no extern "C"/trait-object dance.
OnVideoFrame
OnVideoFrameCallback

Enums§

OptionOnVideoFrame

Statics§

ON_VIDEO_FRAME_INVOKER
Process-global slot for this callback kind’s host-side invoker.

Functions§

AzApp_setOnVideoFrameCallbackInvoker
Register the host-side invoker for this callback kind.
AzOnVideoFrameCallback_createFromHostHandle
C-ABI export wrapping <Wrapper>::create_from_host_handle.
camera_backend
The registered camera backend, if the dll provided one for this platform.
invoke_on_frame
Invoke a capture widget’s optional on_frame hook with frame, returning the user’s Update (DoNothing when no hook is set). Shared by all three capture widgets’ writebacks.
mic_backend
The registered mic-capture backend, if the dll provided one for this platform.
present_frame
Present frame for a video-ish widget and return the (stable) GL texture id to store back in the widget’s state.
register_camera_backend
Register the platform camera capture backend (called once by the dll at startup; the first registration wins). Without it, CameraWidget shows its test pattern.
register_mic_backend
Register the platform microphone-capture backend (called once by the dll).
register_screen_backend
Register the platform screen capture backend (for ScreenCaptureWidget).
screen_backend
The registered screen-capture backend, if any.
upload_rgba
Upload tightly-packed RGBA8 pixels into the GL texture texture_id.

Type Aliases§

AzOnVideoFrameCallbackInvoker
Pointer-arg variant of this callback kind’s typedef.
OnVideoFrameCallbackType
User hook fired once per captured/decoded frame - the backreference dependency-injection pattern (see architecture.md). A capture widget’s private writeback invokes it with each VideoFrame, so application code can apply effects, save the frame into its own data model, or send it over the network (azul-meet). Returns Update like any callback. Wired via CameraWidget::with_on_frame / ScreenCaptureWidget::with_on_frame / VideoWidget::with_on_frame.