gstreamer

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const LeakyQueueStatsMessage = "LeakyQueueStats"

Variables

This section is empty.

Functions

func BuildAudioRate added in v1.11.0

func BuildAudioRate(name string, tolerance time.Duration) (*gst.Element, error)

func BuildQueue

func BuildQueue(name string, latency time.Duration, leaky bool) (*gst.Element, error)

func NewLeakyQueueMonitor added in v1.13.0

func NewLeakyQueueMonitor(name string, queue *gst.Element)

NewLeakyQueueMonitor creates a monitor for the given queue element and attaches pad probes to track buffer flow.

Types

type Bin

type Bin struct {
	*Callbacks
	*StateManager
	// contains filtered or unexported fields
}

Bin is designed to hold a single stream, with any number of sources and sinks

func (*Bin) AddElement

func (b *Bin) AddElement(e *gst.Element) error

AddElement - adds element to the bin. Elements will be linked in the order they are added

func (*Bin) AddElements

func (b *Bin) AddElements(elements ...*gst.Element) error

AddElements - adds elements to the bin. Elements will be linked in the order they are added

func (*Bin) AddOnEOSReceived added in v1.9.1

func (b *Bin) AddOnEOSReceived(f func()) error

AddOnEOSReceived adds a callback to be called when EOS is received on every pad of the last element in the bin

func (*Bin) AddSinkBin

func (b *Bin) AddSinkBin(sink *Bin) error

AddSinkBin - adds sink as a sink of b. This should only be called once for each sink bin

func (*Bin) AddSourceBin

func (b *Bin) AddSourceBin(src *Bin) error

AddSourceBin - adds src as a source of b. This should only be called once for each source bin

func (*Bin) ForceRemoveSourceBin added in v1.13.0

func (b *Bin) ForceRemoveSourceBin(name string) error

ForceRemoveSourceBin synchronously removes a source bin without waiting for EOS. This is used for FlowFlushing recovery where EOS will never propagate from a stuck appsrc. The removal runs on the GLib main loop thread via glib.IdleAdd and blocks until complete.

func (*Bin) GetName added in v1.9.1

func (b *Bin) GetName() string

func (*Bin) NewBin

func (b *Bin) NewBin(name string) *Bin

func (*Bin) RemoveSinkBin

func (b *Bin) RemoveSinkBin(name string) error

func (*Bin) RemoveSourceBin

func (b *Bin) RemoveSourceBin(name string) error

func (*Bin) SetEOSFunc

func (b *Bin) SetEOSFunc(f func() bool)

SetEOSFunc - sets a custom EOS function (used for appsrc, input-selector). If it returns true, EOS will also be sent to src bins

func (*Bin) SetGetSinkPad

func (b *Bin) SetGetSinkPad(f func(sinkName string) *gst.Pad)

SetGetSinkPad - sets a custom linking function which returns a pad for the named sink bin

func (*Bin) SetGetSrcPad

func (b *Bin) SetGetSrcPad(f func(srcName string) *gst.Pad)

SetGetSrcPad - sets a custom linking function which returns a pad for the named src bin

func (*Bin) SetLinkFunc

func (b *Bin) SetLinkFunc(f func([]*gst.Element) error)

SetLinkFunc - sets a custom linking function for this bin's elements (used when you need to modify chain functions)

func (b *Bin) SetShouldLink(f func(string) bool)

func (*Bin) SetState

func (b *Bin) SetState(state gst.State) error

type Callbacks

type Callbacks struct {
	GstReady   chan struct{}
	BuildReady chan struct{}
	// contains filtered or unexported fields
}

func (*Callbacks) AddOnSourceBinReset added in v1.13.0

func (c *Callbacks) AddOnSourceBinReset(f func(*config.TrackSource) error)

func (*Callbacks) AddOnStop

func (c *Callbacks) AddOnStop(f func() error)

func (*Callbacks) AddOnTrackAdded

func (c *Callbacks) AddOnTrackAdded(f func(*config.TrackSource))

func (*Callbacks) AddOnTrackMuted

func (c *Callbacks) AddOnTrackMuted(f func(string))

func (*Callbacks) AddOnTrackRemoved

func (c *Callbacks) AddOnTrackRemoved(f func(string))

func (*Callbacks) AddOnTrackUnmuted

func (c *Callbacks) AddOnTrackUnmuted(f func(string))

func (*Callbacks) OnDebugDotRequest added in v1.12.0

func (c *Callbacks) OnDebugDotRequest(reason string)

func (*Callbacks) OnEOSSent added in v1.8.6

func (c *Callbacks) OnEOSSent()

func (*Callbacks) OnError

func (c *Callbacks) OnError(err error)

func (*Callbacks) OnPipelinePaused added in v1.12.0

func (c *Callbacks) OnPipelinePaused()

func (*Callbacks) OnSourceBinReset added in v1.13.0

func (c *Callbacks) OnSourceBinReset(ts *config.TrackSource) error

OnSourceBinReset calls registered handlers to force-remove a stuck source bin and replace it with a new one. Each handler checks the track kind and returns nil if not applicable. The first handler that returns a non-nil error aborts the operation. On success, ts.AppSrc is updated to the new appsrc by the handler.

func (*Callbacks) OnStop

func (c *Callbacks) OnStop() error

func (*Callbacks) OnTrackAdded

func (c *Callbacks) OnTrackAdded(ts *config.TrackSource)

func (*Callbacks) OnTrackMuted

func (c *Callbacks) OnTrackMuted(trackID string)

func (*Callbacks) OnTrackRemoved

func (c *Callbacks) OnTrackRemoved(trackID string)

func (*Callbacks) OnTrackUnmuted

func (c *Callbacks) OnTrackUnmuted(trackID string)

func (*Callbacks) PipelinePaused added in v1.12.0

func (c *Callbacks) PipelinePaused() <-chan struct{}

func (*Callbacks) SetOnDebugDotRequest added in v1.12.0

func (c *Callbacks) SetOnDebugDotRequest(f func(string))

func (*Callbacks) SetOnEOSSent added in v1.8.6

func (c *Callbacks) SetOnEOSSent(f func())

func (*Callbacks) SetOnError

func (c *Callbacks) SetOnError(f func(error))

type LeakyQueueMonitor added in v1.13.0

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

LeakyQueueMonitor tracks buffer flow through a leaky queue to detect dropped buffers. It uses pad probes to count buffers in and out, then calculates drops as: dropped = inCount - outCount

func (*LeakyQueueMonitor) Name added in v1.13.0

func (m *LeakyQueueMonitor) Name() string

Name returns the name of the monitored queue

type Pipeline

type Pipeline struct {
	*Bin
	// contains filtered or unexported fields
}

func NewPipeline

func NewPipeline(name string, latency time.Duration, callbacks *Callbacks) (*Pipeline, error)

func (*Pipeline) AddElement

func (p *Pipeline) AddElement(e *gst.Element) error

func (*Pipeline) AddElements

func (p *Pipeline) AddElements(elements ...*gst.Element) error

func (*Pipeline) AddSinkBin

func (p *Pipeline) AddSinkBin(sink *Bin) error

func (*Pipeline) AddSourceBin

func (p *Pipeline) AddSourceBin(src *Bin) error

func (*Pipeline) DebugBinToDotData

func (p *Pipeline) DebugBinToDotData(details gst.DebugGraphDetails) string
func (p *Pipeline) Link() error

func (*Pipeline) PlayheadPosition added in v1.11.0

func (p *Pipeline) PlayheadPosition() (time.Duration, bool)

PlayheadPosition returns the playhead position of the gst pipeline It is equivalent to the last timestamp seen by a sink element

func (*Pipeline) Run

func (p *Pipeline) Run() error

func (*Pipeline) RunningTime added in v1.11.0

func (p *Pipeline) RunningTime() (time.Duration, bool)

RunningTime returns the running time of the gst pipeline

func (*Pipeline) SendEOS

func (p *Pipeline) SendEOS()

func (*Pipeline) SetState

func (p *Pipeline) SetState(state gst.State) error

func (*Pipeline) SetWatch

func (p *Pipeline) SetWatch(watch func(msg *gst.Message) bool)

func (*Pipeline) Stop

func (p *Pipeline) Stop()

type State

type State int
const (
	StateBuilding State = iota
	StateStarted
	StateRunning
	StateEOS
	StateStopping
	StateFinished
)

func (State) String

func (s State) String() string

type StateManager

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

func (*StateManager) GetState

func (s *StateManager) GetState() State

func (*StateManager) GetStateLocked

func (s *StateManager) GetStateLocked() State

func (*StateManager) LockState

func (s *StateManager) LockState()

func (*StateManager) LockStateShared

func (s *StateManager) LockStateShared()

func (*StateManager) UnlockState

func (s *StateManager) UnlockState()

func (*StateManager) UnlockStateShared

func (s *StateManager) UnlockStateShared()

func (*StateManager) UpgradeState

func (s *StateManager) UpgradeState(state State) (State, bool)

type TimeProvider added in v1.11.0

type TimeProvider interface {
	RunningTime() (time.Duration, bool)
	PlayheadPosition() (time.Duration, bool)
}

TimeProvider supplies the running time and playhead position of a pipeline.

func NopTimeProvider added in v1.11.0

func NopTimeProvider() TimeProvider

NopTimeProvider returns a TimeProvider that always reports unavailable times.

Jump to

Keyboard shortcuts

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