internal

package
v0.0.0-...-3c84d77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package internal provides shared types for the Switchframe server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFullSnapshot

func ApplyFullSnapshot(ctx context.Context, snap FullStateSnapshot, target SnapshotApplyTarget) []string

ApplyFullSnapshot restores engine state from a FullStateSnapshot. It is best-effort: individual failures are collected as warning strings rather than aborting the entire apply. This is the inverse of state capture.

Apply order is intentional — transition config is set before switching so that Cut/SetPreview use the correct transition parameters, audio is set before program source to avoid brief wrong-level output, etc.

Returns a list of human-readable warning strings (empty on full success).

func WaitChanTimeout

func WaitChanTimeout(ch <-chan struct{}, timeout time.Duration) bool

WaitChanTimeout waits for a channel to close with a timeout. Returns true if the channel closed, false if timed out.

func WaitWithTimeout

func WaitWithTimeout(wg *sync.WaitGroup, timeout time.Duration) bool

WaitWithTimeout waits for a WaitGroup with a timeout. Returns true if the WaitGroup completed, false if timed out.

Types

type AISegmentConfig

type AISegmentConfig struct {
	Enabled     bool    `json:"enabled"`
	Sensitivity float32 `json:"sensitivity"`
	EdgeSmooth  float32 `json:"edgeSmooth"`
	Background  string  `json:"background"`
}

AISegmentConfig describes the AI segmentation configuration for a source. Background values: "" or "transparent" (pass-through), "blur:N" (N=1-50), "color:RRGGBB" (hex color).

type AISegmentationState

type AISegmentationState struct {
	Available bool                       `json:"available"`
	ModelName string                     `json:"modelName,omitempty"`
	Sources   map[string]AISegmentConfig `json:"sources,omitempty"`
}

AISegmentationState is broadcast in ControlRoomState when AI segmentation is available (GPU + TensorRT). Omitted entirely on non-GPU builds.

type ASRState

type ASRState struct {
	Available         bool            `json:"available"`
	Active            bool            `json:"active"`
	Backend           string          `json:"backend"`
	AvailableBackends []string        `json:"availableBackends,omitempty"`
	ModelName         string          `json:"modelName,omitempty"`
	BackendConfig     json.RawMessage `json:"backendConfig,omitempty"`
	ConfidenceFilter  string          `json:"confidenceFilter,omitempty"`
	SpeakerDetection  string          `json:"speakerDetection,omitempty"`
}

ASRState represents the ASR system state for ControlRoomState broadcast.

type AudioChannel

type AudioChannel struct {
	Level         float64            `json:"level"` // dB (-inf to +12)
	Trim          float64            `json:"trim"`  // dB (-20 to +20), input gain
	Muted         bool               `json:"muted"`
	AFV           bool               `json:"afv"`                   // audio-follows-video
	PhaseInvert   bool               `json:"phaseInvert,omitempty"` // 180-degree phase flip
	Balance       float64            `json:"balance"`               // -1.0 (L) to +1.0 (R), 0 = center
	HPFFrequency  float64            `json:"hpfFrequency,omitempty"`
	HPFEnabled    bool               `json:"hpfEnabled,omitempty"`
	PeakL         float64            `json:"peakL"` // dBFS, updated per frame
	PeakR         float64            `json:"peakR"` // dBFS
	EQ            [3]EQBand          `json:"eq"`
	Compressor    CompressorSettings `json:"compressor"`
	GainReduction float64            `json:"gainReduction"` // compressor GR in dB
	Gate          GateSettings       `json:"gate"`
	GateEnabled   bool               `json:"gateEnabled,omitempty"`
	GateReduction float64            `json:"gateReduction,omitempty"` // gate GR in dB
	AudioDelayMs  int                `json:"audioDelayMs,omitempty"`  // lip-sync delay (0-500ms)
}

AudioChannel describes the audio mixer state for a single source.

type AudioChannelSnapshot

type AudioChannelSnapshot struct {
	Level        float64            `json:"level"`
	Trim         float64            `json:"trim"`
	Muted        bool               `json:"muted"`
	AFV          bool               `json:"afv"`
	PhaseInvert  bool               `json:"phaseInvert,omitempty"`
	Balance      float64            `json:"balance"`
	HPFFrequency float64            `json:"hpfFrequency,omitempty"`
	HPFEnabled   bool               `json:"hpfEnabled,omitempty"`
	EQ           [3]EQBandSnapshot  `json:"eq"`
	Compressor   CompressorSnapshot `json:"compressor"`
	Gate         GateSnapshot       `json:"gate"`
	AudioDelayMs int                `json:"audioDelayMs,omitempty"`
}

AudioChannelSnapshot captures the restorable audio state for a single channel. Omits transient metering data (PeakL, PeakR, GainReduction, GateReduction).

type AudioMasterSnapshot

type AudioMasterSnapshot struct {
	MasterLevel      float64 `json:"masterLevel"`
	LimiterThreshold float64 `json:"limiterThreshold"`
	LimiterCeiling   float64 `json:"limiterCeiling"`
}

AudioMasterSnapshot captures the master bus settings. Omits transient data (ProgramPeak, GainReduction, LUFS meters).

type CBRStatus

type CBRStatus struct {
	Enabled          bool  `json:"enabled"`
	MuxrateBps       int64 `json:"muxrateBps"`
	NullPacketsTotal int64 `json:"nullPacketsTotal"`
	RealBytesTotal   int64 `json:"realBytesTotal"`
	PadBytesTotal    int64 `json:"padBytesTotal"`
	BurstTicksTotal  int64 `json:"burstTicksTotal"`
}

CBRStatus describes the CBR pacer state for ControlRoomState broadcast.

type CaptionState

type CaptionState struct {
	Mode           string          `json:"mode"`
	AuthorBuffer   string          `json:"authorBuffer,omitempty"`
	SourceCaptions map[string]bool `json:"sourceCaptions,omitempty"`
}

CaptionState represents the current closed captioning state.

type ClipInfo

type ClipInfo struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Source     string `json:"source"`
	DurationMs int64  `json:"durationMs"`
	Width      int    `json:"width"`
	Height     int    `json:"height"`
	Ephemeral  bool   `json:"ephemeral,omitempty"`
	Loop       bool   `json:"loop"`
}

ClipInfo is the broadcast-friendly clip metadata.

type ClipPlayerInfo

type ClipPlayerInfo struct {
	ID       int     `json:"id"`
	ClipID   string  `json:"clipId,omitempty"`
	ClipName string  `json:"clipName,omitempty"`
	State    string  `json:"state"`
	Speed    float64 `json:"speed,omitempty"`
	Position float64 `json:"position,omitempty"`
	Loop     bool    `json:"loop,omitempty"`
}

ClipPlayerInfo is the broadcast state of a single clip player.

type ClipPlayerSnapshot

type ClipPlayerSnapshot struct {
	ID     int     `json:"id"`
	ClipID string  `json:"clipId,omitempty"`
	State  string  `json:"state"`
	Speed  float64 `json:"speed,omitempty"`
	Loop   bool    `json:"loop,omitempty"`
}

ClipPlayerSnapshot captures the restorable state of a single clip player. Omits transient data (Position — playback cursor is not transferable).

type ClipPositionSnapshot

type ClipPositionSnapshot struct {
	ClipName    string  `json:"clipName"`
	PlayerIndex int     `json:"playerIndex"`
	PositionMs  int64   `json:"positionMs"`
	State       string  `json:"state"`
	Speed       float64 `json:"speed"`
	Loop        bool    `json:"loop"`
}

ClipPositionSnapshot captures a clip player's playback position (name-based so that the receiving engine can look up the clip by name rather than ID).

type ClipUploadProgress

type ClipUploadProgress struct {
	Stage    string `json:"stage"`   // "uploading","analyzing","transcoding","validating"
	Percent  int    `json:"percent"` // 0-100 within current stage
	Filename string `json:"filename,omitempty"`
}

ClipUploadProgress tracks server-side clip upload stages for state broadcast.

type ClockSyncInfo

type ClockSyncInfo struct {
	Synchronized  bool   `json:"synchronized"`
	WindowDriftUs int64  `json:"windowDriftUs"`
	Source        string `json:"source"`
}

ClockSyncInfo reports clock-synchronization status to the browser so the operator bar can surface PTP / NTP discipline failures. Older builds silently hardcoded synchronized=true, masking grandmaster faults in active-active deployments. Mirrors clock.SyncState; kept here to avoid an internal→clock dep cycle.

Consumer contract: check Source alongside Synchronized. When Source == "systemclock-initializing", Synchronized=true is a conservative default (the sampler has not yet produced a verdict) — do NOT red-alarm. Treat it as "unknown, don't trust, don't alert."

type ColorGradeSnapshot

type ColorGradeSnapshot struct {
	Enabled   bool    `json:"enabled"`
	LookName  string  `json:"lookName"`
	LookGroup string  `json:"lookGroup"`
	Intensity float32 `json:"intensity"`
}

ColorGradeSnapshot captures the color grading configuration. Omits the Available list (static, not engine state).

type ColorGradeState

type ColorGradeState struct {
	Enabled   bool            `json:"enabled"`
	LookName  string          `json:"lookName"`
	LookGroup string          `json:"lookGroup"`
	Intensity float32         `json:"intensity"`
	Available []LookMetadata  `json:"available"`
	Corrector *CorrectorState `json:"corrector,omitempty"`
}

ColorGradeState represents the color grading state in ControlRoomState.

type CommandError

type CommandError struct {
	Seq   uint64 `json:"seq"`
	Error string `json:"error"`
}

CommandError records a single failed command execution (sequence + error string).

type CommsParticipant

type CommsParticipant struct {
	OperatorID string `json:"operatorId"`
	Name       string `json:"name"`
	Muted      bool   `json:"muted"`
	Speaking   bool   `json:"speaking"`
}

CommsParticipant represents a single operator in the voice comms channel.

type CommsState

type CommsState struct {
	Active       bool               `json:"active"`
	Participants []CommsParticipant `json:"participants"`
}

CommsState represents the current operator voice comms state.

type CompressorSettings

type CompressorSettings struct {
	Threshold  float64 `json:"threshold"`
	Ratio      float64 `json:"ratio"`
	Attack     float64 `json:"attack"`
	Release    float64 `json:"release"`
	MakeupGain float64 `json:"makeupGain"`
}

CompressorSettings describes the settings for a channel compressor.

type CompressorSnapshot

type CompressorSnapshot struct {
	Threshold  float64 `json:"threshold"`
	Ratio      float64 `json:"ratio"`
	Attack     float64 `json:"attack"`
	Release    float64 `json:"release"`
	MakeupGain float64 `json:"makeupGain"`
}

CompressorSnapshot captures channel compressor settings.

type ConnectionInfo

type ConnectionInfo struct {
	Domain         string `json:"domain,omitempty"`
	SRTIngestPort  int    `json:"srtIngestPort,omitempty"`
	SRTOutputPorts []int  `json:"srtOutputPorts,omitempty"`
}

ConnectionInfo holds SRT connection details for the UI.

type ControlRoomState

type ControlRoomState struct {
	ProgramSource            string                  `json:"programSource"`
	PreviewSource            string                  `json:"previewSource"`
	TransitionType           string                  `json:"transitionType"`
	TransitionDurationMs     int                     `json:"transitionDurationMs,omitempty"`
	TransitionPosition       float64                 `json:"transitionPosition,omitempty"`
	TransitionEasing         string                  `json:"transitionEasing,omitempty"`
	InTransition             bool                    `json:"inTransition,omitempty"`
	FTBActive                bool                    `json:"ftbActive,omitempty"`
	FTBDurationMs            int                     `json:"ftbDurationMs,omitempty"`
	TransitionAbortThreshold float64                 `json:"transitionAbortThreshold,omitempty"`
	DSKFadeDurationMs        int                     `json:"dskFadeDurationMs,omitempty"`
	AudioChannels            map[string]AudioChannel `json:"audioChannels"`
	MasterLevel              float64                 `json:"masterLevel"`
	ProgramPeak              [2]float64              `json:"programPeak"`
	GainReduction            float64                 `json:"gainReduction,omitempty"`
	Limiter                  *LimiterSettings        `json:"limiter,omitempty"`
	MomentaryLUFS            float64                 `json:"momentaryLufs,omitempty"`
	ShortTermLUFS            float64                 `json:"shortTermLufs,omitempty"`
	IntegratedLUFS           float64                 `json:"integratedLufs,omitempty"`
	TallyState               map[string]string       `json:"tallyState"`
	Recording                *RecordingStatus        `json:"recording,omitempty"`
	SRTOutput                *SRTOutputStatus        `json:"srtOutput,omitempty"`
	Destinations             []DestinationInfo       `json:"destinations,omitempty"`
	Sources                  map[string]SourceInfo   `json:"sources"`
	Presets                  []PresetInfo            `json:"presets,omitempty"`
	Graphics                 *GraphicsState          `json:"graphics,omitempty"`
	Layout                   *LayoutState            `json:"layout,omitempty"`
	Replay                   *ReplayState            `json:"replay,omitempty"`
	ClipPlayers              []ClipPlayerInfo        `json:"clipPlayers,omitempty"`
	ClipCount                int                     `json:"clipCount,omitempty"`
	ClipUpload               *ClipUploadProgress     `json:"clipUpload,omitempty"`
	Operators                []OperatorInfo          `json:"operators,omitempty"`
	Locks                    map[string]LockInfo     `json:"locks,omitempty"`
	PipelineFormat           *PipelineFormatInfo     `json:"pipelineFormat,omitempty"`
	Encoder                  *EncoderState           `json:"encoder,omitempty"`
	SCTE35                   *SCTE35State            `json:"scte35,omitempty"`
	CBR                      *CBRStatus              `json:"cbr,omitempty"`
	ConnectionInfo           *ConnectionInfo         `json:"connectionInfo,omitempty"`
	Captions                 *CaptionState           `json:"captions,omitempty"`
	Comms                    *CommsState             `json:"comms,omitempty"`
	STMap                    *STMapState             `json:"stmap,omitempty"`
	AISegmentation           *AISegmentationState    `json:"aiSegmentation,omitempty"`
	NeuralKey                *NeuralKeyState         `json:"neuralKey,omitempty"`
	ASR                      *ASRState               `json:"asr,omitempty"`
	Macro                    *MacroExecutionState    `json:"macro,omitempty"`
	ColorGrade               *ColorGradeState        `json:"colorGrade,omitempty"`
	Playout                  *PlayoutState           `json:"playout,omitempty"`
	PeerReachable            *bool                   `json:"peerReachable,omitempty"` // nil when no peer configured
	PeerLastSeenMs           int64                   `json:"peerLastSeenMs,omitempty"`
	EngineLabel              string                  `json:"engineLabel,omitempty"` // "" (standalone), "a", or "b"
	Role                     string                  `json:"role,omitempty"`        // "standalone" | "leader" | "follower-healthy" | "follower-partitioned"
	EngineBURL               string                  `json:"engineBUrl,omitempty"`
	SessionID                string                  `json:"sessionId,omitempty"`
	LastChangedBy            string                  `json:"lastChangedBy,omitempty"`
	Seq                      uint64                  `json:"seq"`
	LastCommandSeq           uint64                  `json:"lastCommandSeq"`
	LastExecutedSeq          uint64                  `json:"lastExecutedSeq"`
	LastExecutedErr          string                  `json:"lastExecutedErr,omitempty"`
	LateCommands             int64                   `json:"lateCommands,omitempty"`
	RecentCommandErrors      []CommandError          `json:"recentCommandErrors,omitempty"`
	ClockSync                ClockSyncInfo           `json:"clockSync"`
	Timestamp                int64                   `json:"timestamp"`
}

ControlRoomState is the full state of the switcher control room, broadcast to all connected browsers via the MoQ "control" track.

type CorrectorState

type CorrectorState = colorgrade.CorrectorState

CorrectorState is an alias for colorgrade.CorrectorState (single source of truth).

type CurvePoint

type CurvePoint = colorgrade.CurvePoint

CurvePoint is an alias for colorgrade.CurvePoint (single source of truth).

type DVEBorderSnapshot

type DVEBorderSnapshot struct {
	Width        float64 `json:"width"`
	ColorY       byte    `json:"colorY"`
	ColorCb      byte    `json:"colorCb"`
	ColorCr      byte    `json:"colorCr"`
	CornerRadius float64 `json:"cornerRadius,omitempty"`
	Softness     float64 `json:"softness,omitempty"`
	InnerWidth   float64 `json:"innerWidth,omitempty"`
}

DVEBorderSnapshot captures DVE border configuration.

type DVEBorderState

type DVEBorderState struct {
	Width        float64 `json:"width"`
	ColorY       byte    `json:"colorY"`
	ColorCb      byte    `json:"colorCb"`
	ColorCr      byte    `json:"colorCr"`
	CornerRadius float64 `json:"cornerRadius,omitempty"`
	Softness     float64 `json:"softness,omitempty"`
	InnerWidth   float64 `json:"innerWidth,omitempty"`
}

DVEBorderState holds DVE border configuration for state broadcast.

type DVEPresetInfo

type DVEPresetInfo struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Builtin bool   `json:"builtin,omitempty"`
}

DVEPresetInfo is a summary of a DVE preset for state broadcast.

type DVEShadowSnapshot

type DVEShadowSnapshot struct {
	Enabled bool    `json:"enabled"`
	OffsetX float64 `json:"offsetX,omitempty"`
	OffsetY float64 `json:"offsetY,omitempty"`
	Blur    float64 `json:"blur,omitempty"`
	Opacity float64 `json:"opacity,omitempty"`
	ColorY  byte    `json:"colorY,omitempty"`
}

DVEShadowSnapshot captures DVE shadow configuration.

type DVEShadowState

type DVEShadowState struct {
	Enabled bool    `json:"enabled"`
	OffsetX float64 `json:"offsetX,omitempty"`
	OffsetY float64 `json:"offsetY,omitempty"`
	Blur    float64 `json:"blur,omitempty"`
	Opacity float64 `json:"opacity,omitempty"`
	ColorY  byte    `json:"colorY,omitempty"`
}

DVEShadowState holds DVE shadow configuration for state broadcast.

type DVESlotSnapshot

type DVESlotSnapshot struct {
	SourceKey    string             `json:"sourceKey"`
	Enabled      bool               `json:"enabled"`
	ZOrder       int                `json:"zOrder"`
	PositionX    float64            `json:"positionX"`
	PositionY    float64            `json:"positionY"`
	Width        float64            `json:"width"`
	Height       float64            `json:"height"`
	RotationDeg  float64            `json:"rotationDeg,omitempty"`
	AnchorX      float64            `json:"anchorX,omitempty"`
	AnchorY      float64            `json:"anchorY,omitempty"`
	PerspectiveX float64            `json:"perspectiveX,omitempty"`
	PerspectiveY float64            `json:"perspectiveY,omitempty"`
	CropTop      float64            `json:"cropTop,omitempty"`
	CropBottom   float64            `json:"cropBottom,omitempty"`
	CropLeft     float64            `json:"cropLeft,omitempty"`
	CropRight    float64            `json:"cropRight,omitempty"`
	CropSoftness float64            `json:"cropSoftness,omitempty"`
	Opacity      float64            `json:"opacity,omitempty"`
	ScaleMode    string             `json:"scaleMode,omitempty"`
	CropAnchor   [2]float64         `json:"cropAnchor,omitempty"`
	Border       *DVEBorderSnapshot `json:"border,omitempty"`
	Shadow       *DVEShadowSnapshot `json:"shadow,omitempty"`

	// Image effects
	DefocusRadius float64 `json:"defocusRadius,omitempty"`
	MirrorH       bool    `json:"mirrorH,omitempty"`
	MirrorV       bool    `json:"mirrorV,omitempty"`
	MosaicSize    int     `json:"mosaicSize,omitempty"`
	Saturation    float64 `json:"saturation,omitempty"`
	Brightness    float64 `json:"brightness,omitempty"`
	Contrast      float64 `json:"contrast,omitempty"`

	// 3D transforms
	Mode3D  string  `json:"mode3d,omitempty"`
	RotateX float64 `json:"rotateX,omitempty"`
	RotateY float64 `json:"rotateY,omitempty"`
	RotateZ float64 `json:"rotateZ,omitempty"`
}

DVESlotSnapshot captures the full DVE transform for a single layout slot. Omits transient data (Animating flag).

type DVESlotState

type DVESlotState struct {
	PositionX     float64         `json:"positionX"`
	PositionY     float64         `json:"positionY"`
	Width         float64         `json:"width"`
	Height        float64         `json:"height"`
	RotationDeg   float64         `json:"rotationDeg,omitempty"`
	AnchorX       float64         `json:"anchorX,omitempty"`
	AnchorY       float64         `json:"anchorY,omitempty"`
	PerspectiveX  float64         `json:"perspectiveX,omitempty"`
	PerspectiveY  float64         `json:"perspectiveY,omitempty"`
	CropTop       float64         `json:"cropTop,omitempty"`
	CropBottom    float64         `json:"cropBottom,omitempty"`
	CropLeft      float64         `json:"cropLeft,omitempty"`
	CropRight     float64         `json:"cropRight,omitempty"`
	CropSoftness  float64         `json:"cropSoftness,omitempty"`
	Opacity       float64         `json:"opacity,omitempty"`
	Border        *DVEBorderState `json:"border,omitempty"`
	Shadow        *DVEShadowState `json:"shadow,omitempty"`
	DefocusRadius float64         `json:"defocusRadius,omitempty"`
	MirrorH       bool            `json:"mirrorH,omitempty"`
	MirrorV       bool            `json:"mirrorV,omitempty"`
	MosaicSize    int             `json:"mosaicSize,omitempty"`
	Saturation    float64         `json:"saturation,omitempty"`
	Brightness    float64         `json:"brightness,omitempty"`
	Contrast      float64         `json:"contrast,omitempty"`
	Mode3D        string          `json:"mode3d,omitempty"`
	RotateX       float64         `json:"rotateX,omitempty"`
	RotateY       float64         `json:"rotateY,omitempty"`
	RotateZ       float64         `json:"rotateZ,omitempty"`
}

DVESlotState holds the full DVE transform parameters for a layout slot.

type DestinationInfo

type DestinationInfo struct {
	ID             string `json:"id"`
	Name           string `json:"name,omitempty"`
	Type           string `json:"type"`
	Address        string `json:"address,omitempty"`
	Port           int    `json:"port,omitempty"`
	URL            string `json:"url,omitempty"` // RTMP destinations
	State          string `json:"state"`
	BytesWritten   int64  `json:"bytesWritten,omitempty"`
	DroppedPackets int64  `json:"droppedPackets,omitempty"`
	Connections    int    `json:"connections,omitempty"`
	Error          string `json:"error,omitempty"`
}

DestinationInfo describes an output destination for ControlRoomState broadcast.

type DestinationSnapshot

type DestinationSnapshot struct {
	ID     string                    `json:"id"`
	Config DestinationSnapshotConfig `json:"config"`
	Active bool                      `json:"active"`
}

DestinationSnapshot captures an output destination's config and state.

type DestinationSnapshotConfig

type DestinationSnapshotConfig struct {
	Type     string `json:"type"`
	Address  string `json:"address,omitempty"`
	Port     int    `json:"port,omitempty"`
	URL      string `json:"url,omitempty"`
	Latency  int    `json:"latency,omitempty"`
	StreamID string `json:"streamID,omitempty"`
	Name     string `json:"name,omitempty"`
	Engine   string `json:"engine,omitempty"`
}

DestinationSnapshotConfig captures output destination configuration without importing the output package (avoids circular imports).

type EQBand

type EQBand struct {
	Frequency float64 `json:"frequency"`
	Gain      float64 `json:"gain"`
	Q         float64 `json:"q"`
	Enabled   bool    `json:"enabled"`
}

EQBand describes the settings for a single EQ band.

type EQBandSnapshot

type EQBandSnapshot struct {
	Frequency float64 `json:"frequency"`
	Gain      float64 `json:"gain"`
	Q         float64 `json:"q"`
	Enabled   bool    `json:"enabled"`
}

EQBandSnapshot captures the settings for a single parametric EQ band.

type EncoderInfo

type EncoderInfo struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	IsDefault   bool   `json:"isDefault"`
}

EncoderInfo describes an available video encoder backend.

type EncoderState

type EncoderState struct {
	Current   string        `json:"current"`
	Available []EncoderInfo `json:"available"`
}

EncoderState describes the current encoder and available alternatives.

type FullStateSnapshot

type FullStateSnapshot struct {
	// Schema version for forward/backward compatibility.
	Version string `json:"version"`

	// Unix microseconds when this snapshot was captured.
	CapturedAt int64 `json:"capturedAt"`

	ProgramSource string `json:"programSource"`
	PreviewSource string `json:"previewSource"`

	TransitionType       string `json:"transitionType"`
	TransitionDurationMs int    `json:"transitionDurationMs"`
	TransitionEasing     string `json:"transitionEasing"`
	FTBActive            bool   `json:"ftbActive,omitempty"`

	// Encoder is the active video encoder name (e.g., "libx264", "h264_nvenc").
	// Applied only if the target engine has this encoder available.
	Encoder string `json:"encoder,omitempty"`

	// AudioChannels maps source key to its audio channel configuration.
	AudioChannels map[string]AudioChannelSnapshot `json:"audioChannels"`

	AudioMaster AudioMasterSnapshot `json:"audioMaster"`

	Graphics []GraphicsLayerSnapshot `json:"graphics,omitempty"`

	Layout LayoutSnapshot `json:"layout"`

	// CaptionMode is "off", "passthrough", or "author".
	CaptionMode string `json:"captionMode"`

	ClipPlayers []ClipPlayerSnapshot `json:"clipPlayers,omitempty"`

	// Sources maps source key to its label and position configuration.
	Sources map[string]SourceConfigSnapshot `json:"sources,omitempty"`

	// UpstreamKeys maps source key to its upstream key configuration.
	UpstreamKeys map[string]UpstreamKeySnapshot `json:"upstreamKeys,omitempty"`

	ColorGrade *ColorGradeSnapshot `json:"colorGrade,omitempty"`

	STMaps *STMapSnapshot `json:"stmaps,omitempty"`

	Recording           *RecordingSnapshot          `json:"recording,omitempty"`
	OutputDestinations  []DestinationSnapshot       `json:"outputDestinations,omitempty"`
	ReplayMarks         *ReplayMarksSnapshot        `json:"replayMarks,omitempty"`
	ReplayPlayer        *ReplayPlayerSnapshot       `json:"replayPlayer,omitempty"`
	MacroExecution      *MacroExecutionSnapshot     `json:"macroExecution,omitempty"`
	OperatorSessions    []OperatorSessionSnapshot   `json:"operatorSessions,omitempty"`
	CommsParticipants   []string                    `json:"commsParticipants,omitempty"`
	PlayoutChannels     []PlayoutChannelSnapshot    `json:"playoutChannels,omitempty"`
	SCTE35Active        []SCTE35ActiveEventSnapshot `json:"scte35Active,omitempty"`
	StingerLoaded       []string                    `json:"stingerLoaded,omitempty"`
	ClipPlayerPositions []ClipPositionSnapshot      `json:"clipPlayerPositions,omitempty"`
}

FullStateSnapshot captures the complete restorable engine state for multi-region active-active redundancy. When a browser detects sustained state divergence between engines, it pulls a full snapshot from the authoritative engine and pushes it to the lagging one.

This is a "super preset" — it covers everything needed to reconstruct the complete engine state. Unlike ControlRoomState (which includes transient metering data for real-time display), this only includes restorable state.

The Version field enables future schema evolution. The CapturedAt field (Unix microseconds) enables staleness detection.

type GateSettings

type GateSettings struct {
	Threshold float64 `json:"threshold"`
	Range     float64 `json:"range"`
	Attack    float64 `json:"attack"`
	Release   float64 `json:"release"`
	Hold      float64 `json:"hold"`
}

GateSettings describes the settings for a channel noise gate.

type GateSnapshot

type GateSnapshot struct {
	Threshold float64 `json:"threshold"`
	Range     float64 `json:"range"`
	Attack    float64 `json:"attack"`
	Release   float64 `json:"release"`
	Hold      float64 `json:"hold"`
	Enabled   bool    `json:"enabled"`
}

GateSnapshot captures channel noise gate settings.

type GraphicsLayerSnapshot

type GraphicsLayerSnapshot struct {
	ID        int    `json:"id"`
	Active    bool   `json:"active"`
	ZOrder    int    `json:"zOrder"`
	X         int    `json:"x"`
	Y         int    `json:"y"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Template  string `json:"template,omitempty"`
	ImageName string `json:"imageName,omitempty"`
	HTML5URL  string `json:"html5Url,omitempty"`
}

GraphicsLayerSnapshot captures the restorable state of a single DSK layer. Omits transient data (FadePosition, AnimationState, sequence state). HTML5URL is configuration (not transient status), so it is included.

type GraphicsLayerState

type GraphicsLayerState struct {
	ID                 int            `json:"id"`
	Template           string         `json:"template,omitempty"`
	Active             bool           `json:"active"`
	FadePosition       float64        `json:"fadePosition,omitempty"`
	AnimationMode      string         `json:"animationMode,omitempty"`
	AnimationHz        float64        `json:"animationHz,omitempty"`
	ZOrder             int            `json:"zOrder"`
	X                  int            `json:"x"`
	Y                  int            `json:"y"`
	Width              int            `json:"width"`
	Height             int            `json:"height"`
	ImageName          string         `json:"imageName,omitempty"`
	ImageWidth         int            `json:"imageWidth,omitempty"`
	ImageHeight        int            `json:"imageHeight,omitempty"`
	HTML5URL           string         `json:"html5Url,omitempty"`
	HTML5Format        string         `json:"html5Format,omitempty"`
	HTML5Status        string         `json:"html5Status,omitempty"`
	HTML5DataSchema    map[string]any `json:"html5DataSchema,omitempty"`
	SequenceLoaded     bool           `json:"sequenceLoaded,omitempty"`
	SequencePhase      string         `json:"sequencePhase,omitempty"`
	SequenceProcessing bool           `json:"sequenceProcessing,omitempty"`
	SequenceProgress   float64        `json:"sequenceProgress,omitempty"`
	SequenceSpeed      float64        `json:"sequenceSpeed,omitempty"`
}

GraphicsLayerState is the JSON-serializable state for a single graphics layer.

type GraphicsState

type GraphicsState struct {
	Layers        []GraphicsLayerState `json:"layers,omitempty"`
	ProgramWidth  int                  `json:"programWidth,omitempty"`
	ProgramHeight int                  `json:"programHeight,omitempty"`
}

GraphicsState is the JSON-serializable state for the downstream keyer (DSK) graphics overlay layers, included in ControlRoomState.

type LayoutSlotState

type LayoutSlotState struct {
	ID         int           `json:"id"`
	SourceKey  string        `json:"sourceKey"`
	Enabled    bool          `json:"enabled"`
	X          int           `json:"x"`
	Y          int           `json:"y"`
	Width      int           `json:"width"`
	Height     int           `json:"height"`
	ZOrder     int           `json:"zOrder"`
	Animating  bool          `json:"animating,omitempty"`
	ScaleMode  string        `json:"scaleMode,omitempty"`
	CropAnchor [2]float64    `json:"cropAnchor,omitempty"`
	DVE        *DVESlotState `json:"dve,omitempty"`
}

LayoutSlotState represents a single layout slot in the state broadcast.

type LayoutSnapshot

type LayoutSnapshot struct {
	ActivePreset string            `json:"activePreset"`
	Slots        []DVESlotSnapshot `json:"slots,omitempty"`
}

LayoutSnapshot captures the full DVE layout configuration.

type LayoutState

type LayoutState struct {
	ActivePreset string            `json:"activePreset"`
	Slots        []LayoutSlotState `json:"slots"`
	DVEPresets   []DVEPresetInfo   `json:"dvePresets,omitempty"`
	DVEAnimating bool              `json:"dveAnimating,omitempty"`
}

LayoutState represents the current layout configuration for state broadcast.

type LimiterSettings

type LimiterSettings struct {
	Threshold     float64 `json:"threshold"`
	Ceiling       float64 `json:"ceiling"`
	GainReduction float64 `json:"gainReduction"`
	TruePeak      float64 `json:"truePeak"`
}

LimiterSettings describes the master bus limiter state. Threshold and Ceiling are in dBTP (ITU-R BS.1770-4 Annex 2 true-peak). TruePeak is the measured true-peak from the most recent mixer block, in dBTP; math.Inf(-1) when the mixer is idle.

type LockInfo

type LockInfo struct {
	HolderID   string `json:"holderId"`
	HolderName string `json:"holderName"`
	AcquiredAt int64  `json:"acquiredAt"` // Unix ms
}

LockInfo describes an active subsystem lock for ControlRoomState broadcast.

type LookMetadata

type LookMetadata struct {
	Name        string `json:"name"`
	Group       string `json:"group"`
	Description string `json:"description"`
	Builtin     bool   `json:"builtin"`
}

LookMetadata describes a single available color look with group/description.

type MacroExecutionSnapshot

type MacroExecutionSnapshot struct {
	MacroID   string `json:"macroId"`
	StepIndex int    `json:"stepIndex"`
	State     string `json:"state"` // "running", "paused"
}

MacroExecutionSnapshot captures a running macro's position.

type MacroExecutionState

type MacroExecutionState struct {
	Running     bool             `json:"running"`
	MacroName   string           `json:"macroName"`
	Steps       []MacroStepState `json:"steps"`
	CurrentStep int              `json:"currentStep"`
	Error       string           `json:"error,omitempty"`
}

MacroExecutionState represents the progress of a running macro.

type MacroStepState

type MacroStepState struct {
	Action      string `json:"action"`
	Summary     string `json:"summary"`
	Status      string `json:"status"`
	Error       string `json:"error,omitempty"`
	WaitMs      int    `json:"waitMs,omitempty"`
	WaitStartMs int64  `json:"waitStartMs,omitempty"`
}

MacroStepState tracks the execution state of one macro step.

type NeuralKeyState

type NeuralKeyState struct {
	Available bool `json:"available"`
}

NeuralKeyState is broadcast in ControlRoomState when the neural key engine is available (GPU + TensorRT + model loaded). Omitted on non-GPU builds.

type OperatorInfo

type OperatorInfo struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Role      string `json:"role"`
	Connected bool   `json:"connected"`
}

OperatorInfo describes a registered operator for ControlRoomState broadcast.

type OperatorSessionSnapshot

type OperatorSessionSnapshot struct {
	OperatorID       string   `json:"operatorId"`
	Name             string   `json:"name"`
	Role             string   `json:"role"`
	LockedSubsystems []string `json:"lockedSubsystems,omitempty"`
}

OperatorSessionSnapshot captures an operator's session and lock state.

type PipelineFormatInfo

type PipelineFormatInfo struct {
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	FPSNum      int    `json:"fpsNum"`
	FPSDen      int    `json:"fpsDen"`
	Name        string `json:"name"`
	ColorFormat string `json:"colorFormat,omitempty"`
	Codec       string `json:"codec,omitempty"`
}

PipelineFormatInfo describes the current video pipeline format.

type PlayoutChannelInfo

type PlayoutChannelInfo struct {
	ID            int             `json:"id"`
	State         string          `json:"state"`
	Mode          string          `json:"mode,omitempty"`
	PlaylistName  string          `json:"playlistName,omitempty"`
	CurrentItemID string          `json:"currentItemId,omitempty"`
	CurrentTitle  string          `json:"currentTitle,omitempty"`
	NextItemID    string          `json:"nextItemId,omitempty"`
	NextTitle     string          `json:"nextTitle,omitempty"`
	ItemIndex     int             `json:"itemIndex"`
	ItemCount     int             `json:"itemCount"`
	ItemProgress  float64         `json:"itemProgress,omitempty"`
	ItemRemainMs  int64           `json:"itemRemainMs,omitempty"`
	ActivePod     *PodStatusInfo  `json:"activePod,omitempty"`
	Pods          []PodStatusInfo `json:"pods,omitempty"`
	PodsArmed     int             `json:"podsArmed,omitempty"`
	PodsCompleted int             `json:"podsCompleted,omitempty"`
}

PlayoutChannelInfo is the broadcast state for a playout channel.

type PlayoutChannelSnapshot

type PlayoutChannelSnapshot struct {
	ChannelIndex       int     `json:"channelIndex"`
	ChannelState       string  `json:"channelState,omitempty"`
	CurrentItemIndex   int     `json:"currentItemIndex"`
	CurrentItemID      string  `json:"currentItemID,omitempty"`
	ElapsedMs          int64   `json:"elapsedMs"`
	SchedulerState     string  `json:"schedulerState"` // "idle", "playing", "transitioning"
	SchedulerMode      string  `json:"schedulerMode,omitempty"`
	TransitionProgress float64 `json:"transitionProgress,omitempty"`
	PlaylistHash       string  `json:"playlistHash,omitempty"`
}

PlayoutChannelSnapshot captures a playout channel's position in its playlist.

type PlayoutState

type PlayoutState struct {
	Channels []PlayoutChannelInfo `json:"channels"`
}

PlayoutState holds the broadcast state for all playout channels.

type PodStatusInfo

type PodStatusInfo struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	State       string `json:"state"`
	ElapsedMs   int64  `json:"elapsedMs,omitempty"`
	RemainingMs int64  `json:"remainingMs,omitempty"`
	DurationMs  int64  `json:"durationMs"`
	Armed       bool   `json:"armed"`
}

PodStatusInfo is the broadcast state for an active pod.

type PresetInfo

type PresetInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

PresetInfo is a summary of a saved preset, included in ControlRoomState so the browser knows which presets are available for recall.

type RecordingSnapshot

type RecordingSnapshot struct {
	Active bool   `json:"active"`
	Engine string `json:"engine,omitempty"`
}

RecordingSnapshot captures recording state.

type RecordingStatus

type RecordingStatus struct {
	Active         bool    `json:"active"`
	Filename       string  `json:"filename,omitempty"`
	BytesWritten   int64   `json:"bytesWritten,omitempty"`
	DurationSecs   float64 `json:"durationSecs,omitempty"`
	DroppedPackets int64   `json:"droppedPackets,omitempty"`
	Error          string  `json:"error,omitempty"`
}

RecordingStatus is the JSON-serializable status for recording output, included in ControlRoomState for the browser.

type ReplayBufferInfo

type ReplayBufferInfo struct {
	Source       string  `json:"source"`
	FrameCount   int     `json:"frameCount"`
	GOPCount     int     `json:"gopCount"`
	DurationSecs float64 `json:"durationSecs"`
	BytesUsed    int64   `json:"bytesUsed"`
}

ReplayBufferInfo describes the buffer state for a single replay source.

type ReplayMarksSnapshot

type ReplayMarksSnapshot struct {
	Source  string `json:"source"`
	MarkIn  int64  `json:"markIn"`
	MarkOut int64  `json:"markOut"`
}

ReplayMarksSnapshot captures the replay mark-in/mark-out points.

type ReplayPlayerSnapshot

type ReplayPlayerSnapshot struct {
	Source string  `json:"source"`
	State  string  `json:"state"` // "idle", "playing", "paused"
	Speed  float64 `json:"speed"`
}

ReplayPlayerSnapshot captures the replay player's current playback state.

type ReplayState

type ReplayState struct {
	State          string             `json:"state"`
	Source         string             `json:"source,omitempty"`
	Speed          float64            `json:"speed,omitempty"`
	Loop           bool               `json:"loop,omitempty"`
	Position       float64            `json:"position,omitempty"`
	MarkIn         *int64             `json:"markIn,omitempty"`  // Unix ms
	MarkOut        *int64             `json:"markOut,omitempty"` // Unix ms
	MarkSource     string             `json:"markSource,omitempty"`
	Buffers        []ReplayBufferInfo `json:"buffers,omitempty"`
	ShutterAngle   float64            `json:"shutterAngle,omitempty"` // 0-360 degrees
	GPUAccelerated bool               `json:"gpuAccelerated,omitempty"`
}

ReplayState is the JSON-serializable state for the instant replay system, included in ControlRoomState for the browser.

type SCTE35Active

type SCTE35Active struct {
	EventID       uint32                 `json:"eventId"`
	CommandType   string                 `json:"commandType"`
	IsOut         bool                   `json:"isOut"`
	DurationMs    *int64                 `json:"durationMs,omitempty"`
	ElapsedMs     int64                  `json:"elapsedMs"`
	RemainingMs   *int64                 `json:"remainingMs,omitempty"`
	AutoReturn    bool                   `json:"autoReturn"`
	Held          bool                   `json:"held"`
	SpliceTimePTS int64                  `json:"spliceTimePts"`
	StartedAt     int64                  `json:"startedAt"`
	PreRollMs     int64                  `json:"preRollMs,omitempty"`
	Descriptors   []SCTE35DescriptorInfo `json:"descriptors,omitempty"`
}

SCTE35Active describes an in-progress SCTE-35 event.

type SCTE35ActiveEventSnapshot

type SCTE35ActiveEventSnapshot struct {
	EventID      uint32 `json:"eventId"`
	Type         string `json:"type"`
	RemainingMs  int64  `json:"remainingMs"`
	Hold         bool   `json:"hold"`
	AutoReturnMs int64  `json:"autoReturnMs,omitempty"`
}

SCTE35ActiveEventSnapshot captures an in-flight SCTE-35 event.

type SCTE35Config

type SCTE35Config struct {
	HeartbeatIntervalMs int64  `json:"heartbeatIntervalMs"`
	DefaultPreRollMs    int64  `json:"defaultPreRollMs"`
	PID                 uint16 `json:"pid"`
	VerifyEncoding      bool   `json:"verifyEncoding"`
	WebhookURL          string `json:"webhookUrl,omitempty"`
}

SCTE35Config describes the SCTE-35 injector configuration.

type SCTE35DescriptorInfo

type SCTE35DescriptorInfo struct {
	SegEventID           uint32 `json:"segEventId"`
	SegmentationType     uint8  `json:"segmentationType"`
	SegmentationTypeName string `json:"segmentationTypeName"`
	UPIDType             uint8  `json:"upidType"`
	UPIDTypeName         string `json:"upidTypeName"`
	UPID                 string `json:"upid"`
	DurationMs           *int64 `json:"durationMs,omitempty"`
	SubSegmentNum        uint8  `json:"subSegmentNum,omitempty"`
	SubSegmentsExpected  uint8  `json:"subSegmentsExpected,omitempty"`
	Cancelled            bool   `json:"cancelled,omitempty"`
}

SCTE35DescriptorInfo describes a segmentation descriptor in an active event.

type SCTE35Event

type SCTE35Event struct {
	EventID        uint32                 `json:"eventId"`
	CommandType    string                 `json:"commandType"`
	IsOut          bool                   `json:"isOut"`
	DurationMs     *int64                 `json:"durationMs,omitempty"`
	AutoReturn     bool                   `json:"autoReturn"`
	Descriptors    []SCTE35DescriptorInfo `json:"descriptors,omitempty"`
	AvailNum       *uint8                 `json:"availNum,omitempty"`
	AvailsExpected *uint8                 `json:"availsExpected,omitempty"`
	SpliceTimePTS  *int64                 `json:"spliceTimePts,omitempty"`
	Timestamp      int64                  `json:"timestamp"`
	Status         string                 `json:"status"`
	Source         string                 `json:"source,omitempty"`
	DestinationID  string                 `json:"destinationId,omitempty"`
}

SCTE35Event describes a logged SCTE-35 event.

type SCTE35State

type SCTE35State struct {
	Enabled        bool                    `json:"enabled"`
	SCTE104Enabled bool                    `json:"scte104Enabled,omitempty"`
	ActiveEvents   map[uint32]SCTE35Active `json:"activeEvents"`
	EventLog       []SCTE35Event           `json:"eventLog"`
	HeartbeatOK    bool                    `json:"heartbeatOk"`
	Config         SCTE35Config            `json:"config"`
}

SCTE35State represents the current SCTE-35 signaling state.

type SRTOutputStatus

type SRTOutputStatus struct {
	Active         bool   `json:"active"`
	Mode           string `json:"mode,omitempty"`
	Address        string `json:"address,omitempty"`
	Port           int    `json:"port,omitempty"`
	State          string `json:"state,omitempty"`
	Connections    int    `json:"connections,omitempty"`
	BytesWritten   int64  `json:"bytesWritten,omitempty"`
	DroppedPackets int64  `json:"droppedPackets,omitempty"`
	OverflowCount  int64  `json:"overflowCount,omitempty"`
	Error          string `json:"error,omitempty"`
}

SRTOutputStatus is the JSON-serializable status for SRT output, included in ControlRoomState for the browser.

type SRTSourceInfo

type SRTSourceInfo struct {
	Mode                 string  `json:"mode"`
	StreamID             string  `json:"streamID"`
	RemoteAddr           string  `json:"remoteAddr,omitempty"`
	LatencyMs            int     `json:"latencyMs"`
	NegotiatedLatencyMs  int     `json:"negotiatedLatencyMs"`
	RTTMs                float64 `json:"rttMs"`
	RTTVarMs             float64 `json:"rttVarMs"`
	LossRate             float64 `json:"lossRate"`
	BitrateKbps          float64 `json:"bitrateKbps"`
	RecvBufMs            float64 `json:"recvBufMs"`
	RecvBufPackets       int     `json:"recvBufPackets"`
	FlightSize           int     `json:"flightSize"`
	Connected            bool    `json:"connected"`
	UptimeMs             int64   `json:"uptimeMs"`
	PacketsReceived      int64   `json:"packetsReceived"`
	PacketsLost          int64   `json:"packetsLost"`
	PacketsDropped       int64   `json:"packetsDropped"`
	PacketsRetransmitted int64   `json:"packetsRetransmitted"`
	PacketsBelated       int64   `json:"packetsBelated"`
	ReconnectCount       int     `json:"reconnectCount,omitempty"`
}

SRTSourceInfo holds live SRT connection metadata for ControlRoomState broadcast. This is separate from srt.SRTSourceInfo to avoid circular imports.

type STMapProgramState

type STMapProgramState struct {
	Map   string `json:"map"`
	Type  string `json:"type"`  // "static" or "animated"
	Frame int    `json:"frame"` // current frame index (animated only)
}

STMapProgramState describes the current program ST map assignment.

type STMapSnapshot

type STMapSnapshot struct {
	// Sources maps source key to assigned ST map name.
	Sources map[string]string `json:"sources,omitempty"`
	// Program is the program-level ST map name (empty if none).
	Program string `json:"program,omitempty"`
}

STMapSnapshot captures ST map source and program assignments.

type STMapState

type STMapState struct {
	Sources   map[string]string  `json:"sources"`           // source key → map name
	Program   *STMapProgramState `json:"program,omitempty"` // nil if no program map
	Available []string           `json:"available"`         // all stored map names
}

STMapState represents ST map assignments in the control room state broadcast.

type SnapshotApplyTarget

type SnapshotApplyTarget interface {
	// Switching
	Cut(ctx context.Context, source string) error
	SetPreview(ctx context.Context, source string) error

	// Transition config
	SetTransitionConfig(transitionType string, durationMs int, easing string) error
	SetFTB(active bool) error

	// Audio per-channel
	SetLevel(sourceKey string, levelDB float64) error
	SetTrim(sourceKey string, trimDB float64) error
	SetMuted(sourceKey string, muted bool) error
	SetAFV(sourceKey string, afv bool) error
	SetPhaseInvert(sourceKey string, invert bool) error
	SetBalance(sourceKey string, balance float64) error
	SetHPF(sourceKey string, frequency float64, enabled bool) error
	SetEQ(sourceKey string, band int, frequency, gain, q float64, enabled bool) error
	SetCompressor(sourceKey string, threshold, ratio, attack, release, makeupGain float64) error
	SetGate(sourceKey string, threshold, rangeDB, attack, release, hold float64, enabled bool) error
	SetAudioDelay(sourceKey string, delayMs int) error

	// Audio master
	SetMasterLevel(levelDB float64) error
	SetLimiterThreshold(thresholdDB float64) error
	SetLimiterCeiling(ceilingDB float64) error

	// Graphics
	SetGraphicsLayerActive(id int, active bool) error
	SetGraphicsLayerZOrder(id int, zOrder int) error
	SetGraphicsLayerRect(id int, x, y, width, height int) error

	// DVE Layout
	SetDVELayout(layout LayoutSnapshot) error

	// Source config
	SetSourceLabel(ctx context.Context, sourceKey, label string) error
	SetSourcePosition(sourceKey string, position int) error
	SetSourceDelay(sourceKey string, delayMs int) error

	// Upstream keys
	SetUpstreamKey(sourceKey string, config UpstreamKeySnapshot) error

	// Captions
	SetCaptionMode(mode string) error

	// Color grading
	SetColorGrade(lookName string, intensity float32) error
	DisableColorGrade() error

	// ST maps
	AssignSTMapSource(sourceKey, mapName string) error
	AssignSTMapProgram(mapName string) error
}

SnapshotApplyTarget is the interface used by ApplyFullSnapshot to restore engine state from a FullStateSnapshot. The real implementation lives in the main package (the App struct satisfies this interface).

This is deliberately broader than preset.RecallTarget — it covers every subsystem that has restorable state in the full snapshot.

type SnapshotClipApplier

type SnapshotClipApplier interface {
	LoadClipByName(slotIndex int, clipName string) error
}

SnapshotClipApplier is optionally implemented for loading clips by name into player slots during cross-engine snapshot restore. Clip IDs differ between engines, so name-based lookup is used instead.

type SnapshotDestinationApplier

type SnapshotDestinationApplier interface {
	ApplyOutputDestinations(dests []DestinationSnapshot) error
}

SnapshotDestinationApplier is optionally implemented for output destinations.

type SnapshotEncoderApplier

type SnapshotEncoderApplier interface {
	SetEncoderIfAvailable(name string) error
}

SnapshotEncoderApplier is optionally implemented for encoder switching.

type SnapshotGraphicsHTML5Applier

type SnapshotGraphicsHTML5Applier interface {
	LoadGraphicsHTML5(layerID int, url string) error
}

SnapshotGraphicsHTML5Applier is optionally implemented for HTML5 graphics overlay reload.

type SnapshotMacroApplier

type SnapshotMacroApplier interface {
	ApplyMacroExecution(exec MacroExecutionSnapshot) error
}

SnapshotMacroApplier is optionally implemented for macro execution state.

type SnapshotOperatorApplier

type SnapshotOperatorApplier interface {
	ApplyOperatorSessions(sessions []OperatorSessionSnapshot) error
}

SnapshotOperatorApplier is optionally implemented for operator sessions.

type SnapshotPlayoutApplier

type SnapshotPlayoutApplier interface {
	ApplyPlayoutChannels(channels []PlayoutChannelSnapshot) error
}

SnapshotPlayoutApplier is optionally implemented for playout channel state.

type SnapshotRecordingApplier

type SnapshotRecordingApplier interface {
	ApplyRecording(snap RecordingSnapshot) error
}

SnapshotRecordingApplier is optionally implemented for recording state.

type SnapshotReplayApplier

type SnapshotReplayApplier interface {
	ApplyReplayMarks(marks ReplayMarksSnapshot) error
	ApplyReplayPlayer(player ReplayPlayerSnapshot) error
}

SnapshotReplayApplier is optionally implemented for replay marks and player state.

type SnapshotSCTE35Applier

type SnapshotSCTE35Applier interface {
	ApplySCTE35Active(events []SCTE35ActiveEventSnapshot) error
}

SnapshotSCTE35Applier is optionally implemented for active SCTE-35 events.

type SnapshotSourceValidator

type SnapshotSourceValidator interface {
	HasSource(key string) bool
}

SnapshotSourceValidator can optionally be implemented by the apply target to check source availability before Cut operations. This prevents applying audio levels for a source that will fail to cut.

type SnapshotTransitionChecker

type SnapshotTransitionChecker interface {
	IsInTransition() bool
}

SnapshotTransitionChecker can optionally be implemented by the apply target to indicate whether the engine is currently mid-transition (e.g., dissolving between two sources). When mid-transition, ApplyFullSnapshot skips Cut and SetPreview to avoid a visible flash on program output.

type SourceConfigSnapshot

type SourceConfigSnapshot struct {
	Label    string `json:"label"`
	Position int    `json:"position"`
	DelayMs  int    `json:"delayMs,omitempty"`
}

SourceConfigSnapshot captures the user-configurable per-source settings.

type SourceInfo

type SourceInfo struct {
	Key         string           `json:"key"`
	Label       string           `json:"label,omitempty"`
	Type        string           `json:"type"` // "demo", "mxl", "srt", "replay", "clip"
	Status      string           `json:"status"`
	Position    int              `json:"position"`
	DelayMs     int              `json:"delayMs,omitempty"`
	KeyConfig   *SourceKeyConfig `json:"keyConfig,omitempty"`
	SRTInfo     *SRTSourceInfo   `json:"srt,omitempty"` // non-nil for SRT sources
	Corrector   *CorrectorState  `json:"corrector,omitempty"`
	IsVirtual   bool             `json:"isVirtual,omitempty"`
	HasCaptions bool             `json:"hasCaptions,omitempty"`
}

SourceInfo describes a connected video source and its current state.

type SourceKeyConfig

type SourceKeyConfig struct {
	Type           string  `json:"type"` // "chroma", "luma", or ""
	Enabled        bool    `json:"enabled"`
	KeyColorY      uint8   `json:"keyColorY,omitempty"`
	KeyColorCb     uint8   `json:"keyColorCb,omitempty"`
	KeyColorCr     uint8   `json:"keyColorCr,omitempty"`
	Similarity     float32 `json:"similarity,omitempty"`
	Smoothness     float32 `json:"smoothness,omitempty"`
	SpillSuppress  float32 `json:"spillSuppress,omitempty"`
	SpillReplaceCb uint8   `json:"spillReplaceCb,omitempty"`
	SpillReplaceCr uint8   `json:"spillReplaceCr,omitempty"`
	LowClip        float32 `json:"lowClip,omitempty"`
	HighClip       float32 `json:"highClip,omitempty"`
	Softness       float32 `json:"softness,omitempty"`
	FillSource     string  `json:"fillSource,omitempty"`
}

SourceKeyConfig describes the upstream key configuration for a source, included in SourceInfo so the browser knows the current key state.

type UpstreamKeySnapshot

type UpstreamKeySnapshot struct {
	Type           string  `json:"type"`
	Enabled        bool    `json:"enabled"`
	KeyColorY      uint8   `json:"keyColorY,omitempty"`
	KeyColorCb     uint8   `json:"keyColorCb,omitempty"`
	KeyColorCr     uint8   `json:"keyColorCr,omitempty"`
	Similarity     float32 `json:"similarity,omitempty"`
	Smoothness     float32 `json:"smoothness,omitempty"`
	SpillSuppress  float32 `json:"spillSuppress,omitempty"`
	SpillReplaceCb uint8   `json:"spillReplaceCb,omitempty"`
	SpillReplaceCr uint8   `json:"spillReplaceCr,omitempty"`
	LowClip        float32 `json:"lowClip,omitempty"`
	HighClip       float32 `json:"highClip,omitempty"`
	Softness       float32 `json:"softness,omitempty"`
	FillSource     string  `json:"fillSource,omitempty"`
}

UpstreamKeySnapshot captures the upstream key configuration for a source.

Directories

Path Synopsis
Package video provides YUV video frame format definitions, frame filling, and format conversion utilities shared across the switchframe pipeline.
Package video provides YUV video frame format definitions, frame filling, and format conversion utilities shared across the switchframe pipeline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL