Skip to content

refactor: extract SimUseVideo target and rehome Android record-video - #79

Merged
onevcat merged 2 commits into
mainfrom
refactor/extract-simusevideo
Jul 29, 2026
Merged

onevcat merged 2 commits into
mainfrom
refactor/extract-simusevideo

Conversation

@onevcat

@onevcat onevcat commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

The platform-neutral video plumbing (H.264 Annex B parsing, passthrough muxing, AVAssetWriter encoding, frame utilities) lived in iOSSimBackend, so the Android record-video orchestration from #70 was forced inline into the SimUse executable target — the only target with both backends in its dep cone. That asymmetry (no android record-video subcommand, a 475-line top-level forwarder) would have repeated itself for every future video verb, starting with #78.

Changes

Two pure-refactor commits, no CLI behavior change:

  1. Extract SimUseVideo target — AnnexBStreamParser, H264MuxingPipeline, H264PassthroughRecorder, frame utilities, H264StreamRecorder, the recording watchdog, and output-path resolution (VideoOutputFile) move to a new FB*-free target (SimUseCore + system frameworks only). Generic process-control helpers (CancellationFlag, OnceFlag, FirstErrorBox, cancellableSleep, SignalObserver) sink into SimUseCore/ProcessControl.swift. The single FB*-tied piece — VideoFrameUtilities.captureScreenshotData(from: FBSimulator) — stays in iOSSimBackend as an extension.
  2. Rehome the Android recording engine — the orchestration moves into AndroidBackend/Verbs/AndroidRecordVideoCommand.swift and is registered, so sim-use android record-video now exists and record-video has the same three-surface layout as every other cross-platform verb. The top-level forwarder shrinks to the standard thin shape and calls AndroidRecordVideoCommand.record(), symmetric to AndroidScreenshotCommand.performScreenshot. Flag validation is shared across all three surfaces via VideoRecordingOptions so the contract cannot drift.

New dependency graph: SimUseCore → SimUseVideo → { iOSSimBackend, AndroidBackend } → SimUse.

Verification

  • make build + make test green (1206 tests; moved suites retargeted to their new modules).
  • iOS live smoke on a booted iPhone 17 Pro simulator: record-video (clean SIGTERM finalization, playable MP4) and screenshot.
  • Android live smoke on emulator-5554: both sim-use android record-video and top-level sim-use record-video produce an ffprobe-valid H.264 MP4 (1080×2400) with clean SIGTERM finalization.

Groundwork for #78 (stream-video Android support), which lands separately on top of this.

🤖 Generated with Claude Code

onevcat added 2 commits July 29, 2026 10:29
…rget

The H.264 Annex B parser, passthrough muxer, AVAssetWriter encoder, frame
utilities, and output-path resolution were platform-neutral but lived in
iOSSimBackend, forcing the Android record-video orchestration into the
SimUse executable target (the only place with both backends in its dep
cone). Move them into a new SimUseVideo target (SimUseCore + system
frameworks only, FB*-free), and sink the generic process-control helpers
(CancellationFlag, OnceFlag, FirstErrorBox, cancellableSleep,
SignalObserver) into SimUseCore.

The single FB*-tied piece — VideoFrameUtilities.captureScreenshotData —
stays in iOSSimBackend as an extension. Pure restructuring, no behavior
change; groundwork for hosting Android video verbs in AndroidBackend (#78).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Signed-off-by: onevcat <onevcat@gmail.com>
With the video plumbing extracted to SimUseVideo, the Android recording
engine no longer needs to live inline in the SimUse executable target.
Move it into AndroidRecordVideoCommand and register it, giving
record-video the same three-surface layout as every other cross-platform
verb (top-level forwarder + `ios` + `android`); the top-level Android
branch now forwards to AndroidRecordVideoCommand.record(), symmetric to
AndroidScreenshotCommand.performScreenshot.

Flag validation is shared across all three surfaces via
VideoRecordingOptions in SimUseVideo so the contract cannot drift.
Flags and behavior are unchanged.

Verified live against emulator-5554: both `sim-use android record-video`
and top-level `sim-use record-video` produce a valid H.264 MP4 (ffprobe)
with clean SIGTERM finalization.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Signed-off-by: onevcat <onevcat@gmail.com>
@onevcat
onevcat merged commit a53eda3 into main Jul 29, 2026
4 checks passed
@onevcat
onevcat deleted the refactor/extract-simusevideo branch July 29, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant