hex/crates/capture-core/Cargo.toml
Kit Langton bb2f56263c
feat(capture-core): shared macOS screen-recording library (#255)
* feat(capture-core): add shared macOS screen capture core

Records displays and windows with ScreenCaptureKit, one MP4 per source,
on one host clock, and writes a versioned capture.json manifest.

- stop() returns at once; finishing runs on the recording's own thread
- each stream keeps running until its detached recording output finishes
  or fails, then stops within 10 s
- a system stream stop is not an output failure; a finished MP4 is kept
- the final video frame is held to the recorded end
- external microphone PCM through a bounded sink, written as a WAV with
  recorded gaps; the core never opens a microphone in that mode
- host input through a bounded queue or an optional event tap, chord-only
  keys, dropped while secure input is on; ~240 Hz cursor sampling
- optional system audio file and low-rate RGBA frame tap

Kept outside the workspace and built only by the capture feature.

* feat(capture-core): regions, output size, screenshots, nanosecond clock

- Source::Region { display, rect }: a display-local rect applied as the
  stream's sourceRect, trimmed to the display, with exclusions
- SourcePlan::long_edge caps a source's longest side in pixels, keeping
  the aspect and never upscaling; sizes come from points and the
  filter's pixel scale
- screenshot(&Source, &Exclusions, long_edge) through SCScreenshotManager
  with the recording's filter construction
- every timestamp is Mach host time in nanoseconds: the manifest records
  "clock": "mach_host_ns" and anchor_ns; stream starts, audio file starts
  and gaps, cursor samples and clicks, and input events carry *_ns
- objc2-av-foundation and objc2-avf-audio use only the features in use, so
  the lockfile gains no registry crates
2026-10-27 20:08:40 -07:00

47 lines
1.4 KiB
TOML

[package]
name = "capture-core"
version = "0.1.0"
edition = "2024"
license = "MIT"
publish = false
description = "Screen recording for macOS: ScreenCaptureKit streams, bounded stop, and a capture manifest"
# macOS only: every source file is `#![cfg(target_os = "macos")]`, and nothing
# here is compiled for other targets.
[target.'cfg(target_os = "macos")'.dependencies]
block2 = "0.6.2"
hound = "3.5.1"
mach2 = "0.6.0"
objc2 = "0.6.4"
# Only the classes in use: the default features pull in frameworks (Image I/O,
# Media Toolbox) that nothing here needs.
objc2-av-foundation = { version = "0.3.2", default-features = false, features = [
"std",
"block2",
"objc2-core-graphics",
"objc2-core-media",
"objc2-core-video",
"AVAsset",
"AVAssetImageGenerator",
"AVAssetTrack",
"AVAssetWriter",
"AVAssetWriterInput",
"AVMediaFormat",
"AVVideoSettings",
] }
objc2-avf-audio = { version = "0.3.2", default-features = false, features = [
"std",
"AVAudioSettings",
] }
objc2-core-audio-types = "0.3.2"
objc2-core-foundation = "0.3.2"
objc2-core-graphics = "0.3.2"
objc2-core-media = "0.3.2"
# Used only by the tests' fixtures: dev-dependencies of a crate outside the
# workspace are not resolved.
objc2-core-video = "0.3.2"
objc2-foundation = "0.3.2"
screencapturekit = { version = "=11.0.0", features = ["macos_15_0"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.151"
tracing = "0.1.44"