server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdTraitSimple = iota
	CmdTraitPullStream
	CmdTraitPushStream
)

Variables

This section is empty.

Functions

func InitServerLogger added in v0.0.2

func InitServerLogger(gl *logrus.Logger)

InitServerLogger can be called multiple times before server starts to override default logger

func StartServer

func StartServer(c *Config) (err error)

Types

type BaseSessionListener added in v0.0.3

type BaseSessionListener struct{}

BaseSessionListener facilitates building listener if not interested in all events

func (*BaseSessionListener) OnSessionCreated added in v0.0.3

func (b *BaseSessionListener) OnSessionCreated(s *MediaSession)

func (*BaseSessionListener) OnSessionStarted added in v0.0.3

func (b *BaseSessionListener) OnSessionStarted(s *MediaSession)

func (*BaseSessionListener) OnSessionStopped added in v0.0.3

func (b *BaseSessionListener) OnSessionStopped(s *MediaSession)

func (*BaseSessionListener) OnSessionUpdated added in v0.0.3

func (b *BaseSessionListener) OnSessionUpdated(s *MediaSession)

type CommandExecute

type CommandExecute interface {
	Execute(s *MediaSession, cmd string, args string)
	ExecuteWithNotify(s *MediaSession, cmd string, args string, ctrlIn ExecuteCtrlChan, ctrlOut ExecuteCtrlChan)
	ExecuteWithPush(s *MediaSession, dataIn ExecuteDataChan)
	GetCommandTrait() []CommandTrait
}

type CommandTrait

type CommandTrait struct {
	CmdName  string
	CmdTrait TraitEnum
}

type Config added in v0.0.3

type Config struct {
	RtpIp               string
	StartPort, EndPort  uint16
	ExecutorList        []CommandExecute
	SourceFactoryList   []SourceFactory
	SinkFactoryList     []SinkFactory
	SessionListenerList []SessionListener

	GrpcIp           string
	GrpcPort         uint16
	GrpcRegisterMore RegisterMore
}

type ExecuteCtrlChan

type ExecuteCtrlChan chan string

type ExecuteDataChan added in v0.0.3

type ExecuteDataChan chan *rpc.PushData

type MediaServer

type MediaServer struct {
	rpc.UnimplementedMediaApiServer
	// contains filtered or unexported fields
}

func (*MediaServer) ExecuteAction

func (srv *MediaServer) ExecuteAction(_ context.Context, action *rpc.Action) (*rpc.ActionResult, error)

func (*MediaServer) ExecuteActionWithNotify

func (srv *MediaServer) ExecuteActionWithNotify(action *rpc.Action, stream rpc.MediaApi_ExecuteActionWithNotifyServer) error

func (*MediaServer) ExecuteActionWithPush added in v0.0.3

func (srv *MediaServer) ExecuteActionWithPush(stream rpc.MediaApi_ExecuteActionWithPushServer) error

func (*MediaServer) GetVersion added in v0.0.3

func (srv *MediaServer) GetVersion(_ context.Context, _ *rpc.Empty) (*rpc.VersionNumber, error)

func (*MediaServer) OnChannelEvent added in v0.0.3

func (srv *MediaServer) OnChannelEvent(e *rpc.SystemEvent)

func (*MediaServer) PrepareSession added in v0.0.2

func (srv *MediaServer) PrepareSession(_ context.Context, param *rpc.CreateParam) (*rpc.Session, error)

func (*MediaServer) StartSession

func (srv *MediaServer) StartSession(_ context.Context, param *rpc.StartParam) (*rpc.Status, error)

func (*MediaServer) StopSession

func (srv *MediaServer) StopSession(_ context.Context, param *rpc.StopParam) (*rpc.Status, error)

func (*MediaServer) SystemChannel added in v0.0.3

func (srv *MediaServer) SystemChannel(stream rpc.MediaApi_SystemChannelServer) error

func (*MediaServer) UpdateSession added in v0.0.3

func (srv *MediaServer) UpdateSession(_ context.Context, param *rpc.UpdateParam) (*rpc.Status, error)

type MediaSession

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

func (*MediaSession) AddNode

func (s *MediaSession) AddNode(node event.Node)

AddNode add an event node to server-wide event graph

func (*MediaSession) GetAVCodecParam added in v0.0.3

func (s *MediaSession) GetAVCodecParam() string

func (*MediaSession) GetAVCodecType added in v0.0.3

func (s *MediaSession) GetAVCodecType() rpc.CodecType

func (*MediaSession) GetAVPayloadType added in v0.0.3

func (s *MediaSession) GetAVPayloadType() uint8

func (*MediaSession) GetController added in v0.0.2

func (s *MediaSession) GetController() comp.Controller

func (*MediaSession) GetEventGraph added in v0.0.2

func (s *MediaSession) GetEventGraph() *event.Graph

func (*MediaSession) GetSessionId

func (s *MediaSession) GetSessionId() string

func (*MediaSession) GetStatus added in v0.0.3

func (s *MediaSession) GetStatus() int

func (*MediaSession) GetTelephoneEventCodecType added in v0.0.3

func (s *MediaSession) GetTelephoneEventCodecType() rpc.CodecType

func (*MediaSession) GetTelephoneEventPayloadType added in v0.0.2

func (s *MediaSession) GetTelephoneEventPayloadType() uint8

func (*MediaSession) LinkChannel added in v0.0.2

func (s *MediaSession) LinkChannel(name string, ch chan<- *event.Event)

LinkChannel links *ch* to the channel registered as *name* in graph description

func (*MediaSession) Start

func (s *MediaSession) Start() (err error)

func (*MediaSession) Stop

func (s *MediaSession) Stop()

type RegisterMore

type RegisterMore func(s grpc.ServiceRegistrar)

type ScriptCommandHandler added in v0.0.2

type ScriptCommandHandler struct{}

ScriptCommandHandler provides built-in command to execute nmd script

func (*ScriptCommandHandler) Execute added in v0.0.2

func (sc *ScriptCommandHandler) Execute(s *MediaSession, _ string, args string)

func (*ScriptCommandHandler) ExecuteWithNotify added in v0.0.2

func (sc *ScriptCommandHandler) ExecuteWithNotify(s *MediaSession, cmd string, args string, ctrlIn ExecuteCtrlChan, ctrlOut ExecuteCtrlChan)

func (*ScriptCommandHandler) ExecuteWithPush added in v0.0.3

func (sc *ScriptCommandHandler) ExecuteWithPush(s *MediaSession, dataIn ExecuteDataChan)

func (*ScriptCommandHandler) GetCommandTrait added in v0.0.2

func (sc *ScriptCommandHandler) GetCommandTrait() []CommandTrait

type SessionListener added in v0.0.3

type SessionListener interface {
	OnSessionCreated(s *MediaSession)
	OnSessionUpdated(s *MediaSession)
	OnSessionStarted(s *MediaSession)
	OnSessionStopped(s *MediaSession)
}

SessionListener methods are called concurrently, so it must be goroutine safe

type Sink

type Sink interface {
	HandleData(s *MediaSession, pl *utils.PacketList)
}

Sink consumes data from RTP session receive loop fetches rtp data packet and feeds it to all sinks in sink-list

type SinkFactory

type SinkFactory interface {
	NewSink(s *MediaSession) Sink
}

type Source

type Source interface {
	PullData(s *MediaSession, pl **utils.PacketList)
}

Source provides data for RTP session either generates data by it own or append/change data from previous source by modifying PacketList object, once it is passed through all sources, RTP send loop ultimately create new packet from PacketList then send it. so be careful the order of sources

type SourceFactory

type SourceFactory interface {
	NewSource(s *MediaSession) Source
}

type TraitEnum

type TraitEnum uint8

Directories

Path Synopsis
nmd

Jump to

Keyboard shortcuts

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