pub struct RecordingState {
pub session: Mutex<Option<RecordingSession>>,
pub encoder: Mutex<Option<EncoderHandle>>,
pub camera_frame_slot: FrameSlot,
pub screen_frame_slot: FrameSlot,
pub audio_mixer: SharedAudioMixer,
pub pending_export: Mutex<Option<PendingExport>>,
pub cursor_poller: Mutex<Option<CursorPoller>>,
pub pending_cursor_track: Mutex<Option<Vec<CursorSample>>>,
pub click_tap: Mutex<Option<ClickTap>>,
pub pending_clicks: Mutex<Option<Vec<ClickEvent>>>,
}Expand description
Tauri-managed wrapper around the optional active session. Held
in tauri::State so the start_recording / stop_recording /
recording_status IPC commands + the 500 ms event-push task
share one source of truth. Mirror of MicCaptureState /
ScreenCaptureState.
Two slots:
session: Mutex<Option<RecordingSession>>— the immutable snapshot (id,started_at, state, streams).encoder: Mutex<Option<EncoderHandle>>— the live encoder + test-pattern feed thread. Separated fromsessionso the 500 msrecording-statusevent push can take a cheap clone of the session snapshot without holding the encoder mutex.
Fields§
§session: Mutex<Option<RecordingSession>>Immutable per-session snapshot.
encoder: Mutex<Option<EncoderHandle>>Active encoder + its background feed thread. M-EXPORT.3.
camera_frame_slot: FrameSlotLatest BGRA frame from the camera capture worker (M-PIX.0).
Written by crates/app/src/preview/pipeline.rs::run_pipeline;
consumed by M-PIX.5’s compose thread.
screen_frame_slot: FrameSlotLatest BGRA frame from the SCK screen-capture delegate
(M-PIX.0). Written by
crates/media/src/sck_video.rs::ScreenOutputHandler;
consumed by M-PIX.5’s compose thread.
audio_mixer: SharedAudioMixerShared two-source mic + system-audio mixer (M-PIX.0). Mic
worker calls push_mic; SCK audio delegate calls
push_sys_audio; encoder feed thread calls pull().
pending_export: Mutex<Option<PendingExport>>A finished recording sitting in scratch, awaiting the user’s
format choice in the Save panel (M-SAVE.1). Set by
stop_recording; cleared by export_recording /
discard_recording. Some here is the “awaiting export”
signal the Save panel keys off — there is no SessionState
variant for it (keeps the state-machine matches + LED colour
map untouched).
cursor_poller: Mutex<Option<CursorPoller>>Cursor-position capture worker (ED.17), live for the duration of a
recording. Some while recording; stopped + drained at
stop_recording. macOS-only in practice (the non-macOS poller is a
no-op).
pending_cursor_track: Mutex<Option<Vec<CursorSample>>>The cursor track from the most-recent recording, awaiting the
Record→Edit handoff (ED.17). Set at stop; consumed by open_in_editor
(attached to the project); cleared on a new recording / export /
discard so it never leaks onto an unrelated clip.
click_tap: Mutex<Option<ClickTap>>Click-capture tap (ED.17 / ISS-16), live for the duration of a
recording. Some while recording (when Input-Monitoring is granted);
stopped + drained at stop_recording. macOS-only (the non-macOS tap is
a no-op).
pending_clicks: Mutex<Option<Vec<ClickEvent>>>The click log from the most-recent recording, awaiting the Record→Edit
handoff (ED.17). Same lifecycle as Self::pending_cursor_track: set
at stop, consumed by open_in_editor, cleared on a new recording /
export / discard. Feeds auto-zoom + the ED.19 click ripples.
Implementations§
Source§impl RecordingState
impl RecordingState
Sourcepub fn start_cursor_capture(&self, screen_source_id: Option<&str>)
pub fn start_cursor_capture(&self, screen_source_id: Option<&str>)
Start cursor-position capture for a new recording (ED.17). Clears any stale pending track first so it can’t leak onto this recording’s edit.
Sourcepub fn finish_cursor_capture(&self, project_fps: u32)
pub fn finish_cursor_capture(&self, project_fps: u32)
Stop cursor capture and stash the resampled track for the Record→Edit
handoff (ED.17). project_fps is the editor’s timeline authority.
Sourcepub fn take_cursor_track(&self) -> Option<Vec<CursorSample>>
pub fn take_cursor_track(&self) -> Option<Vec<CursorSample>>
Take the pending cursor track (the Record→Edit handoff consumes it).
Sourcepub fn clear_cursor_track(&self)
pub fn clear_cursor_track(&self)
Discard any pending cursor track (the export / discard paths, so a track never leaks onto an unrelated later edit).
Sourcepub fn start_click_capture(&self, screen_source_id: Option<&str>)
pub fn start_click_capture(&self, screen_source_id: Option<&str>)
Start click capture for a new recording (ED.17 / ISS-16). Clears any stale pending clicks first so they can’t leak onto this recording’s edit. Normalizes against the captured display’s bounds (ISS-17).
Sourcepub fn finish_click_capture(&self, project_fps: u32)
pub fn finish_click_capture(&self, project_fps: u32)
Stop click capture and stash the resampled click log for the
Record→Edit handoff (ED.17 / ISS-16). project_fps is the editor’s
timeline authority. A degraded (empty) tap leaves no pending clicks.
Sourcepub fn take_clicks(&self) -> Option<Vec<ClickEvent>>
pub fn take_clicks(&self) -> Option<Vec<ClickEvent>>
Take the pending click log (the Record→Edit handoff consumes it).
Sourcepub fn clear_clicks(&self)
pub fn clear_clicks(&self)
Discard any pending click log (the export / discard paths, so a log never leaks onto an unrelated later edit).
Sourcepub fn snapshot(&self) -> Option<RecordingSession>
pub fn snapshot(&self) -> Option<RecordingSession>
Snapshot of the active session, if any. Cloned so callers don’t hold the mutex across the rest of their work.
Sourcepub fn install_encoder(&self, handle: EncoderHandle)
pub fn install_encoder(&self, handle: EncoderHandle)
Install a fresh encoder handle (M-EXPORT.3). Replaces any prior handle without finalising — caller is responsible for having finalised the previous session first.
Sourcepub fn take_encoder(&self) -> Option<EncoderHandle>
pub fn take_encoder(&self) -> Option<EncoderHandle>
Take the encoder handle out for finalisation. Returns None
when no session was active.
Sourcepub fn set_pending_export(&self, pending: PendingExport)
pub fn set_pending_export(&self, pending: PendingExport)
Stash a finished recording awaiting export (M-SAVE.1).
Sourcepub fn take_pending_export(&self) -> Option<PendingExport>
pub fn take_pending_export(&self) -> Option<PendingExport>
Take the pending export out (for export_recording /
discard_recording). Returns None when nothing is awaiting.
Sourcepub fn has_pending_export(&self) -> bool
pub fn has_pending_export(&self) -> bool
true while a finished recording is awaiting export. Used by
start_recording to refuse starting a new session on top of
an un-exported one (which would orphan its scratch file).
Sourcepub fn pending_export_view(&self) -> Option<PendingExportView>
pub fn pending_export_view(&self) -> Option<PendingExportView>
IPC snapshot of the pending export, if any (M-SAVE.1). Cloned so the caller doesn’t hold the mutex.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RecordingState
impl RefUnwindSafe for RecordingState
impl Send for RecordingState
impl Sync for RecordingState
impl Unpin for RecordingState
impl UnsafeUnpin for RecordingState
impl UnwindSafe for RecordingState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().