How kv4u/safescreen works
SafeScreen is a Windows privacy-screen application: it observes webcam frames, estimates whether the user is looking at the display, and protects the desktop when attention is absent or detection fails. The README documents the detection and protection stages, but their Dart sources are not present in the supplied tree, so those nodes have no source path. The sampled native code supports the in-memory Media Foundation capture path and the Windows camera plugin’s preview/record/photo functions; exact Dart orchestration is not visible.
Main entry points: mf_camera.cpp Flutter method channel · capture_controller.cpp Camera plugin controller · preview_handler.cpp Preview sample handler · capture_engine_listener.cpp Capture event listener
Components 19
Frame capture
- Media Foundation capture
windows/runner/mf_camera.cpp - Camera plugin controller
packages/camera_windows/windows/capture_controller.cpp - Preview sample handler
packages/camera_windows/windows/preview_handler.cpp - Capture event listener
packages/camera_windows/windows/capture_engine_listener.cpp
Attention detection
- BlazeFace detector
- Head pose estimator
- Gaze detector service
- Neutral calibration
- Second-face check
- Staleness failsafe
Screen protection
- Visibility decision
- Desktop blackout
- Tray controls
- User settings
Windows runtime
- Flutter app entry
windows/runner/main.cpp - Flutter method channel
windows/runner/mf_camera.cpp
Other components
- User
- Webcam
- TFLite runtime
Connections 24
- User → Flutter app entry: launches
- Flutter app entry → Flutter method channel: registers channel
- Flutter method channel → Media Foundation capture: starts or grabs
- Webcam → Media Foundation capture: supplies frames
- Media Foundation capture → Flutter method channel: returns frame bytes
- Flutter method channel → BlazeFace detector: provides frames
- BlazeFace detector → TFLite runtime: runs inference
- BlazeFace detector → Head pose estimator: returns keypoints
- Head pose estimator → Neutral calibration: provides pose
- Neutral calibration → Gaze detector service: provides neutral baseline
- Head pose estimator → Gaze detector service: provides pose
- BlazeFace detector → Second-face check: reports faces
- Gaze detector service → Visibility decision: reports attention
- Second-face check → Visibility decision: reports extra face
- Staleness failsafe → Visibility decision: forces protection
- Visibility decision → Desktop blackout: shows or hides
- User settings → Gaze detector service: sets sensitivity
- User settings → Second-face check: configures detection
- User settings → Tray controls: configures startup
- User → Tray controls: controls
- Webcam → Camera plugin controller: fallback capture
- Camera plugin controller → Preview sample handler: starts preview
- Preview sample handler → Capture event listener: sets sample callback
- Capture event listener → Camera plugin controller: forwards samples and events