mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* 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
43 lines
1.6 KiB
Shell
Executable file
43 lines
1.6 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# The local check loop.
|
|
#
|
|
# scripts/check fmt, clippy, then every test
|
|
# scripts/check meeting::query fmt, then only the tests matching the filters
|
|
#
|
|
# Tests run through cargo-nextest (.config/nextest.toml): each test is its own
|
|
# process, and one that hangs is killed and reported by name. Exit codes:
|
|
# 10 fmt, 11 clippy, 12 tests. NEXTEST_PROFILE=ci selects CI's profile.
|
|
# Tests build with the `capture` feature, so the debug-only capture
|
|
# experiment's code (macOS) is tested too. `crates/capture` and
|
|
# `crates/capture-core` sit outside the workspace (Cargo.toml), so on macOS
|
|
# they are named to be linted and tested.
|
|
set -uo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
packages=(--workspace)
|
|
if [[ "$(uname -s)" == Darwin ]]; then
|
|
packages=(-p voice-control -p scrawl-router -p scrawl-capture -p capture-core)
|
|
fi
|
|
|
|
stage() {
|
|
printf '\n==> %s\n' "$1"
|
|
}
|
|
|
|
stage "fmt"
|
|
cargo fmt --all --check || exit 10
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
stage "clippy"
|
|
cargo clippy --locked "${packages[@]}" --all-targets --features capture,onnx-benchmark -- -D warnings || exit 11
|
|
fi
|
|
|
|
if command -v cargo-nextest >/dev/null 2>&1; then
|
|
stage "test (nextest${1:+: $*})"
|
|
cargo nextest run --locked "${packages[@]}" --features capture --no-tests=warn "$@" || exit 12
|
|
else
|
|
stage "test (cargo test${1:+: $*})"
|
|
echo "cargo-nextest is not installed, so a hung test stalls the run without" >&2
|
|
echo "a name. Install it with: brew install cargo-nextest" >&2
|
|
cargo test --locked "${packages[@]}" --features capture -- "$@" || exit 12
|
|
fi
|