Skip to main content

RecordingState

Struct RecordingState 

Source
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 from session so the 500 ms recording-status event 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: FrameSlot

Latest 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: FrameSlot

Latest 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: SharedAudioMixer

Shared 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

Source

pub fn is_active(&self) -> bool

true if a session is currently held.

Source

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.

Source

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.

Source

pub fn take_cursor_track(&self) -> Option<Vec<CursorSample>>

Take the pending cursor track (the Record→Edit handoff consumes it).

Source

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).

Source

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).

Source

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.

Source

pub fn take_clicks(&self) -> Option<Vec<ClickEvent>>

Take the pending click log (the Record→Edit handoff consumes it).

Source

pub fn clear_clicks(&self)

Discard any pending click log (the export / discard paths, so a log never leaks onto an unrelated later edit).

Source

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.

Source

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.

Source

pub fn take_encoder(&self) -> Option<EncoderHandle>

Take the encoder handle out for finalisation. Returns None when no session was active.

Source

pub fn set_pending_export(&self, pending: PendingExport)

Stash a finished recording awaiting export (M-SAVE.1).

Source

pub fn take_pending_export(&self) -> Option<PendingExport>

Take the pending export out (for export_recording / discard_recording). Returns None when nothing is awaiting.

Source

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).

Source

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§

Source§

impl Default for RecordingState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,