Skip to main content

Module editor_preview_session

Module editor_preview_session 

Source
Expand description

Live editor preview session (AUT-510 / ED.6b).

Holds the wgpu compose pipeline + a seekable decode stream for the currently-open editor clip, so the webview can render the composed frame (zoom / crop / background / cursor) at any playhead position — through the same compose_project_frame the export uses, so what you scrub is what you ship.

EditorPreview is Send but !Sync. Its wgpu Renderer holds a RefCell (the mask cache), so it is Send (proven by the export path running it inside spawn_blocking) but !Sync. The session therefore lives behind a Mutex: a Mutex<T> is Sync when T: Send, which lifts it to the Send + Sync that Tauri’s State requires. Never hand a bare EditorPreview to State.

The two commands mirror the recorder’s preview split: editor_preview_open (like start_preview) opens/updates the session; editor_preview_frame (like latest_camera_frame_bgra) returns the composed BGRA bytes for one frame as a raw [tauri::ipc::Response] (no JSON).

Structs§

EditorPreviewSession 🔒
Open compose pipeline + seekable decode stream for one editor clip.
EditorPreviewState
Tauri-managed state for the live editor preview (AUT-510).

Constants§

PREVIEW_CACHE_FRAMES 🔒
Decoded-frame cache the seekable stream keeps for scrub locality — enough that a short back-and-forth scrub stays in cache without re-spawning the decoder, far below the 300-frame default (which would pin ~2.5 GB at 1080p for no preview benefit).

Functions§

editor_preview_frame
Composed BGRA bytes for the editor preview at project frame (AUT-510), as a raw [tauri::ipc::Response] (an ArrayBuffer in JS — no JSON). Empty when no clip is open or the frame is past the end.
editor_preview_open
Open / update the live editor preview for project (AUT-510). Builds the wgpu compose pipeline + decode stream the first time (and when the source clip changes); otherwise updates the project so edits show on the next frame. Synchronous on purpose — the wgpu device is created on the Tauri command worker thread, never the webview/main thread.