control

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package control defines the in-process live task control vocabulary; for exposing those controls over a socket, see package ctlserver.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupported is returned when a task graph cannot inject controls.
	ErrUnsupported = errors.New("goav: task does not support live control")
	// ErrNotRunning is returned when the task is not running.
	ErrNotRunning = errors.New("goav: task is not running")
	// ErrNil is returned when a control carries no payload.
	ErrNil = errors.New("goav: nil control")
	// ErrInvalid is returned when a control constructor receives an invalid payload.
	ErrInvalid = errors.New("goav: invalid control")
	// ErrAmbiguousTarget is returned when a control does not name exactly one
	// target and the task cannot infer one safely.
	ErrAmbiguousTarget = errors.New("goav: control target is ambiguous")
)

Functions

This section is empty.

Types

type Control

type Control struct {
	// contains filtered or unexported fields
}

Control is an out-of-band request injected into a running task's graph.

func Deliver

func Deliver(event av.Event) Control

Deliver builds a control that hands a caller-supplied event to the target.

func Keyframe

func Keyframe(stream av.StreamID) Control

Keyframe builds a keyframe-request control for the given stream.

func Must

func Must(ctrl Control, err error) Control

Must unwraps a control constructor in tests and static configurations. It panics if err is non-nil; production code should handle the error instead.

func Rate

func Rate(r float64) (Control, error)

Rate builds a control that changes the task-wide playback rate. Rate is not targeted: it re-anchors the task's shared timeline so every paced consumer — clock-aware sources and playout gates — changes pace together. Tasks with nothing paced to scale refuse it.

func Seek

func Seek(pos time.Duration) Control

Seek builds a control that asks task sources to reposition to pos.

func Segment

func Segment(start, end time.Duration) (Control, error)

Segment builds a control that asks task sources to play [start, end).

func SelectActive

func SelectActive(id av.StreamID) Control

SelectActive switches a running Select to forward the arm identified by id.

func SetBitrate

func SetBitrate(stream av.StreamID, bitsPerSecond int) (Control, error)

SetBitrate builds a control that retargets live encoders to bitsPerSecond.

func (Control) At

func (c Control) At(node pipeline.NodeRef) Control

At returns a copy of the control targeting a graph node directly.

func (Control) AtTap

func (c Control) AtTap(name string) Control

AtTap returns a copy of the control targeting the named tap's point.

func (Control) Bitrate

func (c Control) Bitrate() int

Bitrate returns the encoder rate requested by a BitrateType control.

func (Control) End

func (c Control) End() time.Duration

End returns the exclusive segment end.

func (Control) Event

func (c Control) Event() av.Event

Event returns the event payload for EventType controls.

func (Control) Message

func (c Control) Message() (*pipeline.Message, error)

Message lowers the control into the pipeline message delivered to a node.

func (Control) Node

func (c Control) Node() pipeline.NodeRef

Node returns the expert graph-node target, if any.

func (Control) Position

func (c Control) Position() time.Duration

Position returns the seek position or segment start.

func (Control) Rate

func (c Control) Rate() float64

Rate returns the playback rate requested by a RateType control.

func (Control) Reason

func (c Control) Reason() string

Reason returns optional human context carried on the lowered event.

func (Control) StreamID

func (c Control) StreamID() av.StreamID

StreamID returns the stream scoped by the control, if any.

func (Control) Tap

func (c Control) Tap() string

Tap returns the tap target, if any.

func (Control) TargetsSources

func (c Control) TargetsSources() bool

TargetsSources reports whether the control is delivered through source Control methods instead of node queues. Rate is neither: it is task-wide and applies to the task timeline without touching the graph.

func (Control) Type

func (c Control) Type() Type

Type returns the control verb.

func (Control) WithReason

func (c Control) WithReason(reason string) Control

WithReason returns a copy of the control carrying human context.

type Type

type Type string

Type classifies an out-of-band control delivered to a running node.

const (
	// KeyframeType asks the target node to produce a keyframe.
	KeyframeType Type = "keyframe"
	// BitrateType asks encoders on the control's path to retarget bitrate live.
	BitrateType Type = "bitrate"
	// SelectType switches a live Select to the input named by StreamID.
	SelectType Type = "select"
	// EventType delivers a caller-supplied av.Event verbatim to the target node.
	EventType Type = "event"
	// SeekType asks task sources to reposition.
	SeekType Type = "seek"
	// RateType changes the task-wide playback rate: it scales the task's
	// shared timeline, which every paced source sleeps on, so it takes no
	// node or tap target.
	RateType Type = "rate"
	// SegmentType asks task sources to play one [start, end) window.
	SegmentType Type = "segment"
)

Jump to

Keyboard shortcuts

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