Files
Grant Gilliam c347acbd97 Adapters: add Meet, Zoom, Teams (coloured border) + adapter registry
Front-loads the remaining visual adapters per the Signal→Meet→Zoom priority.
All three reuse GridCallAnalyzer's coloured-border (saturated) detection path
and share the new bottom-left name anchor:

- GridCallAnalyzer: generalise nameAtBottom:Bool into a NameAnchor enum
  (.bottomCenter for Signal's centered footer, .bottomLeft for Meet/Zoom/Teams
  where the name hugs the tile's bottom-left corner, .center for completeness).
  tileRect estimates the tile up-and-right of a bottom-left name.
- MeetAdapter (Google-blue ring, browser-hosted), ZoomAdapter (green/yellow
  border), TeamsAdapter (violet ring): coloured-border on, white-border off,
  bottom-left names. Geometry constants are first-pass pending real fixtures.
- AdapterRegistry.adapter(for:) maps CallDetector.DetectedApp → AppAdapter so
  VisualObserver can be constructed when live visual capture is wired in;
  unmapped apps degrade to audio-only.

Synthetic 4-tile tests: Meet picks each blue-bordered speaker with no
adjacent-tile bleed, Zoom picks the green-bordered speaker, and Signal's
white-only detector correctly ignores a coloured border. 18/18 XCTest pass.
2026-06-06 09:57:53 -05:00

39 lines
1.6 KiB
Swift

import Foundation
import CoreVideo
/// Signal Desktop adapter. Signal shows avatars/initials with a coloured ring
/// around the active speaker; names may also be available via the Electron
/// Accessibility tree (preferred over OCR when we enable it). Geometry/threshold
/// here are first-pass and will be calibrated against real Signal screenshots.
struct SignalAdapter: AppAdapter {
static let bundleIDs = ["org.whispersystems.signal-desktop"]
let adapterVersion = "signal-0.1.0"
let preferredFPS = 3
private let analyzer: GridCallAnalyzer
init() {
var config = GridCallAnalyzer.Config()
// Signal's speaking cue is a 3px WHITE rounded border (not coloured); the
// name is a bottom footer, so the tile extends up from it. Geometry tuned
// with real fixtures. (Gotchas, per Signal source: NO border in 1:1 calls
// fall back to mic-VAD/audio pill and in Speaker view the large tile is
// the speaker; both handled at a higher level later.)
config.nameAnchor = .bottomCenter
config.detectWhiteBorder = true
config.detectColoredBorder = false
config.tileExpandX = 2.4
config.tileExpandY = 4.8
self.analyzer = GridCallAnalyzer(config: config)
}
func analyze(frame: CVPixelBuffer, at t: TimeInterval) -> [SpeakerObservation] {
analyzer.analyze(pixelBuffer: frame, at: t)
}
// Exposed for fixture/synthetic tests.
func analyze(cgImage: CGImage, at t: TimeInterval) -> [SpeakerObservation] {
analyzer.analyze(cgImage: cgImage, at: t)
}
}