rtmp

package
v0.0.0-...-2729f56 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigEndianToUint32

func BigEndianToUint32(b []byte) uint32

func GenerateCommonConnInitializer

func GenerateCommonConnInitializer() func(c Conn)

func IsConnFatalError

func IsConnFatalError(err error) bool

func IsConnRejectedError

func IsConnRejectedError(err error) bool

func IsConnWarnError

func IsConnWarnError(err error) bool

func ListenAndServe

func ListenAndServe(ctx context.Context, addr string, logger *zap.Logger, connOps ...ConnOption) error

func LittleEndianToUint32

func LittleEndianToUint32(b []byte) uint32

func ReadExtendedTimestamp

func ReadExtendedTimestamp(r io.Reader) (uint32, error)

func Uint32ToBigEndian

func Uint32ToBigEndian(b []byte, v uint32)

func Uint32ToLittleEndian

func Uint32ToLittleEndian(b []byte, v uint32)

Types

type AbortMessage

type AbortMessage interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	zapcore.ObjectMarshaler
	ChunkStreamID() uint32
}

func NewAbortMessage

func NewAbortMessage(
	chunkStreamID uint32,
) AbortMessage

func ReadAbortMessage

func ReadAbortMessage(r io.Reader) (AbortMessage, error)

func UnmarshalAbortMessageBinary

func UnmarshalAbortMessageBinary(b []byte) (AbortMessage, error)

type AbortMessageHandler

type AbortMessageHandler interface {
	OnAbortMessage(ctx context.Context, abortMessage AbortMessage) ConnError
}

type AbortMessageHandlerFunc

type AbortMessageHandlerFunc func(ctx context.Context, abortMessage AbortMessage) ConnError

func (AbortMessageHandlerFunc) OnAbortMessage

func (f AbortMessageHandlerFunc) OnAbortMessage(ctx context.Context, abortMessage AbortMessage) ConnError

type Acknowledgement

type Acknowledgement interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	zapcore.ObjectMarshaler
	SequenceNumber() uint32
}

func NewAcknowledgement

func NewAcknowledgement(
	sequenceNumber uint32,
) Acknowledgement

func ReadAcknowledgement

func ReadAcknowledgement(r io.Reader) (Acknowledgement, error)

func UnmarshalAcknowledgementBinary

func UnmarshalAcknowledgementBinary(b []byte) (Acknowledgement, error)

type AcknowledgementHandler

type AcknowledgementHandler interface {
	OnAcknowledgement(ctx context.Context, acknowledgement Acknowledgement) ConnError
}

type AcknowledgementHandlerFunc

type AcknowledgementHandlerFunc func(ctx context.Context, acknowledgement Acknowledgement) ConnError

func (AcknowledgementHandlerFunc) OnAcknowledgement

func (f AcknowledgementHandlerFunc) OnAcknowledgement(ctx context.Context, acknowledgement Acknowledgement) ConnError

type AudioCodecFlag

type AudioCodecFlag uint32
const (
	AudioCodecFlagNone    AudioCodecFlag = 1
	AudioCodecFlagAdpcm   AudioCodecFlag = 2
	AudioCodecFlagMp3     AudioCodecFlag = 4
	AudioCodecFlagIntel   AudioCodecFlag = 8
	AudioCodecFlagUnused  AudioCodecFlag = 16
	AudioCodecFlagNelly8  AudioCodecFlag = 32
	AudioCodecFlagNelly   AudioCodecFlag = 64
	AudioCodecFlagG711a   AudioCodecFlag = 128
	AudioCodecFlagG711u   AudioCodecFlag = 256
	AudioCodecFlagNelly16 AudioCodecFlag = 512
	AudioCodecFlagAac     AudioCodecFlag = 1024
	AudioCodecFlagSpeex   AudioCodecFlag = 2048
	AudioCodecFlagAll     AudioCodecFlag = 4095
)

func (AudioCodecFlag) String

func (i AudioCodecFlag) String() string

type BandwidthLimitType

type BandwidthLimitType uint8
const (
	BandwidthLimitTypeHard    BandwidthLimitType = 0
	BandwidthLimitTypeSoft    BandwidthLimitType = 1
	BandwidthLimitTypeDynamic BandwidthLimitType = 2
)

func (BandwidthLimitType) String

func (i BandwidthLimitType) String() string

type Call

type Call interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	ProcedureName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	OptionalArguments() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewCall

func NewCall(
	procedureName string,
	transactionID uint32,
	commandObject map[string]interface{},
	optionalArguments map[string]interface{},
	encodingAMFType EncodingAMFType,
) Call

func UnmarshalCallBinary

func UnmarshalCallBinary(b []byte, encodingAMFType EncodingAMFType) (Call, error)

type CallHandler

type CallHandler interface {
	OnCall(ctx context.Context, call Call) ConnError
}

type CallHandlerFunc

type CallHandlerFunc func(ctx context.Context, call Call) ConnError

func (CallHandlerFunc) OnCall

func (f CallHandlerFunc) OnCall(ctx context.Context, call Call) ConnError

type CallResponse

type CallResponse interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	Response() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewCallResponse

func NewCallResponse(
	commandName string,
	transactionID uint32,
	commandObject map[string]interface{},
	response map[string]interface{},
	encodingAMFType EncodingAMFType,
) CallResponse

func UnmarshalCallResponseBinary

func UnmarshalCallResponseBinary(b []byte, encodingAMFType EncodingAMFType) (CallResponse, error)

type CallResponseHandler

type CallResponseHandler interface {
	OnCallResponse(ctx context.Context, callResponse CallResponse) ConnError
}

type CallResponseHandlerFunc

type CallResponseHandlerFunc func(ctx context.Context, callResponse CallResponse) ConnError

func (CallResponseHandlerFunc) OnCallResponse

func (f CallResponseHandlerFunc) OnCallResponse(ctx context.Context, callResponse CallResponse) ConnError

type Chunk

type Chunk interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	Header() ChunkHeader
	Data() []byte
}

func NewChunk

func NewChunk(
	header ChunkHeader,
	data []byte,
) Chunk

type ChunkBasicHeader

type ChunkBasicHeader interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	Fmt() uint8
	ChunkStreamID() uint32
}

func GenerateChunkBasicHeader

func GenerateChunkBasicHeader(fmt uint8, chunkStreamID uint32) ChunkBasicHeader

func ReadChunkBasicHeader

func ReadChunkBasicHeader(r io.Reader) (ChunkBasicHeader, error)

type ChunkBasicHeader1B

type ChunkBasicHeader1B interface {
	ChunkBasicHeader
	encoding.BinaryUnmarshaler
}

func NewChunkBasicHeader1B

func NewChunkBasicHeader1B(
	fmt uint8,
	chunkStreamID uint32,
) ChunkBasicHeader1B

func ReadChunkBasicHeader1B

func ReadChunkBasicHeader1B(r io.Reader) (ChunkBasicHeader1B, error)

func UnmarshalChunkBasicHeader1BBinary

func UnmarshalChunkBasicHeader1BBinary(b []byte) (ChunkBasicHeader1B, error)

type ChunkBasicHeader2B

type ChunkBasicHeader2B interface {
	ChunkBasicHeader
	encoding.BinaryUnmarshaler
}

func NewChunkBasicHeader2B

func NewChunkBasicHeader2B(
	fmt uint8,
	chunkStreamID uint32,
) ChunkBasicHeader2B

func ReadChunkBasicHeader2B

func ReadChunkBasicHeader2B(r io.Reader) (ChunkBasicHeader2B, error)

func UnmarshalChunkBasicHeader2BBinary

func UnmarshalChunkBasicHeader2BBinary(b []byte) (ChunkBasicHeader2B, error)

type ChunkBasicHeader3B

type ChunkBasicHeader3B interface {
	ChunkBasicHeader
	encoding.BinaryUnmarshaler
}

func NewChunkBasicHeader3B

func NewChunkBasicHeader3B(
	fmt uint8,
	chunkStreamID uint32,
) ChunkBasicHeader3B

func ReadChunkBasicHeader3B

func ReadChunkBasicHeader3B(r io.Reader) (ChunkBasicHeader3B, error)

func UnmarshalChunkBasicHeader3BBinary

func UnmarshalChunkBasicHeader3BBinary(b []byte) (ChunkBasicHeader3B, error)

type ChunkHeader

type ChunkHeader interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	BasicHeader() ChunkBasicHeader
	MessageHeader() ChunkMessageHeader
	ExtendedTimestamp() uint32
	Timestamp() uint32
	TimestampDelta() uint32
}

func NewChunkHeader

func NewChunkHeader(
	basicHeader ChunkBasicHeader,
	messageHeader ChunkMessageHeader,
	extendedTimestamp uint32,
) ChunkHeader

func ReadChunkHeader

func ReadChunkHeader(r io.Reader) (ChunkHeader, error)

type ChunkMessageHeader

type ChunkMessageHeader interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	NeedsExtendedTimestamp() bool
}

func ReadChunkMessageHeader

func ReadChunkMessageHeader(r io.Reader, fmt uint8) (ChunkMessageHeader, error)

type ChunkMessageHeaderType0

type ChunkMessageHeaderType0 interface {
	ChunkMessageHeader
	encoding.BinaryUnmarshaler
	Timestamp() uint32
	MessageLength() uint32
	MessageTypeID() MessageTypeID
	MessageStreamID() uint32
}

func NewChunkMessageHeaderType0

func NewChunkMessageHeaderType0(
	timestamp uint32,
	messageLength uint32,
	messageTypeID MessageTypeID,
	messageStreamID uint32,
) ChunkMessageHeaderType0

func ReadChunkMessageHeaderType0

func ReadChunkMessageHeaderType0(r io.Reader) (ChunkMessageHeaderType0, error)

func UnmarshalChunkMessageHeaderType0Binary

func UnmarshalChunkMessageHeaderType0Binary(b []byte) (ChunkMessageHeaderType0, error)

type ChunkMessageHeaderType1

type ChunkMessageHeaderType1 interface {
	ChunkMessageHeader
	encoding.BinaryUnmarshaler
	TimestampDelta() uint32
	MessageLength() uint32
	MessageTypeID() MessageTypeID
}

func NewChunkMessageHeaderType1

func NewChunkMessageHeaderType1(
	timestampDelta uint32,
	messageLength uint32,
	messageTypeID MessageTypeID,
) ChunkMessageHeaderType1

func ReadChunkMessageHeaderType1

func ReadChunkMessageHeaderType1(r io.Reader) (ChunkMessageHeaderType1, error)

func UnmarshalChunkMessageHeaderType1Binary

func UnmarshalChunkMessageHeaderType1Binary(b []byte) (ChunkMessageHeaderType1, error)

type ChunkMessageHeaderType2

type ChunkMessageHeaderType2 interface {
	ChunkMessageHeader
	encoding.BinaryUnmarshaler
	TimestampDelta() uint32
}

func NewChunkMessageHeaderType2

func NewChunkMessageHeaderType2(
	timestampDelta uint32,
) ChunkMessageHeaderType2

func ReadChunkMessageHeaderType2

func ReadChunkMessageHeaderType2(r io.Reader) (ChunkMessageHeaderType2, error)

func UnmarshalChunkMessageHeaderType2Binary

func UnmarshalChunkMessageHeaderType2Binary(b []byte) (ChunkMessageHeaderType2, error)

type ChunkMessageHeaderType3

type ChunkMessageHeaderType3 interface {
	ChunkMessageHeader
	encoding.BinaryUnmarshaler
}

func NewChunkMessageHeaderType3

func NewChunkMessageHeaderType3() ChunkMessageHeaderType3

func ReadChunkMessageHeaderType3

func ReadChunkMessageHeaderType3(r io.Reader) (ChunkMessageHeaderType3, error)

func UnmarshalChunkMessageHeaderType3Binary

func UnmarshalChunkMessageHeaderType3Binary(b []byte) (ChunkMessageHeaderType3, error)

type Client

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

func NewClient

func NewClient(
	ctx context.Context,
	logger *zap.Logger,
	connOps ...ConnOption,
) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, addr string) (Conn, error)

type Close

type Close interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewClose

func NewClose(
	encodingAMFType EncodingAMFType,
) Close

func UnmarshalCloseBinary

func UnmarshalCloseBinary(b []byte, encodingAMFType EncodingAMFType) (Close, error)

type CloseHandler

type CloseHandler interface {
	OnClose(ctx context.Context, close Close) ConnError
}

type CloseHandlerFunc

type CloseHandlerFunc func(ctx context.Context, close Close) ConnError

func (CloseHandlerFunc) OnClose

func (f CloseHandlerFunc) OnClose(ctx context.Context, close Close) ConnError

type CloseStream

type CloseStream interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	StreamID() uint32
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewCloseStream

func NewCloseStream(
	streamID uint32,
	encodingAMFType EncodingAMFType,
) CloseStream

func UnmarshalCloseStreamBinary

func UnmarshalCloseStreamBinary(b []byte, encodingAMFType EncodingAMFType) (CloseStream, error)

type CloseStreamHandler

type CloseStreamHandler interface {
	OnCloseStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, closeStream CloseStream) ConnError
}

type CloseStreamHandlerFunc

type CloseStreamHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, closeStream CloseStream) ConnError

func (CloseStreamHandlerFunc) OnCloseStream

func (f CloseStreamHandlerFunc) OnCloseStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, closeStream CloseStream) ConnError

type Conn

type Conn interface {
	Serve() error
	io.Closer
	Context() context.Context

	Reader() Reader
	SetReader(r Reader)

	Writer() Writer
	SetWriter(w Writer)

	MessagePubsub

	ProtocolController
	DefaultProtocolControlEventHandler() ProtocolControlEventHandler
	UserController
	DefaultUserControlEventHandler() UserControlEventHandler
	NetConnectionCommander
	DefaultNetConnectionCommandHandler() NetConnectionCommandHandler
	NetStreamCommander
	DefaultNetStreamCommandHandler() NetStreamCommandHandler

	SetCreateStreamCallbacks(transactionID uint32, f func(CreateStreamResponse) ConnError)
	AddNetstreamCommandCallbacks(func(OnStatus) ConnError)
	TransactionID() uint32

	Logger() *zap.Logger
}

func NewDefaultConn

func NewDefaultConn(
	ctx context.Context,
	nc net.Conn,
	isServer bool,
	logger *zap.Logger,
	connOps ...ConnOption,
) Conn

type ConnError

type ConnError interface {
	error
	ErrorLevel() ErrorLevel
	Fields() []zapcore.Field
}

func NewConnFatalError

func NewConnFatalError(err error, fields ...zapcore.Field) ConnError

func NewConnRejectedError

func NewConnRejectedError(err error, fields ...zapcore.Field) ConnError

func NewConnWarnError

func NewConnWarnError(err error, fields ...zapcore.Field) ConnError

type ConnOption

type ConnOption func(*connOptions)

func WithConnInitializers

func WithConnInitializers(connInitializers ...func(Conn)) ConnOption

func WithOnConnectValidators

func WithOnConnectValidators(onConnectValidators ...func(ctx context.Context, connect Connect) ConnectError) ConnOption

func WithOnPublishValidators

func WithOnPublishValidators(onPublishValidators ...func(ctx context.Context, publish Publish) (errorInfo map[string]interface{})) ConnOption

type Connect

type Connect interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	OptionalUserArguments() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewConnect

func NewConnect(
	commandObject map[string]interface{},
	optionalUserArguments map[string]interface{},
	encodingAMFType EncodingAMFType,
) Connect

func UnmarshalConnectBinary

func UnmarshalConnectBinary(b []byte, encodingAMFType EncodingAMFType) (Connect, error)

type ConnectError

type ConnectError interface {
	ConnectResponse
	CommandName() string
	TransactionID() uint32
	Properties() map[string]interface{}
	Information() map[string]interface{}
}

func NewConnectError

func NewConnectError(
	properties map[string]interface{},
	information map[string]interface{},
	encodingAMFType EncodingAMFType,
) ConnectError

func UnmarshalConnectErrorBinary

func UnmarshalConnectErrorBinary(b []byte, encodingAMFType EncodingAMFType) (ConnectError, error)

type ConnectErrorHandler

type ConnectErrorHandler interface {
	OnConnectError(ctx context.Context, connectError ConnectError) ConnError
}

type ConnectErrorHandlerFunc

type ConnectErrorHandlerFunc func(ctx context.Context, connectError ConnectError) ConnError

func (ConnectErrorHandlerFunc) OnConnectError

func (f ConnectErrorHandlerFunc) OnConnectError(ctx context.Context, connectError ConnectError) ConnError

type ConnectHandler

type ConnectHandler interface {
	OnConnect(ctx context.Context, connect Connect) ConnError
}

type ConnectHandlerFunc

type ConnectHandlerFunc func(ctx context.Context, connect Connect) ConnError

func (ConnectHandlerFunc) OnConnect

func (f ConnectHandlerFunc) OnConnect(ctx context.Context, connect Connect) ConnError

type ConnectResponse

type ConnectResponse interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

type ConnectResult

type ConnectResult interface {
	ConnectResponse
	CommandName() string
	TransactionID() uint32
	Properties() map[string]interface{}
	Information() map[string]interface{}
}

func NewConnectResult

func NewConnectResult(
	properties map[string]interface{},
	information map[string]interface{},
	encodingAMFType EncodingAMFType,
) ConnectResult

func UnmarshalConnectResultBinary

func UnmarshalConnectResultBinary(b []byte, encodingAMFType EncodingAMFType) (ConnectResult, error)

type ConnectResultHandler

type ConnectResultHandler interface {
	OnConnectResult(ctx context.Context, connectResult ConnectResult) ConnError
}

type ConnectResultHandlerFunc

type ConnectResultHandlerFunc func(ctx context.Context, connectResult ConnectResult) ConnError

func (ConnectResultHandlerFunc) OnConnectResult

func (f ConnectResultHandlerFunc) OnConnectResult(ctx context.Context, connectResult ConnectResult) ConnError

type ControlMessageHandler

type ControlMessageHandler struct {
	ProtocolControlEventHandler ProtocolControlEventHandler
	UserControlEventHandler     UserControlEventHandler
	NetConnectionCommandHandler NetConnectionCommandHandler
	NetStreamCommandHandler     NetStreamCommandHandler
}

func NewControlMessageHandler

func NewControlMessageHandler(conn Conn) *ControlMessageHandler

func (*ControlMessageHandler) HandleMessage

func (h *ControlMessageHandler) HandleMessage(ctx context.Context, m Message) ConnError

type CreateStream

type CreateStream interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewCreateStream

func NewCreateStream(
	transactionID uint32,
	commandObject map[string]interface{},
	encodingAMFType EncodingAMFType,
) CreateStream

func UnmarshalCreateStreamBinary

func UnmarshalCreateStreamBinary(b []byte, encodingAMFType EncodingAMFType) (CreateStream, error)

type CreateStreamError

type CreateStreamError interface {
	CreateStreamResponse
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	StreamID() uint32
}

func NewCreateStreamError

func NewCreateStreamError(
	transactionID uint32,
	commandObject map[string]interface{},
	streamID uint32,
	encodingAMFType EncodingAMFType,
) CreateStreamError

func UnmarshalCreateStreamErrorBinary

func UnmarshalCreateStreamErrorBinary(b []byte, encodingAMFType EncodingAMFType) (CreateStreamError, error)

type CreateStreamErrorHandler

type CreateStreamErrorHandler interface {
	OnCreateStreamError(ctx context.Context, createStreamError CreateStreamError) ConnError
}

type CreateStreamErrorHandlerFunc

type CreateStreamErrorHandlerFunc func(ctx context.Context, createStreamError CreateStreamError) ConnError

func (CreateStreamErrorHandlerFunc) OnCreateStreamError

func (f CreateStreamErrorHandlerFunc) OnCreateStreamError(ctx context.Context, createStreamError CreateStreamError) ConnError

type CreateStreamHandler

type CreateStreamHandler interface {
	OnCreateStream(ctx context.Context, createStream CreateStream) ConnError
}

type CreateStreamHandlerFunc

type CreateStreamHandlerFunc func(ctx context.Context, createStream CreateStream) ConnError

func (CreateStreamHandlerFunc) OnCreateStream

func (f CreateStreamHandlerFunc) OnCreateStream(ctx context.Context, createStream CreateStream) ConnError

type CreateStreamResponse

type CreateStreamResponse interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

type CreateStreamResult

type CreateStreamResult interface {
	CreateStreamResponse
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	StreamID() uint32
}

func NewCreateStreamResult

func NewCreateStreamResult(
	transactionID uint32,
	commandObject map[string]interface{},
	streamID uint32,
	encodingAMFType EncodingAMFType,
) CreateStreamResult

func UnmarshalCreateStreamResultBinary

func UnmarshalCreateStreamResultBinary(b []byte, encodingAMFType EncodingAMFType) (CreateStreamResult, error)

type CreateStreamResultHandler

type CreateStreamResultHandler interface {
	OnCreateStreamResult(ctx context.Context, createStreamResult CreateStreamResult) ConnError
}

type CreateStreamResultHandlerFunc

type CreateStreamResultHandlerFunc func(ctx context.Context, createStreamResult CreateStreamResult) ConnError

func (CreateStreamResultHandlerFunc) OnCreateStreamResult

func (f CreateStreamResultHandlerFunc) OnCreateStreamResult(ctx context.Context, createStreamResult CreateStreamResult) ConnError

type DeleteStream

type DeleteStream interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	StreamID() uint32
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewDeleteStream

func NewDeleteStream(
	streamID uint32,
	encodingAMFType EncodingAMFType,
) DeleteStream

func UnmarshalDeleteStreamBinary

func UnmarshalDeleteStreamBinary(b []byte, encodingAMFType EncodingAMFType) (DeleteStream, error)

type DeleteStreamHandler

type DeleteStreamHandler interface {
	OnDeleteStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, deleteStream DeleteStream) ConnError
}

type DeleteStreamHandlerFunc

type DeleteStreamHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, deleteStream DeleteStream) ConnError

func (DeleteStreamHandlerFunc) OnDeleteStream

func (f DeleteStreamHandlerFunc) OnDeleteStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, deleteStream DeleteStream) ConnError

type EncodingAMFType

type EncodingAMFType uint8
const (
	EncodingAMFTypeAMF0 EncodingAMFType = 0
	EncodingAMFTypeAMF3 EncodingAMFType = 3
)

func (EncodingAMFType) String

func (i EncodingAMFType) String() string

type ErrorLevel

type ErrorLevel string
const (
	ErrorLevelFatal    ErrorLevel = "fatal"
	ErrorLevelWarn     ErrorLevel = "warn"
	ErrorLevelRejected ErrorLevel = "rejected"
)

type EventType

type EventType uint16
const (
	EventTypeStreamBegin      EventType = 0
	EventTypeStreamEOF        EventType = 1
	EventTypeStreamDry        EventType = 2
	EventTypeSetBufferLength  EventType = 3
	EventTypeStreamIsRecorded EventType = 4
	EventTypePingRequest      EventType = 6
	EventTypePingResponse     EventType = 7
)

func (EventType) String

func (i EventType) String() string

type Message

type Message interface {
	zapcore.ObjectMarshaler
	ChunkStreamID() uint32
	TypeID() MessageTypeID
	Timestamp() uint32
	StreamID() uint32
	Payload() []byte
}

func NewMessage

func NewMessage(
	chunkStreamID uint32,
	typeID MessageTypeID,
	timestamp uint32,
	streamID uint32,
	payload []byte,
) Message

type MessageHandler

type MessageHandler interface {
	HandleMessage(ctx context.Context, m Message) ConnError
}

type MessageHandlerFunc

type MessageHandlerFunc func(ctx context.Context, m Message) ConnError

func (MessageHandlerFunc) HandleMessage

func (f MessageHandlerFunc) HandleMessage(ctx context.Context, m Message) ConnError

type MessagePubsub

type MessagePubsub interface {
	MessageHandler
	AddMessageHandler(id string, h MessageHandler)
	RemoveMessageHandler(id string)
}

func NewDefaultMessagePubsub

func NewDefaultMessagePubsub() MessagePubsub

type MessageTypeID

type MessageTypeID uint8
const (
	MessageTypeIDSetChunkSize              MessageTypeID = 1
	MessageTypeIDAbortMessage              MessageTypeID = 2
	MessageTypeIDAcknowledgement           MessageTypeID = 3
	MessageTypeIDUserControlMessages       MessageTypeID = 4
	MessageTypeIDWindowAcknowledgementSize MessageTypeID = 5
	MessageTypeIDSetPeerBandwidth          MessageTypeID = 6
	MessageTypeIDAudio                     MessageTypeID = 8
	MessageTypeIDVideo                     MessageTypeID = 9
	MessageTypeIDDataAMF3                  MessageTypeID = 15
	MessageTypeIDSharedObjectAMF3          MessageTypeID = 16
	MessageTypeIDCommandAMF3               MessageTypeID = 17
	MessageTypeIDDataAMF0                  MessageTypeID = 18
	MessageTypeIDSharedObjectAMF0          MessageTypeID = 19
	MessageTypeIDCommandAMF0               MessageTypeID = 20
	MessageTypeIDAggregate                 MessageTypeID = 22
)

func (MessageTypeID) String

func (i MessageTypeID) String() string

type NetConnectionCommandHandler

type NetConnectionCommandHandler struct {
	ConnectHandlers            []ConnectHandler
	ConnectResultHandlers      []ConnectResultHandler
	ConnectErrorHandlers       []ConnectErrorHandler
	CallHandlers               []CallHandler
	CallResponseHandlers       []CallResponseHandler
	CloseHandlers              []CloseHandler
	CreateStreamHandlers       []CreateStreamHandler
	CreateStreamResultHandlers []CreateStreamResultHandler
	CreateStreamErrorHandlers  []CreateStreamErrorHandler
}

func (*NetConnectionCommandHandler) OnCall

func (*NetConnectionCommandHandler) OnCallResponse

func (h *NetConnectionCommandHandler) OnCallResponse(ctx context.Context, callResponse CallResponse) ConnError

func (*NetConnectionCommandHandler) OnClose

func (*NetConnectionCommandHandler) OnConnect

func (h *NetConnectionCommandHandler) OnConnect(ctx context.Context, connect Connect) ConnError

func (*NetConnectionCommandHandler) OnConnectError

func (h *NetConnectionCommandHandler) OnConnectError(ctx context.Context, connectError ConnectError) ConnError

func (*NetConnectionCommandHandler) OnConnectResult

func (h *NetConnectionCommandHandler) OnConnectResult(ctx context.Context, connectResult ConnectResult) ConnError

func (*NetConnectionCommandHandler) OnCreateStream

func (h *NetConnectionCommandHandler) OnCreateStream(ctx context.Context, createStream CreateStream) ConnError

func (*NetConnectionCommandHandler) OnCreateStreamError

func (h *NetConnectionCommandHandler) OnCreateStreamError(ctx context.Context, createStreamError CreateStreamError) ConnError

func (*NetConnectionCommandHandler) OnCreateStreamResult

func (h *NetConnectionCommandHandler) OnCreateStreamResult(ctx context.Context, createStreamResult CreateStreamResult) ConnError

type NetConnectionCommander

type NetConnectionCommander interface {
	Connect(ctx context.Context, commandObject map[string]interface{}, optionalUserArguments map[string]interface{}) error
	ConnectResult(ctx context.Context, properties map[string]interface{}, information map[string]interface{}) error
	ConnectError(ctx context.Context, properties map[string]interface{}, information map[string]interface{}) error
	Call(ctx context.Context, procedureName string, transactionID uint32, commandObject map[string]interface{}, optionalArguments map[string]interface{}) error
	CallResponse(ctx context.Context, commandName string, transactionID uint32, commandObject map[string]interface{}, response map[string]interface{}) error
	CreateStream(ctx context.Context, transactionID uint32, commandObject map[string]interface{}) error
	CreateStreamResult(ctx context.Context, transactionID uint32, commandObject map[string]interface{}, streamID uint32) error
	CreateStreamError(ctx context.Context, transactionID uint32, commandObject map[string]interface{}, streamID uint32) error
}

type NetStreamCommandHandler

type NetStreamCommandHandler struct {
	OnStatusHandlers     []OnStatusHandler
	PlayHandlers         []PlayHandler
	Play2Handlers        []Play2Handler
	DeleteStreamHandlers []DeleteStreamHandler
	CloseStreamHandlers  []CloseStreamHandler
	ReceiveAudioHandlers []ReceiveAudioHandler
	ReceiveVideoHandlers []ReceiveVideoHandler
	PublishHandlers      []PublishHandler
	SeekHandlers         []SeekHandler
	PauseHandlers        []PauseHandler
}

func (*NetStreamCommandHandler) OnCloseStream

func (h *NetStreamCommandHandler) OnCloseStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, closeStream CloseStream) ConnError

func (*NetStreamCommandHandler) OnDeleteStream

func (h *NetStreamCommandHandler) OnDeleteStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, deleteStream DeleteStream) ConnError

func (*NetStreamCommandHandler) OnOnStatus

func (h *NetStreamCommandHandler) OnOnStatus(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, onStatus OnStatus) ConnError

func (*NetStreamCommandHandler) OnPause

func (h *NetStreamCommandHandler) OnPause(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, pause Pause) ConnError

func (*NetStreamCommandHandler) OnPlay

func (h *NetStreamCommandHandler) OnPlay(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play Play) ConnError

func (*NetStreamCommandHandler) OnPlay2

func (h *NetStreamCommandHandler) OnPlay2(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play2 Play2) ConnError

func (*NetStreamCommandHandler) OnPublish

func (h *NetStreamCommandHandler) OnPublish(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, publish Publish) ConnError

func (*NetStreamCommandHandler) OnReceiveAudio

func (h *NetStreamCommandHandler) OnReceiveAudio(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveAudio ReceiveAudio) ConnError

func (*NetStreamCommandHandler) OnReceiveVideo

func (h *NetStreamCommandHandler) OnReceiveVideo(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveVideo ReceiveVideo) ConnError

func (*NetStreamCommandHandler) OnSeek

func (h *NetStreamCommandHandler) OnSeek(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, seek Seek) ConnError

type NetStreamCommander

type NetStreamCommander interface {
	OnStatus(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, infoObject map[string]interface{}) error
	Play(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, streamName string, start uint32, duration uint32, reset bool) error
	Play2(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, parameters map[string]interface{}) error
	DeleteStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, streamID uint32) error
	CloseStream(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, streamID uint32) error
	ReceiveAudio(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, boolFlag bool) error
	ReceiveVideo(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, boolFlag bool) error
	Publish(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, publishingName string, publishingType PublishingType) error
	Seek(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, milliSeconds uint32) error
	Pause(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, pauseUnpauseFlag bool, milliSeconds uint32) error
}

type OnStatus

type OnStatus interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	InfoObject() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewOnStatus

func NewOnStatus(
	infoObject map[string]interface{},
	encodingAMFType EncodingAMFType,
) OnStatus

func UnmarshalOnStatusBinary

func UnmarshalOnStatusBinary(b []byte, encodingAMFType EncodingAMFType) (OnStatus, error)

type OnStatusHandler

type OnStatusHandler interface {
	OnOnStatus(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, onStatus OnStatus) ConnError
}

type OnStatusHandlerFunc

type OnStatusHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, onStatus OnStatus) ConnError

func (OnStatusHandlerFunc) OnOnStatus

func (f OnStatusHandlerFunc) OnOnStatus(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, onStatus OnStatus) ConnError

type Pause

type Pause interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	PauseUnpauseFlag() bool
	MilliSeconds() uint32
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewPause

func NewPause(
	pauseUnpauseFlag bool,
	milliSeconds uint32,
	encodingAMFType EncodingAMFType,
) Pause

func UnmarshalPauseBinary

func UnmarshalPauseBinary(b []byte, encodingAMFType EncodingAMFType) (Pause, error)

type PauseHandler

type PauseHandler interface {
	OnPause(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, pause Pause) ConnError
}

type PauseHandlerFunc

type PauseHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, pause Pause) ConnError

func (PauseHandlerFunc) OnPause

func (f PauseHandlerFunc) OnPause(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, pause Pause) ConnError

type PingRequest

type PingRequest interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	Timestamp() uint32
}

func NewPingRequest

func NewPingRequest(
	timestamp uint32,
) PingRequest

func ReadPingRequest

func ReadPingRequest(r io.Reader) (PingRequest, error)

func UnmarshalPingRequestBinary

func UnmarshalPingRequestBinary(b []byte) (PingRequest, error)

type PingRequestHandler

type PingRequestHandler interface {
	OnPingRequest(ctx context.Context, pingRequest PingRequest) ConnError
}

type PingRequestHandlerFunc

type PingRequestHandlerFunc func(ctx context.Context, pingRequest PingRequest) ConnError

func (PingRequestHandlerFunc) OnPingRequest

func (f PingRequestHandlerFunc) OnPingRequest(ctx context.Context, pingRequest PingRequest) ConnError

type PingResponse

type PingResponse interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	Timestamp() uint32
}

func NewPingResponse

func NewPingResponse(
	timestamp uint32,
) PingResponse

func ReadPingResponse

func ReadPingResponse(r io.Reader) (PingResponse, error)

func UnmarshalPingResponseBinary

func UnmarshalPingResponseBinary(b []byte) (PingResponse, error)

type PingResponseHandler

type PingResponseHandler interface {
	OnPingResponse(ctx context.Context, pingResponse PingResponse) ConnError
}

type PingResponseHandlerFunc

type PingResponseHandlerFunc func(ctx context.Context, pingResponse PingResponse) ConnError

func (PingResponseHandlerFunc) OnPingResponse

func (f PingResponseHandlerFunc) OnPingResponse(ctx context.Context, pingResponse PingResponse) ConnError

type Play

type Play interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	StreamName() string
	Start() uint32
	Duration() uint32
	Reset() bool
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewPlay

func NewPlay(
	streamName string,
	start uint32,
	duration uint32,
	reset bool,
	encodingAMFType EncodingAMFType,
) Play

func UnmarshalPlayBinary

func UnmarshalPlayBinary(b []byte, encodingAMFType EncodingAMFType) (Play, error)

type Play2

type Play2 interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	Parameters() map[string]interface{}
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewPlay2

func NewPlay2(
	parameters map[string]interface{},
	encodingAMFType EncodingAMFType,
) Play2

func UnmarshalPlay2Binary

func UnmarshalPlay2Binary(b []byte, encodingAMFType EncodingAMFType) (Play2, error)

type Play2Handler

type Play2Handler interface {
	OnPlay2(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play2 Play2) ConnError
}

type Play2HandlerFunc

type Play2HandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play2 Play2) ConnError

func (Play2HandlerFunc) OnPlay2

func (f Play2HandlerFunc) OnPlay2(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play2 Play2) ConnError

type PlayHandler

type PlayHandler interface {
	OnPlay(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play Play) ConnError
}

type PlayHandlerFunc

type PlayHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play Play) ConnError

func (PlayHandlerFunc) OnPlay

func (f PlayHandlerFunc) OnPlay(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, play Play) ConnError

type ProtocolControlEventHandler

type ProtocolControlEventHandler struct {
	SetChunkSizeHandlers              []SetChunkSizeHandler
	AbortMessageHandlers              []AbortMessageHandler
	AcknowledgementHandlers           []AcknowledgementHandler
	WindowAcknowledgementSizeHandlers []WindowAcknowledgementSizeHandler
	SetPeerBandwidthHandlers          []SetPeerBandwidthHandler
}

func (*ProtocolControlEventHandler) OnAbortMessage

func (h *ProtocolControlEventHandler) OnAbortMessage(ctx context.Context, abortMessage AbortMessage) ConnError

func (*ProtocolControlEventHandler) OnAcknowledgement

func (h *ProtocolControlEventHandler) OnAcknowledgement(ctx context.Context, acknowledgement Acknowledgement) ConnError

func (*ProtocolControlEventHandler) OnSetChunkSize

func (h *ProtocolControlEventHandler) OnSetChunkSize(ctx context.Context, setChunkSize SetChunkSize) ConnError

func (*ProtocolControlEventHandler) OnSetPeerBandwidth

func (h *ProtocolControlEventHandler) OnSetPeerBandwidth(ctx context.Context, setPeerBandwidth SetPeerBandwidth) ConnError

func (*ProtocolControlEventHandler) OnWindowAcknowledgementSize

func (h *ProtocolControlEventHandler) OnWindowAcknowledgementSize(ctx context.Context, windowAcknowledgementSize WindowAcknowledgementSize) ConnError

type ProtocolController

type ProtocolController interface {
	SetChunkSize(ctx context.Context, chunkSize uint32) error
	AbortMessage(ctx context.Context, chunkStreamID uint32) error
	Acknowledgement(ctx context.Context, sequenceNumber uint32) error
	WindowAcknowledgementSize(ctx context.Context, acknowledgementWindowSize uint32) error
	SetPeerBandwidth(ctx context.Context, acknowledgmentWindowSize uint32, limitType BandwidthLimitType) error
}

type Publish

type Publish interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	PublishingName() string
	PublishingType() PublishingType
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewPublish

func NewPublish(
	publishingName string,
	publishingType PublishingType,
	encodingAMFType EncodingAMFType,
) Publish

func UnmarshalPublishBinary

func UnmarshalPublishBinary(b []byte, encodingAMFType EncodingAMFType) (Publish, error)

type PublishHandler

type PublishHandler interface {
	OnPublish(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, publish Publish) ConnError
}

type PublishHandlerFunc

type PublishHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, publish Publish) ConnError

func (PublishHandlerFunc) OnPublish

func (f PublishHandlerFunc) OnPublish(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, publish Publish) ConnError

type PublishingType

type PublishingType string
const (
	PublishingTypeLive   PublishingType = "live"
	PublishingTypeRecord PublishingType = "record"
	PublishingTypeAppend PublishingType = "append"
)

func (PublishingType) String

func (v PublishingType) String() string

type Reader

type Reader interface {
	io.Reader
	ReadMessage() (Message, error)
	SetChunkSize(chunkSize uint32)
	AbortMessage(chunkStreamID uint32)
	SetBandwidthLimitType(bandwidthLimitType BandwidthLimitType)
	SetAcknowledgementWindowSize(acknowledgementWindowSize uint32)
	CreateStream() (streamID uint32)
}

func NewDefaultReader

func NewDefaultReader(
	conn Conn,
	r io.Reader,
	acknowledgementWindowSize uint32,
	logger *zap.Logger,
) Reader

type ReceiveAudio

type ReceiveAudio interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	BoolFlag() bool
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewReceiveAudio

func NewReceiveAudio(
	boolFlag bool,
	encodingAMFType EncodingAMFType,
) ReceiveAudio

func UnmarshalReceiveAudioBinary

func UnmarshalReceiveAudioBinary(b []byte, encodingAMFType EncodingAMFType) (ReceiveAudio, error)

type ReceiveAudioHandler

type ReceiveAudioHandler interface {
	OnReceiveAudio(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveAudio ReceiveAudio) ConnError
}

type ReceiveAudioHandlerFunc

type ReceiveAudioHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveAudio ReceiveAudio) ConnError

func (ReceiveAudioHandlerFunc) OnReceiveAudio

func (f ReceiveAudioHandlerFunc) OnReceiveAudio(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveAudio ReceiveAudio) ConnError

type ReceiveVideo

type ReceiveVideo interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	BoolFlag() bool
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewReceiveVideo

func NewReceiveVideo(
	boolFlag bool,
	encodingAMFType EncodingAMFType,
) ReceiveVideo

func UnmarshalReceiveVideoBinary

func UnmarshalReceiveVideoBinary(b []byte, encodingAMFType EncodingAMFType) (ReceiveVideo, error)

type ReceiveVideoHandler

type ReceiveVideoHandler interface {
	OnReceiveVideo(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveVideo ReceiveVideo) ConnError
}

type ReceiveVideoHandlerFunc

type ReceiveVideoHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveVideo ReceiveVideo) ConnError

func (ReceiveVideoHandlerFunc) OnReceiveVideo

func (f ReceiveVideoHandlerFunc) OnReceiveVideo(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, receiveVideo ReceiveVideo) ConnError

type Seek

type Seek interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	CommandName() string
	TransactionID() uint32
	CommandObject() map[string]interface{}
	MilliSeconds() uint32
	EncodingAMFType() EncodingAMFType
	SetEncodingAMFType(EncodingAMFType)
}

func NewSeek

func NewSeek(
	milliSeconds uint32,
	encodingAMFType EncodingAMFType,
) Seek

func UnmarshalSeekBinary

func UnmarshalSeekBinary(b []byte, encodingAMFType EncodingAMFType) (Seek, error)

type SeekHandler

type SeekHandler interface {
	OnSeek(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, seek Seek) ConnError
}

type SeekHandlerFunc

type SeekHandlerFunc func(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, seek Seek) ConnError

func (SeekHandlerFunc) OnSeek

func (f SeekHandlerFunc) OnSeek(ctx context.Context, chunkStreamID uint32, messageStreamID uint32, seek Seek) ConnError

type Server

type Server struct {
	Addr string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	ctx context.Context,
	logger *zap.Logger,
	connOps ...ConnOption,
) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

type SetBufferLength

type SetBufferLength interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	StreamID() uint32
	BufferLength() uint32
}

func NewSetBufferLength

func NewSetBufferLength(
	streamID uint32,
	bufferLength uint32,
) SetBufferLength

func ReadSetBufferLength

func ReadSetBufferLength(r io.Reader) (SetBufferLength, error)

func UnmarshalSetBufferLengthBinary

func UnmarshalSetBufferLengthBinary(b []byte) (SetBufferLength, error)

type SetBufferLengthHandler

type SetBufferLengthHandler interface {
	OnSetBufferLength(ctx context.Context, setBufferLength SetBufferLength) ConnError
}

type SetBufferLengthHandlerFunc

type SetBufferLengthHandlerFunc func(ctx context.Context, setBufferLength SetBufferLength) ConnError

func (SetBufferLengthHandlerFunc) OnSetBufferLength

func (f SetBufferLengthHandlerFunc) OnSetBufferLength(ctx context.Context, setBufferLength SetBufferLength) ConnError

type SetChunkSize

type SetChunkSize interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	zapcore.ObjectMarshaler
	ChunkSize() uint32
}

func NewSetChunkSize

func NewSetChunkSize(
	chunkSize uint32,
) SetChunkSize

func ReadSetChunkSize

func ReadSetChunkSize(r io.Reader) (SetChunkSize, error)

func UnmarshalSetChunkSizeBinary

func UnmarshalSetChunkSizeBinary(b []byte) (SetChunkSize, error)

type SetChunkSizeHandler

type SetChunkSizeHandler interface {
	OnSetChunkSize(ctx context.Context, setChunkSize SetChunkSize) ConnError
}

type SetChunkSizeHandlerFunc

type SetChunkSizeHandlerFunc func(ctx context.Context, setChunkSize SetChunkSize) ConnError

func (SetChunkSizeHandlerFunc) OnSetChunkSize

func (f SetChunkSizeHandlerFunc) OnSetChunkSize(ctx context.Context, setChunkSize SetChunkSize) ConnError

type SetPeerBandwidth

type SetPeerBandwidth interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	zapcore.ObjectMarshaler
	AcknowledgmentWindowSize() uint32
	LimitType() BandwidthLimitType
}

func NewSetPeerBandwidth

func NewSetPeerBandwidth(
	acknowledgmentWindowSize uint32,
	limitType BandwidthLimitType,
) SetPeerBandwidth

func ReadSetPeerBandwidth

func ReadSetPeerBandwidth(r io.Reader) (SetPeerBandwidth, error)

func UnmarshalSetPeerBandwidthBinary

func UnmarshalSetPeerBandwidthBinary(b []byte) (SetPeerBandwidth, error)

type SetPeerBandwidthHandler

type SetPeerBandwidthHandler interface {
	OnSetPeerBandwidth(ctx context.Context, setPeerBandwidth SetPeerBandwidth) ConnError
}

type SetPeerBandwidthHandlerFunc

type SetPeerBandwidthHandlerFunc func(ctx context.Context, setPeerBandwidth SetPeerBandwidth) ConnError

func (SetPeerBandwidthHandlerFunc) OnSetPeerBandwidth

func (f SetPeerBandwidthHandlerFunc) OnSetPeerBandwidth(ctx context.Context, setPeerBandwidth SetPeerBandwidth) ConnError

type StreamBegin

type StreamBegin interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	StreamID() uint32
}

func NewStreamBegin

func NewStreamBegin(
	streamID uint32,
) StreamBegin

func ReadStreamBegin

func ReadStreamBegin(r io.Reader) (StreamBegin, error)

func UnmarshalStreamBeginBinary

func UnmarshalStreamBeginBinary(b []byte) (StreamBegin, error)

type StreamBeginHandler

type StreamBeginHandler interface {
	OnStreamBegin(ctx context.Context, streamBegin StreamBegin) ConnError
}

type StreamBeginHandlerFunc

type StreamBeginHandlerFunc func(ctx context.Context, streamBegin StreamBegin) ConnError

func (StreamBeginHandlerFunc) OnStreamBegin

func (f StreamBeginHandlerFunc) OnStreamBegin(ctx context.Context, streamBegin StreamBegin) ConnError

type StreamDry

type StreamDry interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	StreamID() uint32
}

func NewStreamDry

func NewStreamDry(
	streamID uint32,
) StreamDry

func ReadStreamDry

func ReadStreamDry(r io.Reader) (StreamDry, error)

func UnmarshalStreamDryBinary

func UnmarshalStreamDryBinary(b []byte) (StreamDry, error)

type StreamDryHandler

type StreamDryHandler interface {
	OnStreamDry(ctx context.Context, streamDry StreamDry) ConnError
}

type StreamDryHandlerFunc

type StreamDryHandlerFunc func(ctx context.Context, streamDry StreamDry) ConnError

func (StreamDryHandlerFunc) OnStreamDry

func (f StreamDryHandlerFunc) OnStreamDry(ctx context.Context, streamDry StreamDry) ConnError

type StreamEOF

type StreamEOF interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	StreamID() uint32
}

func NewStreamEOF

func NewStreamEOF(
	streamID uint32,
) StreamEOF

func ReadStreamEOF

func ReadStreamEOF(r io.Reader) (StreamEOF, error)

func UnmarshalStreamEOFBinary

func UnmarshalStreamEOFBinary(b []byte) (StreamEOF, error)

type StreamEOFHandler

type StreamEOFHandler interface {
	OnStreamEOF(ctx context.Context, streamEOF StreamEOF) ConnError
}

type StreamEOFHandlerFunc

type StreamEOFHandlerFunc func(ctx context.Context, streamEOF StreamEOF) ConnError

func (StreamEOFHandlerFunc) OnStreamEOF

func (f StreamEOFHandlerFunc) OnStreamEOF(ctx context.Context, streamEOF StreamEOF) ConnError

type StreamIsRecorded

type StreamIsRecorded interface {
	UserControlMessage
	encoding.BinaryUnmarshaler
	StreamID() uint32
}

func NewStreamIsRecorded

func NewStreamIsRecorded(
	streamID uint32,
) StreamIsRecorded

func ReadStreamIsRecorded

func ReadStreamIsRecorded(r io.Reader) (StreamIsRecorded, error)

func UnmarshalStreamIsRecordedBinary

func UnmarshalStreamIsRecordedBinary(b []byte) (StreamIsRecorded, error)

type StreamIsRecordedHandler

type StreamIsRecordedHandler interface {
	OnStreamIsRecorded(ctx context.Context, streamIsRecorded StreamIsRecorded) ConnError
}

type StreamIsRecordedHandlerFunc

type StreamIsRecordedHandlerFunc func(ctx context.Context, streamIsRecorded StreamIsRecorded) ConnError

func (StreamIsRecordedHandlerFunc) OnStreamIsRecorded

func (f StreamIsRecordedHandlerFunc) OnStreamIsRecorded(ctx context.Context, streamIsRecorded StreamIsRecorded) ConnError

type UserControlEventHandler

type UserControlEventHandler struct {
	StreamBeginHandlers      []StreamBeginHandler
	StreamEOFHandlers        []StreamEOFHandler
	StreamDryHandlers        []StreamDryHandler
	SetBufferLengthHandlers  []SetBufferLengthHandler
	StreamIsRecordedHandlers []StreamIsRecordedHandler
	PingRequestHandlers      []PingRequestHandler
	PingResponseHandlers     []PingResponseHandler
}

func (*UserControlEventHandler) OnPingRequest

func (h *UserControlEventHandler) OnPingRequest(ctx context.Context, pingRequest PingRequest) ConnError

func (*UserControlEventHandler) OnPingResponse

func (h *UserControlEventHandler) OnPingResponse(ctx context.Context, pingResponse PingResponse) ConnError

func (*UserControlEventHandler) OnSetBufferLength

func (h *UserControlEventHandler) OnSetBufferLength(ctx context.Context, setBufferLength SetBufferLength) ConnError

func (*UserControlEventHandler) OnStreamBegin

func (h *UserControlEventHandler) OnStreamBegin(ctx context.Context, streamBegin StreamBegin) ConnError

func (*UserControlEventHandler) OnStreamDry

func (h *UserControlEventHandler) OnStreamDry(ctx context.Context, streamDry StreamDry) ConnError

func (*UserControlEventHandler) OnStreamEOF

func (h *UserControlEventHandler) OnStreamEOF(ctx context.Context, streamEOF StreamEOF) ConnError

func (*UserControlEventHandler) OnStreamIsRecorded

func (h *UserControlEventHandler) OnStreamIsRecorded(ctx context.Context, streamIsRecorded StreamIsRecorded) ConnError

type UserControlMessage

type UserControlMessage interface {
	encoding.BinaryMarshaler
	zapcore.ObjectMarshaler
	EventType() EventType
}

type UserController

type UserController interface {
	StreamBegin(ctx context.Context, streamID uint32) error
	StreamEOF(ctx context.Context, streamID uint32) error
	StreamDry(ctx context.Context, streamID uint32) error
	SetBufferLength(ctx context.Context, streamID uint32, bufferLength uint32) error
	StreamIsRecorded(ctx context.Context, streamID uint32) error
	PingRequest(ctx context.Context, timestamp uint32) error
	PingResponse(ctx context.Context, timestamp uint32) error
}

type VideoCodecFlag

type VideoCodecFlag uint32
const (
	VideoCodecFlagUnused    VideoCodecFlag = 1
	VideoCodecFlagJpeg      VideoCodecFlag = 2
	VideoCodecFlagSorenson  VideoCodecFlag = 4
	VideoCodecFlagHomebrew  VideoCodecFlag = 8
	VideoCodecFlagVp6       VideoCodecFlag = 16
	VideoCodecFlagVp6alpha  VideoCodecFlag = 32
	VideoCodecFlagHomebrewv VideoCodecFlag = 64
	VideoCodecFlagH264      VideoCodecFlag = 128
	VideoCodecFlagAll       VideoCodecFlag = 255
)

func (VideoCodecFlag) String

func (i VideoCodecFlag) String() string

type VideoFunctionFlag

type VideoFunctionFlag uint8
const (
	VideoFunctionFlagClientSeek VideoFunctionFlag = 1
)

func (VideoFunctionFlag) String

func (i VideoFunctionFlag) String() string

type WindowAcknowledgementSize

type WindowAcknowledgementSize interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	zapcore.ObjectMarshaler
	AcknowledgementWindowSize() uint32
}

func NewWindowAcknowledgementSize

func NewWindowAcknowledgementSize(
	acknowledgementWindowSize uint32,
) WindowAcknowledgementSize

func ReadWindowAcknowledgementSize

func ReadWindowAcknowledgementSize(r io.Reader) (WindowAcknowledgementSize, error)

func UnmarshalWindowAcknowledgementSizeBinary

func UnmarshalWindowAcknowledgementSizeBinary(b []byte) (WindowAcknowledgementSize, error)

type WindowAcknowledgementSizeHandler

type WindowAcknowledgementSizeHandler interface {
	OnWindowAcknowledgementSize(ctx context.Context, windowAcknowledgementSize WindowAcknowledgementSize) ConnError
}

type WindowAcknowledgementSizeHandlerFunc

type WindowAcknowledgementSizeHandlerFunc func(ctx context.Context, windowAcknowledgementSize WindowAcknowledgementSize) ConnError

func (WindowAcknowledgementSizeHandlerFunc) OnWindowAcknowledgementSize

func (f WindowAcknowledgementSizeHandlerFunc) OnWindowAcknowledgementSize(ctx context.Context, windowAcknowledgementSize WindowAcknowledgementSize) ConnError

type Writer

type Writer interface {
	io.Writer
	Flush() error
	WriteMessage(message Message) (n int, err error)
	SetChunkSize(chunkSize uint32)
}

func NewDefaultWriter

func NewDefaultWriter(conn Conn, w io.Writer) Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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