control

package
v0.0.0-...-ad8d7c7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHeartbeatThumbnail             = errors.New("error sending thumbnail")
	ErrHeartbeatSendMetadata          = errors.New("error sending metadata")
	ErrHeartbeatOrchestratorHeartbeat = errors.New("error sending orchestrator heartbeat")
)

Functions

func NewVideoWriter

func NewVideoWriter(log logrus.FieldLogger, codec, filename string) *fileWriter

Types

type Control

type Control struct {
	Hostname       string
	HTTPServerType string `mapstructure:"http_server_type"`
	HTTPAddress    string `mapstructure:"http_address"`
	HTTPS          bool
	HTTPSHostname  string `mapstructure:"https_hostname"`
	HTTPSCert      string `mapstructure:"https_cert"`
	HTTPSKey       string `mapstructure:"https_key"`

	// Flag to enable saving video stream to file
	// Currently it's global flag toggled from the config file
	SaveVideo bool `mapstructure:"save_video"`
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	cfg config.Config,
	hostname string,
	logger *logrus.Logger,
) (*Control, error)

func (*Control) Authenticate

func (ctrl *Control) Authenticate(channelID types.ChannelID, streamKey types.StreamKey) error

func (*Control) Context

func (ctrl *Control) Context() context.Context

func (*Control) ContextErr

func (ctrl *Control) ContextErr() error

func (*Control) GetHmacKey

func (ctrl *Control) GetHmacKey(channelID types.ChannelID) (string, error)

func (*Control) GetTracks

func (ctrl *Control) GetTracks(channelID types.ChannelID) ([]StreamTrack, error)

func (*Control) HTTPServerURL

func (ctrl *Control) HTTPServerURL() string

func (*Control) RegisterHandleFunc

func (ctrl *Control) RegisterHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*Control) Shutdown

func (ctrl *Control) Shutdown()

func (*Control) StartHTTPServer

func (ctrl *Control) StartHTTPServer()

func (*Control) StartStream

func (ctrl *Control) StartStream(channelID types.ChannelID) (*Stream, error)

func (*Control) StopStream

func (ctrl *Control) StopStream(channelID types.ChannelID) error

type FileWriter

type FileWriter interface {
	SendRTP(p *rtp.Packet)
	Run()
	Done()
}

type Input

type Input interface {
	SetControl(ctrl *Control)
	SetLogger(log logrus.FieldLogger)

	Listen(ctx context.Context)
}

type InputConfig

type InputConfig[C any] struct {
	ReadConfig func(map[string]interface{}) C
}

type InputOption

type InputOption struct {
	Name     string
	Default  interface{}
	Value    interface{}
	Required bool
}

type InputType

type InputType struct {
	Name       string
	New        func(*Control, interface{}) (Input, error)
	ReadConfig InputConfig[any]
	Options    []InputOption
	Config     interface{}
}

type Metadata

type Metadata func(*Stream)

func AudioCodecMetadata

func AudioCodecMetadata(codec string) Metadata

func AudioPacketsMetadata

func AudioPacketsMetadata(packets int) Metadata

func ClientVendorNameMetadata

func ClientVendorNameMetadata(name string) Metadata

func ClientVendorVersionMetadata

func ClientVendorVersionMetadata(version string) Metadata

func VideoCodecMetadata

func VideoCodecMetadata(codec string) Metadata

func VideoHeightMetadata

func VideoHeightMetadata(height int) Metadata

func VideoPacketsMetadata

func VideoPacketsMetadata(packets int) Metadata

func VideoWidthMetadata

func VideoWidthMetadata(width int) Metadata

type Output

type Output interface {
	SetControl(ctrl *Control)
	SetLogger(log logrus.FieldLogger)

	Listen(ctx context.Context)
}

type Pipe

type Pipe struct {
	Input        string
	Output       string
	Orchestrator string
}

type Stream

type Stream struct {
	ChannelID types.ChannelID
	StreamID  types.StreamID
	StreamKey types.StreamKey
	// contains filtered or unexported fields
}

func (*Stream) AddTrack

func (s *Stream) AddTrack(track webrtc.TrackLocal, codec string) error

func (*Stream) Ingest

func (s *Stream) Ingest(ctx context.Context) error

func (*Stream) ReportMetadata

func (s *Stream) ReportMetadata(metadatas ...Metadata) error

func (*Stream) Stop

func (s *Stream) Stop()

func (*Stream) Stopped

func (s *Stream) Stopped() bool

type StreamTrack

type StreamTrack struct {
	Type  webrtc.RTPCodecType
	Codec string
	Track webrtc.TrackLocal
}

Jump to

Keyboard shortcuts

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