Documentation
¶
Index ¶
- Variables
- func Catch(err error) error
- func IsExit(errFromWait error) bool
- func Main()
- func ShowConfigMain(config *Config) error
- func ShowIdleness(d time.Duration)
- func ShowStreamsMain(config *Config) error
- func TickNow(d time.Duration) <-chan time.Time
- func WatchChannel(in <-chan *BufPoolElem, timeout time.Duration, notify func()) <-chan *BufPoolElem
- type App
- type BaseScreenService
- type BufPool
- type BufPoolElem
- type BufferConfig
- type BufferPoolConfig
- type Cmd
- func (c *Cmd) End() error
- func (c *Cmd) EndWith(otherCmd *Cmd)
- func (c *Cmd) KillGroup() error
- func (c *Cmd) SetStderr(w io.Writer)
- func (c *Cmd) SetStdin(r io.Reader)
- func (c *Cmd) Start() error
- func (c *Cmd) StdinPipe() (io.WriteCloser, error)
- func (c *Cmd) StdoutPipe() (io.ReadCloser, error)
- func (c *Cmd) WaitChannel() <-chan error
- type CmdData
- type Config
- type ExclusiveScreenService
- type Flow
- type FlowCmdData
- type FlowConfig
- type Icecast
- type IcecastUrls
- type InfluxConfig
- type MetricsConfig
- type MiscConfig
- type NginxRtmp
- type RestartableTimer
- type Screen
- type ScreenService
- type Server
- type ServerConfig
- type ServerFactory
- type SharedScreenService
- type Sink
- type SinkCmdData
- type SinkSet
- type Source
- type StaticStreamList
- type TimeConfig
Constants ¶
This section is empty.
Variables ¶
var UseDefaults = func(interface{}) error { return nil }
var Version = "devel"
Overridden by build.sh
Functions ¶
func IsExit ¶ added in v0.4.0
Takes an error returned from Wait() and determines if the program has exited.
func ShowConfigMain ¶
func ShowIdleness ¶
func ShowStreamsMain ¶
func WatchChannel ¶
func WatchChannel(in <-chan *BufPoolElem, timeout time.Duration, notify func()) <-chan *BufPoolElem
Types ¶
type App ¶
type BaseScreenService ¶
type BaseScreenService struct {
// contains filtered or unexported fields
}
type BufPool ¶
type BufPool struct { // After receiving a buffer from the channel, you *must* call AcquireFirst(). C <-chan *BufPoolElem // contains filtered or unexported fields }
A fixed-size pool of fixed-size byte buffers.
func NewBufPool ¶
Create a new BufPool of `nbuf` elements of `bufsize` bytes each.
type BufPoolElem ¶
type BufPoolElem struct {
// contains filtered or unexported fields
}
A reusable fixed-size byte buffer that is a member of BufPool.
func (*BufPoolElem) Acquire ¶
func (elem *BufPoolElem) Acquire(refs int32)
Increase reference count by `refs`.
Passing a negative value causes panic. Calling when the reference count has already reached 0 causes panic.
Fully thread-safe.
func (*BufPoolElem) AcquireFirst ¶
func (elem *BufPoolElem) AcquireFirst()
Must be called after the buffer has been received from the pool.
Passing a negative value causes panic. Calling when the reference count has already reached 0 causes panic.
Fully thread-safe.
func (*BufPoolElem) Free ¶
func (elem *BufPoolElem) Free()
Decrease reference count.
When the reference count reaches 0, the buffer is considered fully freed and it will be returned into the pool, so it must not be used anymore and all references to it must be relinquished.
Calling when the reference count has already reached 0 causes panic.
Fully thread-safe.
func (*BufPoolElem) GetBuffer ¶
func (elem *BufPoolElem) GetBuffer() []byte
Returns a slice of bytes that can be read and written to.
The size of the slice can be set via SetSize(). Initially, the size will be the maximum size, see GetMaxSize().
Thread-safe if the "current size" isn't changed at the same time.
func (*BufPoolElem) GetMaxSize ¶
func (elem *BufPoolElem) GetMaxSize() int
Gets the maximum size of the buffer.
It is the same for all pool elements and does not change.
func (*BufPoolElem) SetSize ¶
func (elem *BufPoolElem) SetSize(n int)
Sets the size of the buffer.
GetBuffer() will return a slice of this size.
Trying to set a size larger than the maximum size (see GetMaxSize()) causes panic.
type BufferConfig ¶
type BufferConfig struct {
BufferCount int `yaml:"buffer_count"`
}
type BufferPoolConfig ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func (*Cmd) StdoutPipe ¶
func (c *Cmd) StdoutPipe() (io.ReadCloser, error)
func (*Cmd) WaitChannel ¶
type Config ¶
type Config struct { Debug bool Server ServerConfig Metrics MetricsConfig SourceBuffer BufferPoolConfig SinkBuffer BufferConfig Flows map[string]FlowConfig Times TimeConfig Misc MiscConfig }
func LoadConfig ¶
func (*Config) UnmarshalYAML ¶
type ExclusiveScreenService ¶
type ExclusiveScreenService struct {
BaseScreenService
}
func (*ExclusiveScreenService) Done ¶
func (s *ExclusiveScreenService) Done() error
func (*ExclusiveScreenService) Screen ¶
func (s *ExclusiveScreenService) Screen() (*Screen, error)
func (*ExclusiveScreenService) Stop ¶
func (s *ExclusiveScreenService) Stop()
type FlowCmdData ¶
type FlowCmdData struct { CmdData // contains filtered or unexported fields }
type FlowConfig ¶
func (*FlowConfig) UnmarshalYAML ¶
func (fc *FlowConfig) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
type Icecast ¶
type Icecast struct {
// contains filtered or unexported fields
}
func (*Icecast) GetActiveStreams ¶
Get a list of active streams of a specific app from an Icecast server.
type IcecastUrls ¶
type IcecastUrls struct {
mapset.Set
}
func (*IcecastUrls) UnmarshalJSON ¶
func (iu *IcecastUrls) UnmarshalJSON(bytes []byte) error
type InfluxConfig ¶
type MetricsConfig ¶
type MetricsConfig struct {
Influx *InfluxConfig `yaml:"influx"`
}
type MiscConfig ¶
func (*MiscConfig) UnmarshalYAML ¶
func (mc *MiscConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type NginxRtmp ¶
type NginxRtmp struct {
// contains filtered or unexported fields
}
func (*NginxRtmp) GetActiveStreams ¶
Get a list of active streams of a specific app from an nginx-rtmp server.
type RestartableTimer ¶
func NewRestartableTimer ¶
func NewRestartableTimer(d time.Duration) RestartableTimer
func (*RestartableTimer) Restart ¶
func (st *RestartableTimer) Restart()
func (*RestartableTimer) Start ¶
func (st *RestartableTimer) Start()
func (*RestartableTimer) Stop ¶
func (st *RestartableTimer) Stop()
type ScreenService ¶
func NewExclusiveScreenService ¶
func NewExclusiveScreenService(name string) ScreenService
func NewSharedScreenService ¶
func NewSharedScreenService(name string) ScreenService
type Server ¶
type Server interface {
GetActiveStreams() (mapset.Set, error)
}
func NewIcecast ¶
func NewNginxRtmp ¶
func NewStaticStreamList ¶
type ServerConfig ¶
type ServerConfig struct { NewServer ServerFactory Url string App string XPath *xmlpath.Path Streams mapset.Set }
func (*ServerConfig) UnmarshalYAML ¶
func (sc *ServerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type ServerFactory ¶
type SharedScreenService ¶
type SharedScreenService struct {
}func (*SharedScreenService) Done ¶
func (s *SharedScreenService) Done() error
func (*SharedScreenService) Screen ¶
func (s *SharedScreenService) Screen() (*Screen, error)
func (*SharedScreenService) Stop ¶
func (s *SharedScreenService) Stop()
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
func (*Sink) Channel ¶
func (s *Sink) Channel() chan<- *BufPoolElem
func (*Sink) DeathBarrier ¶
func (s *Sink) DeathBarrier() <-chan struct{}
type SinkCmdData ¶
type SinkCmdData struct { Screens ScreenService Command CmdData }
type SinkSet ¶
type SinkSet struct {
// contains filtered or unexported fields
}
SinkSet starts and supervises multiple sinks.
func NewSinkSet ¶
func NewSinkSet(ctx context.Context, commands map[string]SinkCmdData, buffers <-chan *BufPoolElem, config *Config, entry *log.Entry) *SinkSet
func (*SinkSet) AnySinkDied ¶
func (ss *SinkSet) AnySinkDied() <-chan struct{}
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func (*Source) Channel ¶
func (s *Source) Channel() <-chan *BufPoolElem
func (*Source) DeathBarrier ¶
func (s *Source) DeathBarrier() <-chan struct{}
type StaticStreamList ¶
type StaticStreamList struct {
// contains filtered or unexported fields
}
func (*StaticStreamList) GetActiveStreams ¶
func (nr *StaticStreamList) GetActiveStreams() (mapset.Set, error)
type TimeConfig ¶
type TimeConfig struct { SourceRestartDelay time.Duration SourceTimeout time.Duration SinkRestartDelay time.Duration ServerPollInterval time.Duration ServerRequestTimeout time.Duration ServerTimeout time.Duration IdleTime time.Duration }
func (*TimeConfig) UnmarshalYAML ¶
func (tc *TimeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error