31 lines
1.1 KiB
Go
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
|
|
}
|