Documentation
¶
Overview ¶
Package compile is goav's recipe compiler. It reads a Request (a recipe DAG, the facts of the input and destination handles the DAG indexes, the stream matches, an Env of runtime settings, and a Host for the checks only the handles can make), validates it, solves its shapes, plans its joins, lowers it to one compose graph, and returns the spec and work plan the root package describes, explains, and builds. It never names a root type and raises only builderr.Refusal values, which the root converts to goav.BuildError.
Index ¶
- Constants
- func AddPlannedNode(nodes map[string]PlannedNode, spec *pipeline.Spec, name string, ...) error
- func BackendDetail(desc codec.Descriptor) string
- func CloneBuffer(buffer av.Buffer) av.Buffer
- func CloneCodecSettings(settings codec.Settings) codec.Settings
- func CloneCodecSpec(spec codec.Spec) codec.Spec
- func CloneMetadata(metadata av.Metadata) av.Metadata
- func ClonePlanDiagnostics(diagnostics []plan.Diagnostic) []plan.Diagnostic
- func CodecDescriptorSupports(desc codec.Descriptor, request CodecAdapterRequest) bool
- func CodecMedia(codecID av.CodecID) av.MediaType
- func CodecParametersEqual(a, b av.CodecParameters) bool
- func CodecSpecEqual(a, b codec.Spec) bool
- func CodecSpecHasParameters(spec codec.Spec) bool
- func ConformedStream(stream av.Stream, target shape.Spec) av.Stream
- func CopyMuxStreamFacts(branch WorkBranch, inputs []WorkInput, inputProbes []format.ProbeResult) (av.CodecID, av.MediaType, av.TimeBase, bool)
- func DecodeNodeName(selector av.StreamSelector) string
- func DecodeRequestDetail(request DecodeRequest) string
- func DescribedNodeDetail(node any) string
- func DestinationInvalidError(operation string, node string, reason string) error
- func DestinationNameClashError(name string) error
- func DestinationShapeMismatchError(operation string, node string, destinationName string, destination Destination, ...) error
- func EmptyTransformSpecError(operation string, node string) error
- func EncodeAdapterIncompatibleErrorAt(operation string, node string, request CodecAdapterRequest, ...) error
- func EncodeBackendDetail(registry *codec.SimpleRegistry, request CodecAdapterRequest) string
- func EncodeNodeDetail(request EncodeRequest) string
- func EncodeNodeName(request EncodeRequest) string
- func FirstNonEmptyCodec(values ...av.CodecID) av.CodecID
- func FirstNonEmptyMedia(values ...av.MediaType) av.MediaType
- func GraphPlanInvalidError(reason string, details []string) error
- func HumanizeShape(spec shape.Spec) string
- func JoinArmError(name string, node string, reason string, suggestions ...string) error
- func JoinSpecDetail(parts ...string) string
- func JoinSyncNodeDetail(mode JoinSyncMode) string
- func LiveInputStreams(inputs []recipeir.Input) []av.Stream
- func MediaAllowed(allowed []av.MediaType, media av.MediaType) bool
- func MediaShapeEmpty(shape shape.Spec) bool
- func MediaShapeFromCodecSpec(spec codec.Spec, domain shape.MediaDomain) shape.Spec
- func MediaShapeFromRecipeIRTransform(transform recipeir.Transform) shape.Spec
- func MediaTransformDetail(transform MediaTransform) string
- func MergeStringList(existing []string, next []string) []string
- func MuxCompatibilityBuildError(operation string, issue MuxCompatibilityIssue) error
- func MuxCompatibilityDiagnostics(issues []MuxCompatibilityIssue) []plan.Diagnostic
- func MuxNodeName(output format.Output, index int) string
- func MuxStreamTimeBase(stream av.Stream) av.TimeBase
- func NormalizeTapShape(spec shape.Spec) shape.Spec
- func OpCopy() recipeir.Operation
- func OpenedMuxRefusal(name string, formatID av.FormatID, streams []av.Stream, env Env) error
- func OperationsEncodeSpec(operations []recipeir.Operation) codec.Spec
- func OperationsHaveDecode(operations []recipeir.Operation) bool
- func OutputNodeDetailWithFormat(output format.Output, formatID av.FormatID) string
- func PlanAttach(req *Request, taps map[string]shape.MediaDomain) ([][]AttachBranchPlan, error)
- func PlanShapeConversion(env Env, actual shape.Spec, expected shape.Spec, realtime bool) (shapeConversionPlan, bool, error)
- func ReadableSelector(selector av.StreamSelector) string
- func RecipeDecodeAdapterError(operation string, stream recipeir.Stream, codecID av.CodecID, ...) error
- func RecipeEncodeAdapterCodecError(operation string, stream recipeir.Stream, codecID av.CodecID, ...) error
- func RecipeGraphUnsupportedRecipeError(operation string, recipe recipeir.Recipe) error
- func RecipeIRExplicitConversionSuggestion(transform recipeir.Transform, step recipeir.Operation) []string
- func RecipeIROperationInputShapes(operation recipeir.Operation) shape.Set
- func RecipeIROperationLabel(operation recipeir.Operation) string
- func RecipeIROperationOutputShape(input shape.Spec, operation recipeir.Operation) shape.Spec
- func RecipeIROperationOutputShapes(input shape.Spec, operation recipeir.Operation) shape.Set
- func RecipeIRTransformEmpty(transform recipeir.Transform) bool
- func RecipeIRTransformFactoryName(transform recipeir.Transform) string
- func RecipeTransformAdapterError(operation string, stream recipeir.Stream, name string, cause error) error
- func SelectCodecBackend(operation string, node string, registry *codec.SimpleRegistry, ...) (codec.Choice, error)
- func SelectDecodeStream(streams []av.Stream, selector av.StreamSelector) (av.Stream, error)
- func SelectStream(streams []av.Stream, selector av.StreamSelector) (av.Stream, error)
- func SolveRecipeIROperationShapes(operation string, env Env, stream recipeir.Stream, initial shape.Spec) ([]recipeir.Operation, []plan.Diagnostic, error)
- func StreamDiagnostic(stream av.Stream, fallbackIndex int) string
- func StreamInvalidError(node string, reason string) error
- func StreamMatchesSelector(stream av.Stream, selector av.StreamSelector) bool
- func StreamRuleInvalidError(node string, reason string, suggestion string) error
- func StreamSelectFromAV(selector av.StreamSelector) plan.StreamSelect
- func StreamSelectFromStream(stream av.Stream) plan.StreamSelect
- func TransformResample(transform recipeir.Transform) *filter.ResampleConfig
- func TransformResize(transform recipeir.Transform) *filter.ResizeConfig
- func ValidateBranchBuffer(b flow.BranchBuffer, operation string, node string) error
- func ValidateDecodeAdapterDescriptors(operation string, stream recipeir.Stream, registry *codec.SimpleRegistry, ...) error
- func ValidateEncodeAdapterDescriptors(operation string, stream recipeir.Stream, registry *codec.SimpleRegistry, ...) error
- func ValidateRecipeEncode(spec codec.Spec, operation string, node string) error
- func ValidateRecipeIROperationShapes(operation string, stream recipeir.Stream, operations []recipeir.Operation, ...) error
- func ValidateRecipeIRTransformAdapterDescriptor(operation string, stream recipeir.Stream, spec recipeir.Transform, name string, ...) error
- func ValidateShapeAnnotationDomain(operation string, node string, index int, current shape.Spec, ...) error
- func ValidateSinkRemux(operation string, node string, destinationName string, destination Destination, ...) error
- func ValidateSinkShape(operation string, node string, destinationName string, destination Destination, ...) error
- func ValidateStageComponent(stage pipeline.Stage) error
- func WorkDestinationID(name string) string
- func WorkDestinationNameByID(destinations []WorkDestination, id string) string
- func WorkOperationTerminal(kind plan.OperationKind) bool
- func WorkOperationsByID(operations []WorkOperation) map[string]WorkOperation
- type AnchorRoute
- type AttachBranchPlan
- type AttachGroup
- type AttachPlan
- type CodecAdapterRequest
- type ComponentValidator
- type ComposeGraph
- type ComposeNode
- type CompositeLayout
- type DecodeRequest
- type Destination
- type EncodeRequest
- type Env
- type Host
- type Input
- type JoinKind
- type JoinPlan
- func (p *JoinPlan) CustomJoinBaseStream(decodeArms bool) (av.Stream, shape.Spec)
- func (p *JoinPlan) CustomJoinedOutputDomain() shape.MediaDomain
- func (p *JoinPlan) ResolvedJoinedStream(streams map[pipeline.NodeRef]av.Stream, armRefs []pipeline.NodeRef) av.Stream
- func (p *JoinPlan) TreeGraphBuffer(realtime bool) *pipeline.BufferPolicy
- type JoinSyncMode
- type MediaTransform
- type MuxCompatibilityIssue
- type Output
- type PlanDecision
- type PlannedMuxStream
- type PlannedNode
- type Request
- type Result
- type StreamRulePlan
- type TapRef
- type WorkBranch
- type WorkDestination
- type WorkInput
- type WorkOperation
- type WorkPlan
- type WorkStream
- type WorkTap
Constants ¶
const ( ComposeSource composeNodeKind = iota + 1 ComposeSelect ComposeDecode ComposeStep ComposeEncode ComposeSink ComposeMux // composeRemuxSink and composeRemuxMux are whole-input packet copies: // every source feeds them with all its streams. ComposeRemuxSink ComposeRemuxMux // Join trees: the bind of an arm whose streams are known once it opens, // its event-keeping decode, its run-time conversion, a planned arm // conversion, and the convergence stage. ComposeArmBind ComposeArmDecode ComposeArmConform ComposeTransform ComposeJoin )
const ( DiagnosticDecodeCodecDeferred = "decode_codec_deferred" DiagnosticExplainPreflightError = "explain_preflight_error" DiagnosticStreamRule = "stream_rule" DiagnosticBufferedExecution = "buffered_execution" )
const RealtimeRecipeBufferCapacity = 32
const SelectBufferCapacity = 32
SelectBufferCapacity sizes the non-lossy queues on the Select graph. It is small — a passthrough switch holds no real backlog — but large enough that an injected SelectActive control rides alongside live arm traffic without forcing a stall.
Variables ¶
This section is empty.
Functions ¶
func AddPlannedNode ¶
func BackendDetail ¶
func BackendDetail(desc codec.Descriptor) string
BackendDetail is the node detail naming a codec backend.
func ClonePlanDiagnostics ¶
func ClonePlanDiagnostics(diagnostics []plan.Diagnostic) []plan.Diagnostic
func CodecDescriptorSupports ¶
func CodecDescriptorSupports(desc codec.Descriptor, request CodecAdapterRequest) bool
CodecDescriptorSupports reports whether desc's declared capabilities serve request (codec.Descriptor.Check).
func CodecParametersEqual ¶
func CodecParametersEqual(a, b av.CodecParameters) bool
func CodecSpecEqual ¶
func CodecSpecHasParameters ¶
func ConformedStream ¶
ConformedStream is stream after a conversion to target: the facts target fixes replace stream's.
func CopyMuxStreamFacts ¶
func DecodeNodeName ¶
func DecodeNodeName(selector av.StreamSelector) string
func DecodeRequestDetail ¶
func DecodeRequestDetail(request DecodeRequest) string
func DescribedNodeDetail ¶
func DestinationInvalidError ¶
func DestinationNameClashError ¶
DestinationNameClashError refuses two destinations one name labels apart: copies of one handle that disagree, or distinct handles that share a name.
func EmptyTransformSpecError ¶
func EncodeAdapterIncompatibleErrorAt ¶
func EncodeAdapterIncompatibleErrorAt(operation string, node string, request CodecAdapterRequest, descriptors []codec.Descriptor) error
EncodeAdapterIncompatibleErrorAt is the encoder-descriptor refusal for one node: planning reports it from shape facts, and encoder open reports it from the real stream when facts arrive only with the opened input.
func EncodeBackendDetail ¶
func EncodeBackendDetail(registry *codec.SimpleRegistry, request CodecAdapterRequest) string
EncodeBackendDetail is the Describe detail naming the backend that serves request at plan time, "backend=videotoolbox (hardware)", or "" when none serves it yet.
func EncodeNodeDetail ¶
func EncodeNodeDetail(request EncodeRequest) string
func EncodeNodeName ¶
func EncodeNodeName(request EncodeRequest) string
func GraphPlanInvalidError ¶
func HumanizeShape ¶
HumanizeShape renders a Spec for error prose: "frame audio 44.1kHz 2ch s16".
func JoinArmError ¶
func JoinSpecDetail ¶
func JoinSyncNodeDetail ¶
func JoinSyncNodeDetail(mode JoinSyncMode) string
JoinSyncNodeDetail renders the join node's planned/built graph detail. Arrival is the default and stays unannotated, so existing plans are byte-identical; the planner and the stages' DescribeNode share this one function, keeping Describe() ≡ Build().
func MediaShapeEmpty ¶
func MediaShapeFromCodecSpec ¶
MediaShapeFromCodecSpec is the shape.Spec view of a codec spec. It stays in goav (not the shape package) because it crosses codec.Spec and the codecMedia/ firstNonEmptyMedia helpers that live in the goav root.
func MediaTransformDetail ¶
func MediaTransformDetail(transform MediaTransform) string
func MergeStringList ¶
func MuxCompatibilityBuildError ¶
func MuxCompatibilityBuildError(operation string, issue MuxCompatibilityIssue) error
func MuxCompatibilityDiagnostics ¶
func MuxCompatibilityDiagnostics(issues []MuxCompatibilityIssue) []plan.Diagnostic
func OpenedMuxRefusal ¶
OpenedMuxRefusal refuses, when a destination opens, a container that cannot carry every stream routed to it: the plan-time check, run again on the streams an input turned out to have (a whole file into IVF), so a muxer is never handed a stream it would drop.
func OperationsEncodeSpec ¶
OperationsEncodeSpec is a stream's encoder (or packet copy).
func OperationsHaveDecode ¶
func PlanAttach ¶
func PlanAttach(req *Request, taps map[string]shape.MediaDomain) ([][]AttachBranchPlan, error)
PlanAttach plans the branches each Output of an attach group hangs below its anchor on the running task. taps are the task's taps by domain; a tap an earlier Output declares is added to it.
func PlanShapeConversion ¶
func PlanShapeConversion(env Env, actual shape.Spec, expected shape.Spec, realtime bool) (shapeConversionPlan, bool, error)
PlanShapeConversion synthesizes the conversion that turns actual into a shape satisfying expected's pinned format facts and selects the registry adapter that performs it. It returns planned=false when the delta is not a completable format conversion (the caller falls back to the plain shape mismatch error); adapter selection failures (none or several candidates) return an error.
func ReadableSelector ¶
func ReadableSelector(selector av.StreamSelector) string
func RecipeIROperationLabel ¶
RecipeIROperationLabel names an operation for solver errors and diagnostics: "encode-opus", "decode-vp8", "stage-visualizer", "resample".
func RecipeIRTransformEmpty ¶
func SelectCodecBackend ¶
func SelectCodecBackend(operation string, node string, registry *codec.SimpleRegistry, request CodecAdapterRequest, mode codec.Mode) (codec.Choice, error)
SelectCodecBackend picks the backend serving request in mode, refusing with a typed build error when a named backend is missing or cannot serve the request (naming the backends that can), or when no backend fits. A codec with no backend at all returns the bare selection error: callers report that as the missing-adapter refusal.
func SelectDecodeStream ¶
func SelectStream ¶
func SolveRecipeIROperationShapes ¶
func SolveRecipeIROperationShapes(operation string, env Env, stream recipeir.Stream, initial shape.Spec) ([]recipeir.Operation, []plan.Diagnostic, error)
SolveRecipeIROperationShapes walks one stream chain's operations with the shape solver. It returns the solved operation list (nil when nothing was inserted) and one diagnostic per insertion.
func StreamInvalidError ¶
func StreamMatchesSelector ¶
func StreamMatchesSelector(stream av.Stream, selector av.StreamSelector) bool
func StreamRuleInvalidError ¶
func StreamSelectFromAV ¶
func StreamSelectFromAV(selector av.StreamSelector) plan.StreamSelect
func StreamSelectFromStream ¶
func StreamSelectFromStream(stream av.Stream) plan.StreamSelect
func TransformResample ¶
func TransformResample(transform recipeir.Transform) *filter.ResampleConfig
TransformResample is a resample transform's config for the lowering, nil for any other transform.
func TransformResize ¶
func TransformResize(transform recipeir.Transform) *filter.ResizeConfig
TransformResize is a resize transform's config for the lowering, nil for any other transform.
func ValidateBranchBuffer ¶
func ValidateBranchBuffer(b flow.BranchBuffer, operation string, node string) error
ValidateBranchBuffer rejects branch buffers the runtime cannot install, in terms of the goav BuildError vocabulary. The flow package owns the buffer data and lowering; goav owns the build-time diagnostics that reference its own error types.
func ValidateDecodeAdapterDescriptors ¶
func ValidateDecodeAdapterDescriptors(operation string, stream recipeir.Stream, registry *codec.SimpleRegistry, request CodecAdapterRequest) error
func ValidateEncodeAdapterDescriptors ¶
func ValidateEncodeAdapterDescriptors(operation string, stream recipeir.Stream, registry *codec.SimpleRegistry, request CodecAdapterRequest) error
func ValidateRecipeEncode ¶
func ValidateSinkRemux ¶
func ValidateSinkRemux(operation string, node string, destinationName string, destination Destination, streams []av.Stream, domain shape.MediaDomain) error
ValidateSinkRemux refuses streams of an input copied whole into a media sink that does not take one of them, with the fix that routes the streams one by one: the planner checks the streams a probe knows, the build the ones the input opened with.
func ValidateSinkShape ¶
func ValidateSinkShape(operation string, node string, destinationName string, destination Destination, actual shape.Spec) error
ValidateSinkShape refuses a stream a media sink cannot take, with the encode that fixes it: an explicit one for frames (the planner found no encoder to insert), a decode and re-encode for packets of another codec.
func ValidateStageComponent ¶
func WorkDestinationID ¶
WorkDestinationID derives the stable destination ID from the destination's label. Labels are unique per plan: matching labels either belong to one explicit mux group or fail as duplicate destinations, so the ID is stable across plan orderings.
func WorkDestinationNameByID ¶
func WorkDestinationNameByID(destinations []WorkDestination, id string) string
WorkDestinationNameByID resolves a destination's display name from its routing ID; views report names while the plan routes by ID.
func WorkOperationTerminal ¶
func WorkOperationTerminal(kind plan.OperationKind) bool
func WorkOperationsByID ¶
func WorkOperationsByID(operations []WorkOperation) map[string]WorkOperation
Types ¶
type AnchorRoute ¶
type AnchorRoute struct {
Policy pipeline.RoutePolicy
Label string
}
AnchorRoute is the route a node reads an input by.
type AttachBranchPlan ¶
type AttachBranchPlan struct {
Name string
Media av.MediaType
Operations []recipeir.Operation
Buffer flow.BranchBuffer
Dests []attachDestPlan
}
AttachBranchPlan is one branch an attach group or a stream rule plans: its name, media, operations, queue, and destinations.
type AttachGroup ¶
type AttachGroup struct {
Name string
Env Env
// Streams are the group's branches; Frames reports a branch whose
// anchor carries frames, and Dests indexes each branch's destinations.
Streams []recipeir.Stream
Frames []bool
Dests [][]int
// Destinations are the group's destinations, and Names their names.
Destinations []Destination
Names []string
// Anchors are the live nodes anchor roots read, and Routes the routes
// they read them by; Pending are the tap operations that anchor roots
// on a tap the group itself declares read.
Anchors map[recipeir.NodeID]pipeline.NodeRef
Routes map[recipeir.NodeID]AnchorRoute
Pending map[recipeir.NodeID]recipeir.NodeID
}
AttachGroup is one attach group a running task lowers: its branches are the streams of one recipe whose roots are anchors on the task.
type AttachPlan ¶
type AttachPlan struct {
Nodes []ComposeNode
// contains filtered or unexported fields
}
AttachPlan is a lowered attach group: the nodes it adds to the running graph, in schedule order, named under its branches.
func LowerAttach ¶
func LowerAttach(group AttachGroup) (*AttachPlan, error)
LowerAttach lowers an attach group through the build's lowering: work its branches share is one node, a destination several branches route to is one node, and every node a branch alone reads is named under the branch.
type CodecAdapterRequest ¶
type CodecAdapterRequest struct {
Codec av.CodecID
Media av.MediaType
SampleFormat string
PixelFormat string
SampleRate int
Channels int
Backend string
Profile string
BitDepth int
Width int
Height int
Realtime bool
// Settings are the request's codec settings, checked against the chosen
// backend's knobs.
Settings codec.Settings
}
CodecAdapterRequest is what one decode or encode asks of the backend that serves it: the stream facts known when it is checked, and the backend, profile, and bit depth its settings request.
func DecodeAdapterRequestFromStream ¶
func DecodeAdapterRequestFromStream(stream av.Stream, planned recipeir.Stream) CodecAdapterRequest
func EncodeAdapterRequestFromPreparedStream ¶
func EncodeAdapterRequestFromPreparedStream(spec codec.Spec, stream av.Stream) CodecAdapterRequest
func EncodeAdapterRequestFromRecipeIR ¶
func EncodeAdapterRequestFromRecipeIR(encode codec.Spec, stream recipeir.Stream) CodecAdapterRequest
EncodeAdapterRequestFromRecipeIR is the plan-time request of encode on stream: the stream's transforms supply the facts the spec leaves open.
type ComponentValidator ¶
type ComponentValidator interface {
ValidateComponent() error
}
type ComposeGraph ¶
type ComposeGraph struct {
Nodes []ComposeNode
// contains filtered or unexported fields
}
ComposeGraph is the one schedule a recipe is described and built from.
type ComposeNode ¶
type ComposeNode struct {
Kind composeNodeKind
Name string
Detail string
Inputs []pipeline.NodeRef
// input is a source's or select's recipe input; selector what a select or
// decode picks.
Input int
Selector av.StreamSelector
// decode is a decode's codec options; dropEvents keeps a lone decode to
// a sink from forwarding stream events.
Decode codec.Spec
DropEvents bool
// transform is a step's work; request an encoder's.
Transform MediaTransform
Request EncodeRequest
// owner is the branch that alone reads the node, or -1.
Owner int
// output indexes a destination.
Output int
// join is the join a join-tree node belongs to, arm the arm it serves,
// and stream the planned stream a transform is built against.
Join *JoinPlan
Arm int
Stream av.Stream
Resolved bool
Target pipeline.NodeRef
// contains filtered or unexported fields
}
ComposeNode is one planned node: its name and describe detail, the nodes it consumes in connect order, and what the build makes it from.
func (ComposeNode) Route ¶
func (n ComposeNode) Route(index int) AnchorRoute
Route is the route the node reads its input at index by: an attached node reads a live anchor by the anchor's own policy and label, and every other input whole.
type CompositeLayout ¶
type CompositeLayout struct {
X, Y int
}
CompositeLayout places one input's top-left corner on the output canvas. One layout entry pairs with each input arm, so the compositor knows where to copy that arm's frame.
type DecodeRequest ¶
type DecodeRequest struct {
Selector av.StreamSelector
Config codec.Spec
}
type Destination ¶
type Destination struct {
// Invalid is why the handle is unusable, or "".
Invalid string
// Label is the destination's own name, or "".
Label string
// Group identifies a destination copies of one handle share, or "".
Group string
IR recipeir.Destination
// Sink reports a sink destination: SinkName and SinkDetail name it.
Sink bool
SinkName string
SinkDetail string
// Accepts is what a media sink declares it takes (InputShapes), in
// preference order; nil takes anything.
Accepts shape.Set
// HasOutput reports a byte destination; Output is its address.
HasOutput bool
Output format.Output
// Format is the container asked for; ResolvedFormat the one the
// output resolved to.
Format av.FormatID
ResolvedFormat av.FormatID
}
compileDestination is what the compiler knows of one destination.
type EncodeRequest ¶
type EncodeRequest struct {
Name string
Selector av.StreamSelector
Config codec.EncodeConfig
}
type Env ¶
type Env struct {
Present bool
Codecs *codec.SimpleRegistry
Filters *filter.SimpleRegistry
Formats *format.SimpleRegistry
Buffer pipeline.BufferPolicy
Realtime bool
ShapeDeltas []runconfig.ShapeDeltaContributor
}
compileEnv is the runtime settings the passes read: every field is a leaf type. Present is false when no runtime is configured.
type Host ¶
type Host interface {
ValidateHandles(operation string, order []int, names []string) error
ResolveOutputs(ctx context.Context, order []int, names []string) ([]av.FormatID, error)
ProbeInputs(ctx context.Context) ([]format.ProbeResult, error)
}
compileHost checks what only the concrete handles know, at the point in the pass order the checks have always run. order lists each recipe destination's index in compileRequest.Dests.
type Input ¶
type Input struct {
IR recipeir.Input
// Name names the input in a stream selection; SourceNode and
// SourceDetail are its planned source node.
Name string
SourceNode string
SourceDetail string
// Shape is the shape the input declares, if it declares one; Frames
// reports a declared frame shape.
Shape shape.Spec
HasShape bool
Frames bool
// Live reports an input that delivers on its own clock.
Live bool
// Demuxed reports an input a demuxer opens (a file or URI).
Demuxed bool
// EventDomain is the domain the input's stream events arrive in.
EventDomain shape.MediaDomain
}
compileInput is what the compiler knows of one input before it opens.
type JoinKind ¶
type JoinKind string
JoinKind names a convergence workflow. Public sugar (Mix, Composite, Select) lowers to one joinSpec and one planned join lowering; no composition code dispatches on the kind outside the joinProfiles table.
const ( JoinMix JoinKind = recipeir.JoinMix JoinComposite JoinKind = recipeir.JoinComposite JoinSelect JoinKind = recipeir.JoinSelect )
type JoinPlan ¶
type JoinPlan struct {
Tree *joinTreeSnapshot
Profile joinProfile
Name string
Arms []joinArmPlan
Joined av.Stream
// composite: per-arm canvas placement collected by its planArm hook.
Layouts []CompositeLayout
// late reports that the joined format is known only once arm inputs open:
// the build derives it from the streams its arms resolved. lateTarget
// marks a join whose target follows a late first arm, and target holds
// the facts the downstream encoder fixes for it.
Late bool
// contains filtered or unexported fields
}
JoinPlan is one planned join: its N arms (each an input's stream, a nested join, or a fed stream, with its optional bind, decode, and conversion) converging into one join node whose output — the joined stream — the join's branches read like any stream.
func (*JoinPlan) CustomJoinBaseStream ¶
CustomJoinBaseStream resolves the fallback joined stream and the input spec the stage contract's OutputShapes is consulted with.
func (*JoinPlan) CustomJoinedOutputDomain ¶
func (p *JoinPlan) CustomJoinedOutputDomain() shape.MediaDomain
CustomJoinedOutputDomain reports the output domain a custom join's stage contract declares ("" without one): the joined-domain derivation honors it over the decode-arms default.
func (*JoinPlan) ResolvedJoinedStream ¶
func (p *JoinPlan) ResolvedJoinedStream(streams map[pipeline.NodeRef]av.Stream, armRefs []pipeline.NodeRef) av.Stream
ResolvedJoinedStream is the joined stream of a join whose format is known only once its arms open: derived, the way planning derives it, from the streams the arm nodes resolved while building.
func (*JoinPlan) TreeGraphBuffer ¶
func (p *JoinPlan) TreeGraphBuffer(realtime bool) *pipeline.BufferPolicy
TreeGraphBuffer returns the first profile-pinned graph buffer in the join tree that applies at this realtime setting: a nested Select still needs the buffered per-node workers its control plane injects through, even under an offline root whose own realtime-only pin (Mix/Composite) does not apply.
type JoinSyncMode ¶
type JoinSyncMode int
JoinSyncMode selects how a convergent join (Mix/Composite) aligns its arms.
const ( // joinSyncArrival pairs arm frames by arrival: one buffered frame per arm // per step, no timestamp math. Right for live sources on one clock; the // default. JoinSyncArrival JoinSyncMode = iota // joinSyncPTS aligns arm frames by presentation time on a common // nanosecond clock — opt-in via goav.Mix(..., goav.ByPTS()) and // goav.Composite(..., goav.ByPTS()). JoinSyncPTS )
type MediaTransform ¶
type MediaTransform struct {
Name string
Factory string
Stage pipeline.Stage
Video *filter.ResizeConfig
Audio *filter.ResampleConfig
}
type MuxCompatibilityIssue ¶
type MuxCompatibilityIssue struct {
Code errcode.Code
Destination string
Format av.FormatID
Reason string
Details []string
Suggestions []string
}
func CheckKnownMuxCompatibility ¶
func CheckKnownMuxCompatibility(output WorkDestination, streams []PlannedMuxStream, env Env) (MuxCompatibilityIssue, bool)
func MuxCompatibilityIssues ¶
func MuxCompatibilityIssues( work WorkPlan, inputProbes []format.ProbeResult, env Env, ) []MuxCompatibilityIssue
type Output ¶
compileOutput is one Output: the node it routes (a NodeInput for input.To) and its destination nodes in .To order.
type PlanDecision ¶
type PlannedMuxStream ¶
type Request ¶
type Request struct {
Graph recipeir.Graph
Outputs []Output
Inputs []Input
Dests []Destination
Matches []sourcepkg.StreamMatch
Host Host
Env Env
// Preflight runs the checks a build needs before it opens anything
// (adapters, formats, probes); Describe compiles without them. Ctx
// bounds the host's probes.
Preflight bool
Ctx context.Context
}
compileRequest is everything one compile reads: the recipe DAG, its Outputs, the facts of the input and destination handles the DAG indexes, the stream matches its rules name, and the host that checks the handles.
type Result ¶
type Result struct {
Recipe recipeir.Recipe
Joins map[recipeir.NodeID]*JoinPlan
JoinOrder []recipeir.NodeID
Graph ComposeGraph
Lowered bool
Spec pipeline.Spec
Work WorkPlan
InputProbes []format.ProbeResult
OutputFormats map[string]av.FormatID
OutputSlots []int
StreamRules []StreamRulePlan
Name string
RulesSource string
RulesDomain shape.MediaDomain
}
compileResult is what one compile resolves: the recipe IR, its planned joins and compose graph, the spec and work plan it lowers to, and what the passes learned of the inputs and destinations.
type StreamRulePlan ¶
type StreamRulePlan struct {
Match sourcepkg.StreamMatch
Branches []AttachBranchPlan
}
StreamRulePlan is one planned OnStream rule: its match and the branches it attaches for every stream that matches.
type TapRef ¶
type TapRef struct {
Name string
Domain shape.MediaDomain
}
TapRef is a typed handle to a stable media attach point.
type WorkBranch ¶
type WorkBranch struct {
ID string
Name string
Input string
Stream plan.StreamSelect
SourceShape shape.Spec
Operations []string
Destinations []string
}
WorkBranch is one planned branch. Operations and Destinations reference the plan's operations and destinations by their stable IDs.
type WorkDestination ¶
type WorkDestination struct {
ID string
Name string
Operation plan.OperationKind
Component string
Format av.FormatID
Branches []string
}
WorkDestination is one planned destination. ID is the stable routing identity derived from the destination handle's label (label+config identity is deduplicated upstream: one label is one destination).
func CloneWorkDestinations ¶
func CloneWorkDestinations(destinations []WorkDestination) []WorkDestination
type WorkOperation ¶
type WorkOperation struct {
ID string
Name string
Kind plan.OperationKind
Branch string
Node pipeline.NodeRef
Component string
Detail string
Codec codec.Spec
ShapeIn shape.Spec
ShapeOut shape.Spec
Destinations []string
}
WorkOperation is one planned operation. Destinations carries the stable destination IDs (workDestination.ID) a terminal operation routes into — destination routing is by ID, never by display name.
type WorkPlan ¶
type WorkPlan struct {
Name string
Realtime bool
Inputs []WorkInput
Streams []WorkStream
Operations []WorkOperation
Taps []WorkTap
Branches []WorkBranch
Destinations []WorkDestination
Edges []workEdge
Decisions []PlanDecision
Diagnostics []plan.Diagnostic
}
WorkPlan is the executable plan for a build: the operations, taps, branches, destinations, and edges the lowering executes against the graph. It is built once by the compile (buildWorkPlan) and every view — lowering validation, Explain reports, and mux compatibility — renders from it.