Documentation
¶
Overview ¶
Package runconfig owns goav runtime construction options.
The root goav package stays focused on recipe grammar. Import this package when an application needs to configure a bare runtime, register custom codecs, formats, filters, or URL schemes, change buffering, or inject clocks.
Index ¶
- func Validate(config *Config) error
- type Config
- type Option
- func WithBufferPolicy(policy pipeline.BufferPolicy) Option
- func WithClock(clock av.Clock) Option
- func WithCloseWaitTimeout(timeout time.Duration) Option
- func WithCodecAdapter(register func(*codec.SimpleRegistry)) Option
- func WithCodecDescriptor(desc codec.Descriptor) Option
- func WithCodecPreference(id av.CodecID, mode codec.Mode, order ...string) Option
- func WithDecoder(desc codec.Descriptor, factory codec.DecoderFactory) Option
- func WithDemuxer(id av.FormatID, factory format.DemuxerFactory) Option
- func WithEncoder(desc codec.Descriptor, factory codec.EncoderFactory) Option
- func WithEventCapacity(capacity int) Option
- func WithFilter(desc filter.Descriptor, factory filter.Factory) Option
- func WithFilterAdapter(register func(*filter.SimpleRegistry)) Option
- func WithFormatAdapter(register func(*format.SimpleRegistry)) Option
- func WithMediaPools(enabled bool) Option
- func WithMuxer(id av.FormatID, factory format.MuxerFactory) Option
- func WithProber(prober format.Prober) Option
- func WithQoSPolicy(policy func(av.Event) []control.Control) Option
- func WithRealtime(realtime bool) Option
- func WithScheme(name string, scheme provider.Scheme) Option
- func WithShapeDelta(contributor ShapeDeltaContributor) Option
- type ShapeDeltaContributor
- type ShapeDeltaFunc
- type ShapeDeltaPlan
- type ShapeDeltaRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Codecs *codec.SimpleRegistry
Filters *filter.SimpleRegistry
Formats *format.SimpleRegistry
Buffer pipeline.BufferPolicy
Realtime bool
Clock av.Clock
EventCapacity int
CloseWaitTimeout time.Duration
MediaPools bool
ShapeDeltas []ShapeDeltaContributor
QoSPolicy func(av.Event) []control.Control
// Schemes maps lower-case URL schemes to the providers goav.FromURI
// and goav.ToURI resolve through (see WithScheme and provider.Scheme).
Schemes map[string]provider.Scheme
}
Config is the mutable runtime construction state passed to Option values. Options may replace registries or update graph policy, but NewConfig validates the final config before the root package publishes a concrete Runtime.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a new bare runtime configuration: per-runtime registries with no adapters beyond content sniffing. Realtime is off, so a job paces only when one of its inputs is live (see WithRealtime).
type Option ¶
Option configures a runtime under construction: registries (codecs, formats, filters), pacing (WithRealtime, WithClock), graph policy (WithBufferPolicy, WithEventCapacity, WithCloseWaitTimeout), and optional runtime-owned scratch pooling. Invalid options return an error from goav.New instead of silently no-oping.
func WithBufferPolicy ¶
func WithBufferPolicy(policy pipeline.BufferPolicy) Option
WithBufferPolicy sets the default node buffer policy for graphs this runtime builds. Branch-local .Buffer(flow....) declarations override it per branch.
func WithClock ¶
WithClock sets the time source the runtime's realtime pacing uses. Nil or unset defaults to av.MonotonicClock().
func WithCloseWaitTimeout ¶
WithCloseWaitTimeout sets the diagnostic timeout graph Close and Remove use while waiting for in-flight handlers to drain. A zero timeout keeps the pipeline default.
func WithCodecAdapter ¶
func WithCodecAdapter(register func(*codec.SimpleRegistry)) Option
WithCodecAdapter registers a whole codec bundle at once: the callback receives the runtime's codec registry. Use WithDecoder/WithEncoder for the direct single-value form.
func WithCodecDescriptor ¶
func WithCodecDescriptor(desc codec.Descriptor) Option
WithCodecDescriptor registers a codec descriptor without an implementation, so capability checks (Explain, validation) recognize the codec even when encode/decode factories come from elsewhere.
func WithCodecPreference ¶
WithCodecPreference sets the order the runtime picks the backends of codec id in mode (decode or encode) in when a recipe names none (codec.Backend names one): backend names or kinds (codec.KindHardware, KindLib, KindGo), most preferred first. An empty id or mode applies to every codec or mode. Backends it leaves out follow the default order: hardware, then shared libraries, then pure Go. Only backends whose declared capabilities and knobs fit a request are candidates; one that fails to open is an error, never a reason to try the next.
func WithDecoder ¶
func WithDecoder(desc codec.Descriptor, factory codec.DecoderFactory) Option
WithDecoder adds one decoder factory by descriptor.
func WithDemuxer ¶
func WithDemuxer(id av.FormatID, factory format.DemuxerFactory) Option
WithDemuxer adds one demuxer factory for a container format.
func WithEncoder ¶
func WithEncoder(desc codec.Descriptor, factory codec.EncoderFactory) Option
WithEncoder adds one encoder factory by descriptor.
func WithEventCapacity ¶
WithEventCapacity sets the buffered capacity of the task event stream and of each Watch subscriber's channel (default 256). Events never block the data plane: a full buffer sheds the event and counts the drop.
func WithFilter ¶
func WithFilter(desc filter.Descriptor, factory filter.Factory) Option
WithFilter adds one filter factory by descriptor.
func WithFilterAdapter ¶
func WithFilterAdapter(register func(*filter.SimpleRegistry)) Option
WithFilterAdapter registers a whole filter bundle at once: the callback receives the runtime's filter registry.
func WithFormatAdapter ¶
func WithFormatAdapter(register func(*format.SimpleRegistry)) Option
WithFormatAdapter registers a whole container-format bundle at once: the callback receives the runtime's format registry.
func WithMediaPools ¶
WithMediaPools enables runtime-scoped scratch pools for cold attach/detach churn. Pools are owned by one Runtime, never shared globally, and only recycle internal media scratch whose lifetime the runtime controls.
func WithMuxer ¶
func WithMuxer(id av.FormatID, factory format.MuxerFactory) Option
WithMuxer adds one muxer factory for a container format.
func WithProber ¶
WithProber adds one format prober for content sniffing.
func WithQoSPolicy ¶
WithQoSPolicy sets the opt-in, per-runtime QoS policy: every task this runtime builds feeds each av.EventQoS report (read it with av.EventQoSReport) to the policy on the task's cold event-delivery path and issues the returned controls through the task's own Control seam — exactly what an application could do by hand with Watch + Control, packaged. A control the task refuses is published back through Watch as an av.EventQoS carrying the error on Cause. Reports describe delivery lateness at the task's gates and queues, not network conditions; transports keep their own congestion control.
func WithRealtime ¶
WithRealtime controls whether every job on the runtime runs in realtime mode. When true, file media is paced to the runtime clock, graphs buffer between stages, and encoders use low-latency presets. When false (the default), realtime follows the inputs: live sources run realtime and file-to-file work runs as fast as the machine allows.
func WithScheme ¶
WithScheme registers the provider goav.FromURI and goav.ToURI resolve URLs of one scheme through (a provider.InputScheme, a provider.DestinationScheme, or both), per runtime: runconfig.WithScheme("whep", webrtcav.WHEP()). Names are case-insensitive RFC 3986 schemes, and the last registration of a name wins, so a runtime can replace a bundled scheme (an https client with its own transport, say). bundle.Schemes registers file, http, and https.
func WithShapeDelta ¶
func WithShapeDelta(contributor ShapeDeltaContributor) Option
WithShapeDelta registers one per-runtime shape-solver extension. The contributor is consulted only when .Auto(...) is active; use shape.AllowCustom("name") in the policy returned by the contributor and in caller recipes to make a custom class explicit.
type ShapeDeltaContributor ¶
type ShapeDeltaContributor interface {
ShapeDelta(ShapeDeltaRequest) (ShapeDeltaPlan, bool, error)
}
ShapeDeltaContributor teaches one runtime how to plan a custom .Auto(...) conversion class. Return planned=false when this contributor does not apply to the request.
type ShapeDeltaFunc ¶
type ShapeDeltaFunc func(ShapeDeltaRequest) (ShapeDeltaPlan, bool, error)
ShapeDeltaFunc adapts a function into a ShapeDeltaContributor.
func (ShapeDeltaFunc) ShapeDelta ¶
func (f ShapeDeltaFunc) ShapeDelta(request ShapeDeltaRequest) (ShapeDeltaPlan, bool, error)
ShapeDelta calls f(request).
type ShapeDeltaPlan ¶
type ShapeDeltaPlan struct {
Component string
Detail string
Needed shape.Policy
Stage pipeline.Stage
}
ShapeDeltaPlan is one custom solver insertion. Stage must be a fresh pipeline.Stage for this planning call; stages that implement shape.Contract teach the planner the output shape after insertion.
type ShapeDeltaRequest ¶
type ShapeDeltaRequest struct {
Actual shape.Spec
Expected shape.Spec
Preference shape.Spec
Realtime bool
}
ShapeDeltaRequest is passed to a runtime-registered shape solver extension when a chain's .Auto(...) policy is active and the next operation needs a shape the current stream does not satisfy.