Documentation ¶
Index ¶
- Constants
- Variables
- func AddStream(formatCtx *astiav.FormatContext) *astiav.Stream
- func CloneStream(i *Stream, formatCtx *astiav.FormatContext) (o *astiav.Stream, err error)
- func EventHandlerLogAdapter(o EventHandlerLogAdapterOptions) astiencoder.EventHandlerLogAdapter
- type AdaptiveDelayer
- type AdaptiveDelayerOptions
- type ConstantDelayer
- type Context
- type Decoder
- type DecoderOptions
- type DecoderStats
- type Delayer
- type Demuxer
- func (d *Demuxer) Connect(h PktHandler)
- func (d *Demuxer) ConnectForStream(h PktHandler, i *Stream)
- func (d *Demuxer) Disconnect(h PktHandler)
- func (d *Demuxer) DisconnectForStream(h PktHandler, i *Stream)
- func (d *Demuxer) ProbeInfo() *DemuxerProbeInfo
- func (d *Demuxer) SetLoop(loop bool)
- func (d *Demuxer) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (d *Demuxer) Stats() DemuxerStats
- func (d *Demuxer) Streams() (ss []*Stream)
- type DemuxerEmulateRateOptions
- type DemuxerLoopOptions
- type DemuxerOptions
- type DemuxerProbeInfo
- type DemuxerProbeInfoFirstPTS
- type DemuxerReadFrameErrorHandler
- type DemuxerStats
- type Descriptor
- type Dictionary
- type Encoder
- func (e *Encoder) AddStream(formatCtx *astiav.FormatContext) (o *astiav.Stream, err error)
- func (e *Encoder) Connect(h PktHandler)
- func (e *Encoder) Disconnect(h PktHandler)
- func (e *Encoder) FrameSize() int
- func (e *Encoder) HandleFrame(p FrameHandlerPayload)
- func (e *Encoder) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (e *Encoder) Stats() EncoderStats
- type EncoderOptions
- type EncoderStats
- type EventHandlerLogAdapterOptions
- type EventLog
- type Filterer
- func (f *Filterer) Connect(h FrameHandler)
- func (f *Filterer) Disconnect(h FrameHandler)
- func (f *Filterer) HandleFrame(p FrameHandlerPayload)
- func (f *Filterer) OutputCtx() Context
- func (f *Filterer) SendCommand(target, cmd, args string, fs astiav.FilterCommandFlags) (resp string, err error)
- func (f *Filterer) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (f *Filterer) Stats() FiltererStats
- type FiltererFrameHandlerStrategy
- type FiltererInputContextChange
- type FiltererInputContextChanges
- type FiltererOnInputContextChangesFunc
- type FiltererOptions
- type FiltererStats
- type Forwarder
- func (f *Forwarder) Connect(h FrameHandler)
- func (f *Forwarder) Disconnect(h FrameHandler)
- func (f *Forwarder) HandleFrame(p FrameHandlerPayload)
- func (f *Forwarder) OutputCtx() Context
- func (f *Forwarder) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (f *Forwarder) Stats() ForwarderStats
- type ForwarderOptions
- type ForwarderStats
- type FrameAdapter
- type FrameFiller
- type FrameFillerFallbackFrameOptions
- type FrameHandler
- type FrameHandlerConnector
- type FrameHandlerPayload
- type FrameInterceptor
- type FrameInterceptorHandler
- type FrameInterceptorOptions
- type FrameInterceptorStats
- type FrameRateEmulator
- func (r *FrameRateEmulator) Connect(h FrameHandler)
- func (r *FrameRateEmulator) Disconnect(h FrameHandler)
- func (r *FrameRateEmulator) HandleFrame(p FrameHandlerPayload)
- func (r *FrameRateEmulator) OutputCtx() Context
- func (r *FrameRateEmulator) SetFlushOnStop(flushOnStop bool)
- func (r *FrameRateEmulator) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (r *FrameRateEmulator) Stats() FrameRateEmulatorStats
- type FrameRateEmulatorOptions
- type FrameRateEmulatorStats
- type FrameRestamper
- func NewFrameRestamperWithFrameDuration(frameDuration int64, startPTSFunc FrameRestamperStartPTSFunc) FrameRestamper
- func NewFrameRestamperWithModulo(frameDuration int64) FrameRestamper
- func NewFrameRestamperWithOffset(o FrameRestamperOffseter, frameDuration int64, timeBase astiav.Rational) FrameRestamper
- type FrameRestamperOffseter
- type FrameRestamperOffseterWithStartFromZero
- type FrameRestamperStartPTSFunc
- type Muxer
- type MuxerOptions
- type MuxerPktHandler
- type MuxerStats
- type OutputContexter
- type PTSReference
- type PktCond
- type PktDumper
- type PktDumperHandlerArgs
- type PktDumperOptions
- type PktDumperStats
- type PktHandler
- type PktHandlerConnector
- type PktHandlerPayload
- type PktPiper
- type PktPiperOptions
- type PktPiperStats
- type PktRestamper
- type RateEnforcer
- func (r *RateEnforcer) Connect(h FrameHandler)
- func (r *RateEnforcer) Disconnect(h FrameHandler)
- func (r *RateEnforcer) FrameFiller() *FrameFiller
- func (r *RateEnforcer) HandleFrame(p FrameHandlerPayload)
- func (r *RateEnforcer) OutputCtx() Context
- func (r *RateEnforcer) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (r *RateEnforcer) Stats() RateEnforcerStats
- func (r *RateEnforcer) Switch(n astiencoder.Node)
- type RateEnforcerOptions
- type RateEnforcerStats
- type Stream
- type Switcher
- func (s *Switcher) Connect(h FrameHandler)
- func (s *Switcher) Disconnect(h FrameHandler)
- func (s *Switcher) HandleFrame(p FrameHandlerPayload)
- func (s *Switcher) OutputCtx() Context
- func (s *Switcher) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
- func (s *Switcher) Stats() SwitcherStats
- func (s *Switcher) Switch(n astiencoder.Node)
- type SwitcherOptions
- type SwitcherStats
Constants ¶
const ( EventNameLog = "astilibav.log" // First frame of new node has been dispatched by the rate enforcer EventNameRateEnforcerSwitchedOut = "astilibav.rate.enforcer.switched.out" EventNameSwitcherSwitchedOut = "astilibav.switcher.switched.out" )
Event names
const ( StatNameAllocatedFrames = "astilibav.allocated.frames" StatNameAllocatedPackets = "astilibav.allocated.packets" StatNameAverageDelay = "astilibav.average.delay" StatNameAverageFrameDelay = "astilibav.average.frame.delay" StatNameFilledRate = "astilibav.filled.rate" StatNameIncomingRate = "astilibav.incoming.rate" StatNameOutgoingRate = "astilibav.outgoing.rate" StatNameProcessedRate = "astilibav.processed.rate" StatNameReadRate = "astilibav.read.rate" StatNameWrittenRate = "astilibav.written.rate" )
Stat names
Variables ¶
var (
NanosecondRational = astiav.NewRational(1, 1e9)
)
var PktDumpFile = func(pkt *astiav.Packet, args PktDumperHandlerArgs) (err error) { // Create file var f *os.File if f, err = os.Create(args.Pattern); err != nil { err = fmt.Errorf("astilibav: creating file %s failed: %w", args.Pattern, err) return } defer f.Close() if _, err = f.Write(pkt.Data()); err != nil { err = fmt.Errorf("astilibav: writing to file %s failed: %w", args.Pattern, err) return } return }
PktDumpFunc is a PktDumpFunc that dumps the packet to a file
Functions ¶
func AddStream ¶
func AddStream(formatCtx *astiav.FormatContext) *astiav.Stream
AddStream adds a stream to the format ctx
func CloneStream ¶
CloneStream clones a stream and add it to the format ctx
func EventHandlerLogAdapter ¶ added in v0.33.1
func EventHandlerLogAdapter(o EventHandlerLogAdapterOptions) astiencoder.EventHandlerLogAdapter
Types ¶
type AdaptiveDelayer ¶ added in v0.44.0
type AdaptiveDelayer struct {
// contains filtered or unexported fields
}
func NewAdaptiveDelayer ¶ added in v0.44.0
func NewAdaptiveDelayer(o AdaptiveDelayerOptions) *AdaptiveDelayer
func (*AdaptiveDelayer) Apply ¶ added in v0.44.0
func (d *AdaptiveDelayer) Apply(t time.Time) time.Time
func (*AdaptiveDelayer) Delay ¶ added in v0.44.0
func (d *AdaptiveDelayer) Delay() time.Duration
func (*AdaptiveDelayer) HandleFrame ¶ added in v0.44.0
func (d *AdaptiveDelayer) HandleFrame(delay time.Duration, n astiencoder.Node)
type AdaptiveDelayerOptions ¶ added in v0.44.0
type ConstantDelayer ¶ added in v0.44.0
type ConstantDelayer struct {
// contains filtered or unexported fields
}
func NewConstantDelayer ¶ added in v0.44.0
func NewConstantDelayer(delay time.Duration) *ConstantDelayer
func (*ConstantDelayer) Apply ¶ added in v0.44.0
func (d *ConstantDelayer) Apply(t time.Time) time.Time
func (*ConstantDelayer) Delay ¶ added in v0.44.0
func (d *ConstantDelayer) Delay() time.Duration
func (*ConstantDelayer) HandleFrame ¶ added in v0.44.0
func (d *ConstantDelayer) HandleFrame(delay time.Duration, n astiencoder.Node)
type Context ¶
type Context struct { // Shared BitRate int64 CodecID astiav.CodecID CodecName string Dictionary *Dictionary GlobalHeader bool Index int MediaType astiav.MediaType ThreadCount *int ThreadType *astiav.ThreadType TimeBase astiav.Rational // Audio ChannelLayout *astiav.ChannelLayout Channels int FrameSize int SampleFormat astiav.SampleFormat SampleRate int // Video ColorRange astiav.ColorRange FrameRate astiav.Rational GopSize int Height int PixelFormat astiav.PixelFormat Rotation float64 SampleAspectRatio astiav.Rational Width int }
Context represents parameters of an audio or a video context
func NewContextFromStream ¶
func NewContextFromStream(s *astiav.Stream) (ctx Context)
func (Context) Descriptor ¶ added in v0.14.0
func (ctx Context) Descriptor() Descriptor
type Decoder ¶
type Decoder struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Decoder represents an object capable of decoding packets
func NewDecoder ¶
func NewDecoder(o DecoderOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (d *Decoder, err error)
NewDecoder creates a new decoder
func (*Decoder) Connect ¶
func (d *Decoder) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*Decoder) Disconnect ¶
func (d *Decoder) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*Decoder) HandlePkt ¶
func (d *Decoder) HandlePkt(p PktHandlerPayload)
HandlePkt implements the PktHandler interface
func (*Decoder) Stats ¶ added in v0.36.0
func (d *Decoder) Stats() DecoderStats
type DecoderOptions ¶
type DecoderOptions struct { CodecParameters *astiav.CodecParameters EnforceMonotonicDTS bool Name string Node astiencoder.NodeOptions OutputCtx Context }
DecoderOptions represents decoder options
type DecoderStats ¶ added in v0.36.0
type Demuxer ¶
type Demuxer struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Demuxer represents an object capable of demuxing packets out of an input
func NewDemuxer ¶
func NewDemuxer(o DemuxerOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (d *Demuxer, err error)
NewDemuxer creates a new demuxer
func (*Demuxer) Connect ¶
func (d *Demuxer) Connect(h PktHandler)
Connect implements the PktHandlerConnector interface
func (*Demuxer) ConnectForStream ¶
func (d *Demuxer) ConnectForStream(h PktHandler, i *Stream)
ConnectForStream connects the demuxer to a PktHandler for a specific stream
func (*Demuxer) Disconnect ¶
func (d *Demuxer) Disconnect(h PktHandler)
Disconnect implements the PktHandlerConnector interface
func (*Demuxer) DisconnectForStream ¶
func (d *Demuxer) DisconnectForStream(h PktHandler, i *Stream)
DisconnectForStream disconnects the demuxer from a PktHandler for a specific stream
func (*Demuxer) ProbeInfo ¶ added in v0.32.0
func (d *Demuxer) ProbeInfo() *DemuxerProbeInfo
func (*Demuxer) Stats ¶ added in v0.36.0
func (d *Demuxer) Stats() DemuxerStats
type DemuxerEmulateRateOptions ¶ added in v0.32.0
type DemuxerEmulateRateOptions struct { // BufferDuration represents the duration of packets with positive PTS dispatched at the // start without sleeping. // Defaults to 1s BufferDuration time.Duration Enabled bool }
Demuxer will start by dispatching without sleeping all packets with negative PTS followed by n seconds of packets so that next nodes (e.g. the decoder) have a sufficient buffer to do their work properly (e.g. decoders don't output frames until their PTS is positive). After that, Demuxer sleeps between packets based on their DTS.
type DemuxerLoopOptions ¶ added in v0.32.0
type DemuxerLoopOptions struct {
Enabled bool
}
Demuxer will seek back to the start of the input when eof is reached In this case the packets are restamped
type DemuxerOptions ¶
type DemuxerOptions struct { // String content of the demuxer as you would use in ffmpeg Dictionary *Dictionary // Emulate rate options EmulateRate DemuxerEmulateRateOptions // If true, flushes internal data on start FlushOnStart bool // Exact input format Format *astiav.InputFormat // Loop options Loop DemuxerLoopOptions // Basic node options Node astiencoder.NodeOptions // Context used to cancel probing ProbeCtx context.Context // In order to emulate rate or loop properly, Demuxer needs to probe data. // ProbeDuration represents the duration the Demuxer will probe. // Defaults to 1s ProbeDuration time.Duration // Custom read frame error handler // If handled is false, default error handling will be executed ReadFrameErrorHandler DemuxerReadFrameErrorHandler // URL of the input URL string }
DemuxerOptions represents demuxer options
type DemuxerProbeInfo ¶ added in v0.32.0
type DemuxerProbeInfo struct {
FirstPTS DemuxerProbeInfoFirstPTS
}
func (DemuxerProbeInfo) PTSReference ¶ added in v0.32.0
func (i DemuxerProbeInfo) PTSReference() *PTSReference
type DemuxerProbeInfoFirstPTS ¶ added in v0.32.0
type DemuxerReadFrameErrorHandler ¶ added in v0.14.0
type DemuxerStats ¶ added in v0.36.0
type Descriptor ¶
type Descriptor interface {
TimeBase() astiav.Rational
}
Descriptor is an object that can describe a set of parameters
func NewDescriptor ¶ added in v0.14.0
func NewDescriptor(timeBase astiav.Rational) Descriptor
type Dictionary ¶ added in v0.23.0
type Dictionary struct {
// contains filtered or unexported fields
}
func NewDefaultDictionary ¶ added in v0.23.0
func NewDefaultDictionary(i string) *Dictionary
func NewDefaultDictionaryf ¶ added in v0.23.0
func NewDefaultDictionaryf(format string, args ...interface{}) *Dictionary
func NewDictionary ¶ added in v0.23.0
func NewDictionary(content, keyValSep, pairsSep string, flags astiav.DictionaryFlags) *Dictionary
type Encoder ¶
type Encoder struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Encoder represents an object capable of encoding frames
func NewEncoder ¶
func NewEncoder(o EncoderOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (e *Encoder, err error)
NewEncoder creates a new encoder
func (*Encoder) Connect ¶
func (e *Encoder) Connect(h PktHandler)
Connect implements the PktHandlerConnector interface
func (*Encoder) Disconnect ¶
func (e *Encoder) Disconnect(h PktHandler)
Disconnect implements the PktHandlerConnector interface
func (*Encoder) HandleFrame ¶
func (e *Encoder) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*Encoder) Stats ¶ added in v0.36.0
func (e *Encoder) Stats() EncoderStats
type EncoderOptions ¶
type EncoderOptions struct { Ctx Context Node astiencoder.NodeOptions }
EncoderOptions represents encoder options
type EncoderStats ¶ added in v0.36.0
type EventHandlerLogAdapterOptions ¶ added in v0.33.1
type EventHandlerLogAdapterOptions struct { LogLevel astiav.LogLevel LoggerLevelFunc func(l astiav.LogLevel) (ll astikit.LoggerLevel, processed, stop bool) }
type Filterer ¶
type Filterer struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Filterer represents an object capable of applying a filter to frames
func NewFilterer ¶
func NewFilterer(o FiltererOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (f *Filterer, err error)
NewFilterer creates a new filterer
func (*Filterer) Connect ¶
func (f *Filterer) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*Filterer) Disconnect ¶
func (f *Filterer) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*Filterer) HandleFrame ¶
func (f *Filterer) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*Filterer) SendCommand ¶
func (f *Filterer) SendCommand(target, cmd, args string, fs astiav.FilterCommandFlags) (resp string, err error)
SendCommand sends a command to the filterer
func (*Filterer) Stats ¶ added in v0.36.0
func (f *Filterer) Stats() FiltererStats
type FiltererFrameHandlerStrategy ¶ added in v0.42.0
type FiltererFrameHandlerStrategy string
const ( FiltererFrameHandlerStrategyDefault FiltererFrameHandlerStrategy = "default" FiltererFrameHandlerStrategyPTS FiltererFrameHandlerStrategy = "pts" )
type FiltererInputContextChange ¶ added in v0.42.0
type FiltererInputContextChange struct {
// contains filtered or unexported fields
}
func (FiltererInputContextChange) String ¶ added in v0.42.0
func (c FiltererInputContextChange) String() string
type FiltererInputContextChanges ¶ added in v0.42.0
type FiltererInputContextChanges map[astiencoder.Node]FiltererInputContextChange
func (FiltererInputContextChanges) String ¶ added in v0.42.0
func (cs FiltererInputContextChanges) String() string
type FiltererOnInputContextChangesFunc ¶ added in v0.42.0
type FiltererOnInputContextChangesFunc func(cs FiltererInputContextChanges, f *Filterer) (ignore bool)
type FiltererOptions ¶
type FiltererOptions struct { Content string EmulateRate astiav.Rational FrameHandlerStrategy FiltererFrameHandlerStrategy Inputs map[string]astiencoder.Node Node astiencoder.NodeOptions OnInputContextChanges FiltererOnInputContextChangesFunc OutputCtx Context Restamper FrameRestamper }
FiltererOptions represents filterer options
type FiltererStats ¶ added in v0.36.0
type Forwarder ¶
type Forwarder struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Forwarder represents an object capable of forwarding frames
func NewForwarder ¶
func NewForwarder(o ForwarderOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (f *Forwarder)
NewForwarder creates a new forwarder
func (*Forwarder) Connect ¶
func (f *Forwarder) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*Forwarder) Disconnect ¶
func (f *Forwarder) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*Forwarder) HandleFrame ¶
func (f *Forwarder) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*Forwarder) Stats ¶ added in v0.36.0
func (f *Forwarder) Stats() ForwarderStats
type ForwarderOptions ¶
type ForwarderOptions struct { Node astiencoder.NodeOptions OutputCtx Context Restamper FrameRestamper }
ForwarderOptions represents forwarder options
type ForwarderStats ¶ added in v0.36.0
type FrameAdapter ¶ added in v0.42.0
type FrameAdapter func(f *astiav.Frame) error
func EmptyAudioFrameAdapter ¶ added in v0.42.0
func EmptyAudioFrameAdapter(nbSamples, sampleRate int, cl *astiav.ChannelLayout, sf astiav.SampleFormat) FrameAdapter
func EmptyVideoFrameAdapter ¶ added in v0.42.0
func EmptyVideoFrameAdapter(cr astiav.ColorRange, pf astiav.PixelFormat, width, height int) FrameAdapter
type FrameFiller ¶ added in v0.42.0
type FrameFiller struct {
// contains filtered or unexported fields
}
func NewFrameFiller ¶ added in v0.42.0
func NewFrameFiller(c *astikit.Closer, eh *astiencoder.EventHandler, target interface{}) *FrameFiller
func (*FrameFiller) Get ¶ added in v0.42.0
func (ff *FrameFiller) Get() (*astiav.Frame, astiencoder.Node)
func (*FrameFiller) Put ¶ added in v0.42.0
func (ff *FrameFiller) Put(f *astiav.Frame, n astiencoder.Node)
func (*FrameFiller) WithFallbackFrame ¶ added in v0.42.0
func (ff *FrameFiller) WithFallbackFrame(o FrameFillerFallbackFrameOptions) (dst *FrameFiller, err error)
func (*FrameFiller) WithPreviousFrame ¶ added in v0.42.0
func (ff *FrameFiller) WithPreviousFrame() *FrameFiller
type FrameFillerFallbackFrameOptions ¶ added in v0.46.0
type FrameFillerFallbackFrameOptions struct { Frame *astiav.Frame FrameAdapter FrameAdapter Node astiencoder.Node }
type FrameHandler ¶
type FrameHandler interface {
astiencoder.Node
HandleFrame(p FrameHandlerPayload)
}
FrameHandler represents a node that can handle a frame
type FrameHandlerConnector ¶
type FrameHandlerConnector interface { Connect(next FrameHandler) Disconnect(next FrameHandler) }
FrameHandlerConnector represents an object that can connect/disconnect with a frame handler
type FrameHandlerPayload ¶
type FrameHandlerPayload struct { Descriptor Descriptor Frame *astiav.Frame Node astiencoder.Node }
FrameHandlerPayload represents a FrameHandler payload
type FrameInterceptor ¶ added in v0.46.0
type FrameInterceptor struct { *astiencoder.BaseNode // contains filtered or unexported fields }
FrameInterceptor represents an object capable of intercepting frames
func NewFrameInterceptor ¶ added in v0.46.0
func NewFrameInterceptor(o FrameInterceptorOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (i *FrameInterceptor)
NewFrameInterceptor creates a new frame interceptor
func (*FrameInterceptor) HandleFrame ¶ added in v0.46.0
func (i *FrameInterceptor) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*FrameInterceptor) OutputCtx ¶ added in v0.46.0
func (i *FrameInterceptor) OutputCtx() Context
OutputCtx returns the output ctx
func (*FrameInterceptor) Start ¶ added in v0.46.0
func (i *FrameInterceptor) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
Start starts the interceptor
func (*FrameInterceptor) Stats ¶ added in v0.46.0
func (i *FrameInterceptor) Stats() FrameInterceptorStats
type FrameInterceptorHandler ¶ added in v0.46.0
type FrameInterceptorHandler func(f *astiav.Frame, i *FrameInterceptor) error
type FrameInterceptorOptions ¶ added in v0.46.0
type FrameInterceptorOptions struct { Handler FrameInterceptorHandler Node astiencoder.NodeOptions OutputCtx Context }
FrameInterceptorOptions represents frame interceptor options
type FrameInterceptorStats ¶ added in v0.46.0
type FrameRateEmulator ¶ added in v0.32.0
type FrameRateEmulator struct { *astiencoder.BaseNode // contains filtered or unexported fields }
func NewFrameRateEmulator ¶ added in v0.32.0
func NewFrameRateEmulator(o FrameRateEmulatorOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (r *FrameRateEmulator)
func (*FrameRateEmulator) Connect ¶ added in v0.32.0
func (r *FrameRateEmulator) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*FrameRateEmulator) Disconnect ¶ added in v0.32.0
func (r *FrameRateEmulator) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*FrameRateEmulator) HandleFrame ¶ added in v0.32.0
func (r *FrameRateEmulator) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*FrameRateEmulator) OutputCtx ¶ added in v0.32.0
func (r *FrameRateEmulator) OutputCtx() Context
OutputCtx returns the output ctx
func (*FrameRateEmulator) SetFlushOnStop ¶ added in v0.32.1
func (r *FrameRateEmulator) SetFlushOnStop(flushOnStop bool)
func (*FrameRateEmulator) Start ¶ added in v0.32.0
func (r *FrameRateEmulator) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
Start starts the frame rate emulator
func (*FrameRateEmulator) Stats ¶ added in v0.36.0
func (r *FrameRateEmulator) Stats() FrameRateEmulatorStats
type FrameRateEmulatorOptions ¶ added in v0.32.0
type FrameRateEmulatorOptions struct { FlushOnStop bool Node astiencoder.NodeOptions OutputCtx Context PTSReference *PTSReference }
type FrameRateEmulatorStats ¶ added in v0.36.0
type FrameRestamper ¶
type FrameRestamper interface {
Restamp(f *astiav.Frame)
}
FrameRestamper represents an object capable of restamping frames
func NewFrameRestamperWithFrameDuration ¶
func NewFrameRestamperWithFrameDuration(frameDuration int64, startPTSFunc FrameRestamperStartPTSFunc) FrameRestamper
NewFrameRestamperWithFrameDuration creates a new frame restamper that starts timestamps from startPTS and increments them of frameDuration frameDuration must be a duration in frame time base
func NewFrameRestamperWithModulo ¶
func NewFrameRestamperWithModulo(frameDuration int64) FrameRestamper
NewFrameRestamperWithModulo creates a new frame restamper that makes sure that PTS % frame duration = 0 frameDuration must be a duration in frame time base
func NewFrameRestamperWithOffset ¶ added in v0.42.0
func NewFrameRestamperWithOffset(o FrameRestamperOffseter, frameDuration int64, timeBase astiav.Rational) FrameRestamper
type FrameRestamperOffseter ¶ added in v0.42.0
type FrameRestamperOffseterWithStartFromZero ¶ added in v0.42.0
type FrameRestamperOffseterWithStartFromZero struct {
// contains filtered or unexported fields
}
func NewFrameRestamperOffseterWithStartFromZero ¶ added in v0.42.0
func NewFrameRestamperOffseterWithStartFromZero() *FrameRestamperOffseterWithStartFromZero
func (*FrameRestamperOffseterWithStartFromZero) Offset ¶ added in v0.42.0
func (o *FrameRestamperOffseterWithStartFromZero) Offset(f *astiav.Frame, frameDuration int64, timeBase astiav.Rational) int64
func (*FrameRestamperOffseterWithStartFromZero) Paused ¶ added in v0.42.0
func (o *FrameRestamperOffseterWithStartFromZero) Paused()
type FrameRestamperStartPTSFunc ¶ added in v0.42.0
type FrameRestamperStartPTSFunc func() int64
func FrameRestamperStartPTSFuncFromPTSReference ¶ added in v0.42.0
func FrameRestamperStartPTSFuncFromPTSReference(r *PTSReference, timeBase astiav.Rational) FrameRestamperStartPTSFunc
type Muxer ¶
type Muxer struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Muxer represents an object capable of muxing packets into an output
func NewMuxer ¶
func NewMuxer(o MuxerOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (m *Muxer, err error)
NewMuxer creates a new muxer
func (*Muxer) FormatContext ¶ added in v0.23.0
func (m *Muxer) FormatContext() *astiav.FormatContext
func (*Muxer) NewPktHandler ¶
func (m *Muxer) NewPktHandler(o *astiav.Stream) *MuxerPktHandler
NewHandler creates
func (*Muxer) Stats ¶ added in v0.36.0
func (m *Muxer) Stats() MuxerStats
type MuxerOptions ¶
type MuxerOptions struct { Format *astiav.OutputFormat FormatName string Node astiencoder.NodeOptions Restamper PktRestamper URL string }
MuxerOptions represents muxer options
type MuxerPktHandler ¶
type MuxerPktHandler struct { *Muxer // contains filtered or unexported fields }
MuxerPktHandler is an object that can handle a pkt for the muxer
func (*MuxerPktHandler) HandlePkt ¶
func (h *MuxerPktHandler) HandlePkt(p PktHandlerPayload)
HandlePkt implements the PktHandler interface
type MuxerStats ¶ added in v0.36.0
type OutputContexter ¶ added in v0.8.0
type OutputContexter interface {
OutputCtx() Context
}
type PTSReference ¶ added in v0.32.0
type PTSReference struct {
// contains filtered or unexported fields
}
func NewPTSReference ¶ added in v0.39.0
func NewPTSReference() *PTSReference
func (PTSReference) PTSFromTime ¶ added in v0.39.0
func (r PTSReference) PTSFromTime(t time.Time, timeBase astiav.Rational) int64
func (PTSReference) TimeFromPTS ¶ added in v0.39.0
func (r PTSReference) TimeFromPTS(pts int64, timeBase astiav.Rational) time.Time
func (*PTSReference) Update ¶ added in v0.39.0
func (r *PTSReference) Update(pts int64, t time.Time, timeBase astiav.Rational) *PTSReference
type PktCond ¶
type PktCond interface {
UsePkt(pkt *astiav.Packet) bool
}
PktCond represents an object that can decide whether to use a pkt
type PktDumper ¶
type PktDumper struct { *astiencoder.BaseNode // contains filtered or unexported fields }
PktDumper represents an object capable of dumping packets
func NewPktDumper ¶
func NewPktDumper(o PktDumperOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (d *PktDumper, err error)
NewPktDumper creates a new pk dumper
func (*PktDumper) HandlePkt ¶
func (d *PktDumper) HandlePkt(p PktHandlerPayload)
HandlePkt implements the PktHandler interface
func (*PktDumper) Stats ¶ added in v0.36.0
func (d *PktDumper) Stats() PktDumperStats
type PktDumperHandlerArgs ¶
type PktDumperHandlerArgs struct {
Pattern string
}
PktDumperHandlerArgs represents pkt dumper handler args
type PktDumperOptions ¶
type PktDumperOptions struct { Data map[string]interface{} Handler func(pkt *astiav.Packet, args PktDumperHandlerArgs) error Node astiencoder.NodeOptions Pattern string }
PktDumperOptions represents pkt dumper options
type PktDumperStats ¶ added in v0.36.0
type PktHandler ¶
type PktHandler interface {
astiencoder.Node
HandlePkt(p PktHandlerPayload)
}
PktHandler represents a node that can handle a pkt
type PktHandlerConnector ¶
type PktHandlerConnector interface { Connect(next PktHandler) Disconnect(next PktHandler) }
PktHandlerConnector represents an object that can connect/disconnect with a pkt handler
type PktHandlerPayload ¶
type PktHandlerPayload struct { Descriptor Descriptor Node astiencoder.Node Pkt *astiav.Packet }
PktHandlerPayload represents a PktHandler payload
type PktPiper ¶ added in v0.28.0
type PktPiper struct { *astiencoder.BaseNode // contains filtered or unexported fields }
PktPiper represents an object capable of piping pkts
func NewPktPiper ¶ added in v0.28.0
func NewPktPiper(o PktPiperOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (p *PktPiper)
NewPktPiper creates a new pkt piper
func (*PktPiper) Connect ¶ added in v0.28.0
func (p *PktPiper) Connect(h PktHandler)
Connect implements the PktHandlerConnector interface
func (*PktPiper) Disconnect ¶ added in v0.28.0
func (p *PktPiper) Disconnect(h PktHandler)
Disconnect implements the PktHandlerConnector interface
func (*PktPiper) Stats ¶ added in v0.36.0
func (p *PktPiper) Stats() PktPiperStats
type PktPiperOptions ¶ added in v0.28.0
type PktPiperOptions struct { Node astiencoder.NodeOptions OutputCtx Context Restamper PktRestamper }
PktPiperOptions represents pkt piper options
type PktPiperStats ¶ added in v0.36.0
type PktRestamper ¶
type PktRestamper interface {
Restamp(pkt *astiav.Packet)
}
PktRestamper represents an object capable of restamping packets
func NewPktRestamperStartFromZero ¶
func NewPktRestamperStartFromZero() PktRestamper
NewPktRestamperStartFromZero creates a new pkt restamper that starts timestamps from 0
func NewPktRestamperWithTime ¶ added in v0.28.0
func NewPktRestamperWithTime(fillGaps bool, frameDuration int64, timeBase astiav.Rational) PktRestamper
NewPktRestamperWithTime creates a new pkt restamper that computes timestamps based on the time at which restamping was requested "fillGaps" option allows to:
- assign the current pkt to the previous DTS if previous DTS was never assigned
- assign the current pkt to the next DTS if current DTS is the same as previous DTS
"frameDuration" must be a duration in frame time base
type RateEnforcer ¶
type RateEnforcer struct { *astiencoder.BaseNode // contains filtered or unexported fields }
RateEnforcer represents an object capable of enforcing rate based on PTS
func NewRateEnforcer ¶
func NewRateEnforcer(o RateEnforcerOptions, eh *astiencoder.EventHandler, c *astikit.Closer, s *astiencoder.Stater) (r *RateEnforcer)
NewRateEnforcer creates a new rate enforcer
func (*RateEnforcer) Connect ¶
func (r *RateEnforcer) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*RateEnforcer) Disconnect ¶
func (r *RateEnforcer) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*RateEnforcer) FrameFiller ¶ added in v0.45.0
func (r *RateEnforcer) FrameFiller() *FrameFiller
FrameFiller returns the frame filler
func (*RateEnforcer) HandleFrame ¶
func (r *RateEnforcer) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*RateEnforcer) OutputCtx ¶ added in v0.8.0
func (r *RateEnforcer) OutputCtx() Context
OutputCtx returns the output ctx
func (*RateEnforcer) Start ¶
func (r *RateEnforcer) Start(ctx context.Context, t astiencoder.CreateTaskFunc)
Start starts the rate enforcer
func (*RateEnforcer) Stats ¶ added in v0.36.0
func (r *RateEnforcer) Stats() RateEnforcerStats
func (*RateEnforcer) Switch ¶
func (r *RateEnforcer) Switch(n astiencoder.Node)
Switch switches the source
type RateEnforcerOptions ¶
type RateEnforcerOptions struct { Delayer Delayer FrameFiller *FrameFiller Node astiencoder.NodeOptions // Both FrameRate and TimeBase are mandatory OutputCtx Context PTSReference *PTSReference Restamper FrameRestamper }
RateEnforcerOptions represents rate enforcer options
type RateEnforcerStats ¶ added in v0.36.0
type Switcher ¶ added in v0.42.0
type Switcher struct { *astiencoder.BaseNode // contains filtered or unexported fields }
Switcher represents an object capable of switching between nodes while enforcing constant PTS delta
func NewSwitcher ¶ added in v0.42.0
func NewSwitcher(o SwitcherOptions, eh *astiencoder.EventHandler, c *astikit.Closer, st *astiencoder.Stater) (s *Switcher, err error)
NewSwitcher creates a new switcher
func (*Switcher) Connect ¶ added in v0.42.0
func (s *Switcher) Connect(h FrameHandler)
Connect implements the FrameHandlerConnector interface
func (*Switcher) Disconnect ¶ added in v0.42.0
func (s *Switcher) Disconnect(h FrameHandler)
Disconnect implements the FrameHandlerConnector interface
func (*Switcher) HandleFrame ¶ added in v0.42.0
func (s *Switcher) HandleFrame(p FrameHandlerPayload)
HandleFrame implements the FrameHandler interface
func (*Switcher) Stats ¶ added in v0.42.0
func (s *Switcher) Stats() SwitcherStats
Source Files ¶
- context.go
- decoder.go
- delayer.go
- demuxer.go
- descriptor.go
- dictionary.go
- encoder.go
- event.go
- filterer.go
- forwarder.go
- frame.go
- frame_adapter.go
- frame_filler.go
- frame_interceptor.go
- frame_rate_emulator.go
- frame_restamper.go
- helper.go
- log.go
- muxer.go
- pkt.go
- pkt_dumper.go
- pkt_piper.go
- pkt_restamper.go
- pts_reference.go
- rate_emulator.go
- rate_enforcer.go
- stream.go
- switcher.go