hex/crates/capture-core/src/lib.rs
Kit Langton 4f3a45e03a
feat(screenshots): a recording toolbar, smaller movies with sound, and playback in the editor (#2166)
* Screenshots recordings: quality settings, copy as a file, export size (t1607)

Labs › Screenshots gets a Recording group (Scale Retina to 1x, Max resolution, Frame rate, Quality), each with a hex settings key; defaults 1x, Original, 30 fps, High (HEVC 0.50). The editor copies a recording's movie file, and its export-size pop-up (Original, 1080p, 720p) shows an estimate for the span kept, re-encoding off the UI thread with progress on the pressed button. (t1607)

* Screenshots: ⌘⇧5 recording toolbar with microphone and computer audio mixed into the movie (t1607)

* Screenshots: compact recording toolbar, editor playback and tidier toolbar (t1607)

* Screenshots: simplify the toolbar still, export-size save and playhead tick (t1607)

* docs: the compact recording toolbar and editor playback (t1607)

* Screenshots: filmstrip cells keep the movie's shape; mic-off icon is macOS-only (t1607)

* Screenshots: trim editor goldens for the transport and filmstrip (t1607)

* Screenshots: a trimmed export keeps a whole video track; reencode has a deadline (t1607)

* Screenshots: recording sound isn't silenced; toolbar choices apply at once and save in order (t1607)

* Screenshots: Return and Escape reach an open toolbar menu (t1607)

* Screenshots: a menu-only open of the chosen microphone; no microphone keeps no audio; Annotate may take the record key while the Lab is off (t1607)

* Screenshots: an export lands whole or not at all, and reports only to the recording it came from (t1607)

* Screenshots: keep the exact-device open and partial exports macOS-only (t1607)
2026-11-21 08:26:36 -08:00

58 lines
2.1 KiB
Rust

//! Screen recording for macOS on `ScreenCaptureKit`.
//!
//! A host describes a recording with a [`Plan`] and starts it with [`Recorder::start`]. Each
//! display, window or region source records to its own MP4: H.264 through an
//! `SCRecordingOutput`, or HEVC at a constant quality through Hex's own `AVAssetWriter`
//! ([`Encoder`]).
//! [`Recording::stop`] returns at once; the files are finished on the recording's own thread and
//! come back from [`Finishing::wait`] along with a versioned [`Manifest`] that places every file
//! on one clock: Mach host time in nanoseconds.
//!
//! The crate holds no global state and starts nothing that outlives a recording.
#![cfg(target_os = "macos")]
mod av_writer;
mod clicks;
mod cursor;
mod error;
mod external_audio;
mod final_frame_hold;
mod frames;
mod input;
mod manifest;
mod native;
mod plan;
mod probe;
mod screenshot;
mod session;
mod system_audio;
#[cfg(test)]
mod test_dir;
mod time;
mod video_writer;
pub use cursor::{
CursorButton, CursorButtonEvent, CursorButtonState, CursorCapture, CursorCaptureDiagnostics,
CursorClickCaptureStatus, CursorPositionSample, CursorTelemetry, Millis,
NORMALIZED_COORDINATE_MAX, NormalizedCoordinate,
};
pub use error::Error;
pub use external_audio::ExternalAudioSink;
pub use final_frame_hold::{FinalFrameHold, FinalFrameHoldError, hold_final_video_frame};
pub use frames::{Frame, FrameTap};
pub use input::{
HostEvent, HostInputReceiver, HostInputSender, InputEvent, KeyPolicy, Modifiers, RecordedInput,
filter_key, host_channel, secure_input_enabled,
};
pub use manifest::{
AudioGap, Clock, CursorBundle, FileEntry, FileKind, InputBundle, MANIFEST_VERSION, Manifest,
Marker, Permission, SIDECAR_VERSION, SourceEntry, TrackKind,
};
pub use native::Recorder;
pub use plan::{
AudioPlan, CursorDrawing, Encoder, Exclusions, ExternalMic, HEVC_QUALITY, Input, MANIFEST_NAME,
MIC_WARMUP, Mic, Names, Plan, Rect, Source, SourcePlan,
};
pub use screenshot::{Image, screenshot, screenshot_with};
pub use session::{Finished, Finishing, Recording, SourceCursor};
pub use time::{HostTime, MediaTime, Timebase};