Files
groundstation/internal/display/video.go
T
piotr b169a64ad5
Build Ground Station / build (push) Successful in 44s
feat: show no-WFB kiosk fallback only while video absent (#2)
2026-10-01 14:40:24 +02:00

31 lines
1.1 KiB
Go

package display
import "sync/atomic"
// VideoPresence is the shared decoded-video signal between a display target
// session and the templates it drives. Sessions update it from
// display-server events about the video output itself: a presented video
// window is presence, its unmap or destroy is video end. Nothing here
// inspects WFB or launcher processes, so a running-but-silent receiver never
// hides the fallback and the video pipeline is never touched.
type VideoPresence struct {
active atomic.Bool
}
// NewVideoPresence starts with video absent, so the fallback is visible
// before the first presented video output.
func NewVideoPresence() *VideoPresence {
return &VideoPresence{}
}
// Active reports whether decoded video output is being presented.
func (p *VideoPresence) Active() bool {
return p.active.Load()
}
// SetActive records video presence and reports whether the state changed, so
// callers can trigger exactly one redraw per lifecycle transition.
func (p *VideoPresence) SetActive(active bool) bool {
return p.active.Swap(active) != active
}