Documentation
¶
Overview ¶
Package component contains small adapters for custom pipeline components.
Index ¶
- Variables
- func EventFunc(name string, fn func(context.Context, av.Event) error) pipeline.Stage
- func FrameFunc(name string, fn func(context.Context, *av.Frame, Emit) error) pipeline.Stage
- func PacketFunc(name string, fn func(context.Context, *av.Packet, Emit) error) pipeline.Stage
- func SinkFunc(name string, fn func(context.Context, Message) error) pipeline.Sink
- type Emit
- type Message
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilStageCallback reports a nil callback passed to a strict stage // constructor. ErrNilStageCallback = errors.New("goav/component: nil stage callback") // ErrNilSinkCallback reports a nil callback passed to a strict sink // constructor. ErrNilSinkCallback = errors.New("goav/component: nil sink callback") )
Functions ¶
func EventFunc ¶
EventFunc wraps a function as an event-observing stage for .Do(...): fn sees each event, and every message (the event included) continues downstream.
func FrameFunc ¶
FrameFunc wraps a function as a frame-processing stage for .Do(...): fn observes or transforms each frame and forwards output through emit. Packets and events pass through untouched.
func PacketFunc ¶
PacketFunc wraps a function as a packet-processing stage for .Do(...): fn observes or transforms each packet and forwards output through emit. Frames and events pass through untouched.
func SinkFunc ¶
SinkFunc wraps a function as a terminal sink for goav.Sink(...): fn receives every delivered message, one call at a time, never concurrently. A message is lent for the call: keep a frame or packet past it with Ref (its bytes are shared, never copied), and never write lent bytes. Returning an error fails the task.
Types ¶
type Emit ¶
type Emit struct {
// contains filtered or unexported fields
}
Emit is how a custom stage (PacketFunc/FrameFunc/EventFunc) forwards output downstream. Packet/Frame/Event return the same flow-control errors as a source push: errors.Is(err, goav.ErrBackpressure) for a full downstream buffer and errors.Is(err, goav.ErrClosed) once the task has stopped. A stage should propagate these rather than treat them as fatal.
func (*Emit) EOS ¶
EOS emits end-of-stream for the given streams (or unscoped when none are listed), letting downstream nodes flush and finalize.