Skip to content

feat(native): add VideoToolbox H.264, Simlock AVCC, Android serve-emu, Duo controls, and floating device window (PN-DEVICE) - #461

Merged
rynfar merged 1 commit into
nativefrom
feat/native-device-h264-duo-float
Nov 20, 2026
Merged

rynfar merged 1 commit into
nativefrom
feat/native-device-h264-duo-float

Conversation

@rynfar

@rynfar rynfar commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Closes #249

Summary

Completes native Device panel parity (PN-DEVICE -> done) with macOS hardware H.264 decoding for Simlock/AVCC and Android serve-emu streams, iPhone Duo hinge/posture controls, and floating device windows:

  • crates/core/src/device/stream.rs:
    • Ported AvccDemuxer (1=description, 2=keyframe, 3=delta, 4=seed, 7=end Simlock lease-end JSON { reason }), avcC parser/builder, and Duo panel path /helper/<device>/panel/<panelId>/stream.avcc.
    • Ported Android serve-emu SEMU v1 packet parsing, Annex-B start-code (00 00 01 / 00 00 00 01) to 4-byte length-prefixed AVCC conversion with SPS/PPS extraction, and JSON control/input framing (touch, key, text chunked to 300 UTF-8 bytes / 64 chunks, button, reset-video, video-session).
    • Ported DuoCommand, DuoControlQueue, ControlReply (0x90), and duo_fold_state/duo_hold_orientation.
    • Updated transport(platform, host) to select Transport::Avcc (Simlock) and Transport::ServeEmu (Android) on macOS while keeping a clear unsupported error on non-macOS platforms.
  • crates/client/src/device_stream/{mod.rs, h264.rs}:
    • Added a safe RAII wrapper around macOS VideoToolbox.framework, CoreMedia.framework, CoreVideo.framework, and CoreFoundation.framework (zero new crates/binaries) that builds CMVideoFormatDescription from H.264 parameter sets, decodes AVCC access units synchronously to tight RGBA pixels, rebuilds cleanly on SPS/PPS changes, and invalidates/releases cleanly on Drop.
    • Generalized Frame to Frame::Jpeg(Arc<[u8]>) | Frame::Rgba { width, height, bytes } while keeping Frame::len() backward-compatible.
    • Wired Simlock AVCC streaming (halting reconnects immediately on tag 7 lease-end frames, pingdotgg/t3code#35994), Android serve-emu video + input socket, and Duo control request/reply tracking.
  • crates/app/src/device/{mod.rs, screen.rs, screen/float.rs}:
    • Uploaded Frame::Rgba directly to GPUI Arc<RenderImage> (with RGBA -> BGRA atlas conversion and portrait-framebuffer rotation), forwarded Android text/key/paste input (DeviceInput::Text/AndroidKey), and rendered DeviceDuoControls (Closed 0°, Peek 30°, Book/Laptop 90°, Open/Flat 180°, Laptop stand, Tent stand) when screen.supports_hinge_angle.
    • Implemented Float device over chat using a dedicated WindowKind::Floating secondary GPUI window with compact draggable header + Dock-back / Close controls (guarded off in test/snapshot builds; zero workspace.rs edits).
  • apps/native/parity/LEDGER.md:
    • Marked PN-DEVICE as done (cleared #249), noting Three.js WebGL 3D .glb phone/Magic Keyboard mesh is web-only while native ships the 2D framed viewport with full iOS/Android/Simlock H.264, Duo, Float, AX, and tools parity.

Verification Gates

  1. vp fmt --check apps/native/parity/LEDGER.md: PASS
  2. node apps/native/scripts/gen-theme.ts --check: PASS (tokens.rs up to date)
  3. node apps/native/conformance/generate.ts --check: PASS
  4. node --test apps/native/parity/sync.test.ts: PASS (47/47)
  5. CARGO_INCREMENTAL=0 cargo clippy --manifest-path apps/native/Cargo.toml --workspace --all-targets -- -D warnings: PASS (0 warnings)
  6. CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-core: PASS (1870 unit + 8 conformance = 1878 passed, 0 failed)
  7. CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-client -- --test-threads=1: PASS (171 passed, 0 failed — includes real macOS VideoToolbox 32x16->64x32 decode/rebuild, Simlock AVCC tag-7 lease-end, Android serve-emu, and Duo round-trip)
  8. T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native -- --test-threads=1: PASS (217 passed, 0 failed)
  9. T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native --features snapshot device -- --test-threads=1: PASS (12 passed, 0 failed)
  10. CARGO_INCREMENTAL=0 cargo build --manifest-path apps/native/Cargo.toml -p t3-native: PASS

Implemented by h2-device on Antigravity.

…, Duo controls, and floating device window (PN-DEVICE)
@rynfar
rynfar merged commit fbe064e into native Nov 20, 2026
2 checks passed
@rynfar
rynfar deleted the feat/native-device-h264-duo-float branch November 20, 2026 06:59
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