component

package
v0.1.0-alpha.7 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: 4 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 component contains small adapters for custom pipeline components.

Index

Constants

This section is empty.

Variables

View Source
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

func EventFunc(name string, fn func(context.Context, av.Event) error) pipeline.Stage

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

func FrameFunc(name string, fn func(context.Context, *av.Frame, Emit) error) pipeline.Stage

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

func PacketFunc(name string, fn func(context.Context, *av.Packet, Emit) error) pipeline.Stage

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

func SinkFunc(name string, fn func(context.Context, Message) error) pipeline.Sink

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

func (e *Emit) EOS(streams ...av.StreamID) error

EOS emits end-of-stream for the given streams (or unscoped when none are listed), letting downstream nodes flush and finalize.

func (*Emit) Event

func (e *Emit) Event(event av.Event) error

Event forwards one out-of-band event downstream.

func (*Emit) Frame

func (e *Emit) Frame(frame *av.Frame) error

Frame forwards one frame downstream; nil is a no-op.

func (*Emit) Packet

func (e *Emit) Packet(packet *av.Packet) error

Packet forwards one packet downstream; nil is a no-op.

type Message

type Message = pipeline.Message

Message is what a SinkFunc receives: one packet, frame, or event (pipeline.Message). Exactly one of Packet, Frame, or Event is set, according to Kind.

Jump to

Keyboard shortcuts

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