message

package
v0.0.0-...-7a1402c Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package message contains a RTMP message reader/writer.

Index

Constants

View Source
const (
	UserControlTypeStreamBegin      = 0
	UserControlTypeStreamEOF        = 1
	UserControlTypeStreamDry        = 2
	UserControlTypeSetBufferLength  = 3
	UserControlTypeStreamIsRecorded = 4
	UserControlTypePingRequest      = 6
	UserControlTypePingResponse     = 7
)

user control types.

View Source
const (
	// ControlChunkStreamID is the stream ID used for control messages.
	ControlChunkStreamID = 2
)
View Source
const (
	// MsgAudioChunkStreamID is the chunk stream ID that is usually used to send MsgAudio{}
	MsgAudioChunkStreamID = 6
)
View Source
const (
	// MsgVideoChunkStreamID is the chunk stream ID that is usually used to send MsgVideo{}
	MsgVideoChunkStreamID = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	Unmarshal(*rawmessage.Message) error
	Marshal() (*rawmessage.Message, error)
}

Message is a message.

type MsgAcknowledge

type MsgAcknowledge struct {
	Value uint32
}

MsgAcknowledge is an acknowledgement message.

func (*MsgAcknowledge) Marshal

func (m *MsgAcknowledge) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgAcknowledge) Unmarshal

func (m *MsgAcknowledge) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgAudio

type MsgAudio struct {
	ChunkStreamID   byte
	DTS             time.Duration
	MessageStreamID uint32
	Rate            uint8
	Depth           uint8
	Channels        uint8
	AACType         uint8
	Payload         []byte
}

MsgAudio is an audio message.

func (MsgAudio) Marshal

func (m MsgAudio) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgAudio) Unmarshal

func (m *MsgAudio) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgCommandAMF0

type MsgCommandAMF0 struct {
	ChunkStreamID   byte
	MessageStreamID uint32
	Name            string
	CommandID       int
	Arguments       []interface{}
}

MsgCommandAMF0 is a AMF0 command message.

func (MsgCommandAMF0) Marshal

func (m MsgCommandAMF0) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgCommandAMF0) Unmarshal

func (m *MsgCommandAMF0) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgDataAMF0

type MsgDataAMF0 struct {
	ChunkStreamID   byte
	MessageStreamID uint32
	Payload         []interface{}
}

MsgDataAMF0 is a AMF0 data message.

func (MsgDataAMF0) Marshal

func (m MsgDataAMF0) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgDataAMF0) Unmarshal

func (m *MsgDataAMF0) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgSetChunkSize

type MsgSetChunkSize struct {
	Value uint32
}

MsgSetChunkSize is a set chunk size message.

func (*MsgSetChunkSize) Marshal

func (m *MsgSetChunkSize) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgSetChunkSize) Unmarshal

func (m *MsgSetChunkSize) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgSetPeerBandwidth

type MsgSetPeerBandwidth struct {
	Value uint32
	Type  byte
}

MsgSetPeerBandwidth is a set peer bandwidth message.

func (*MsgSetPeerBandwidth) Marshal

func (m *MsgSetPeerBandwidth) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgSetPeerBandwidth) Unmarshal

func (m *MsgSetPeerBandwidth) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgSetWindowAckSize

type MsgSetWindowAckSize struct {
	Value uint32
}

MsgSetWindowAckSize is a set window acknowledgement message.

func (*MsgSetWindowAckSize) Marshal

func (m *MsgSetWindowAckSize) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgSetWindowAckSize) Unmarshal

func (m *MsgSetWindowAckSize) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgUserControlPingRequest

type MsgUserControlPingRequest struct {
	ServerTime uint32
}

MsgUserControlPingRequest is a user control message.

func (MsgUserControlPingRequest) Marshal

Marshal implements Message.

func (*MsgUserControlPingRequest) Unmarshal

Unmarshal implements Message.

type MsgUserControlPingResponse

type MsgUserControlPingResponse struct {
	ServerTime uint32
}

MsgUserControlPingResponse is a user control message.

func (MsgUserControlPingResponse) Marshal

Marshal implements Message.

func (*MsgUserControlPingResponse) Unmarshal

Unmarshal implements Message.

type MsgUserControlSetBufferLength

type MsgUserControlSetBufferLength struct {
	StreamID     uint32
	BufferLength uint32
}

MsgUserControlSetBufferLength is a user control message.

func (MsgUserControlSetBufferLength) Marshal

Marshal implements Message.

func (*MsgUserControlSetBufferLength) Unmarshal

Unmarshal implements Message.

type MsgUserControlStreamBegin

type MsgUserControlStreamBegin struct {
	StreamID uint32
}

MsgUserControlStreamBegin is a user control message.

func (MsgUserControlStreamBegin) Marshal

Marshal implements Message.

func (*MsgUserControlStreamBegin) Unmarshal

Unmarshal implements Message.

type MsgUserControlStreamDry

type MsgUserControlStreamDry struct {
	StreamID uint32
}

MsgUserControlStreamDry is a user control message.

func (MsgUserControlStreamDry) Marshal

Marshal implements Message.

func (*MsgUserControlStreamDry) Unmarshal

func (m *MsgUserControlStreamDry) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgUserControlStreamEOF

type MsgUserControlStreamEOF struct {
	StreamID uint32
}

MsgUserControlStreamEOF is a user control message.

func (MsgUserControlStreamEOF) Marshal

Marshal implements Message.

func (*MsgUserControlStreamEOF) Unmarshal

func (m *MsgUserControlStreamEOF) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type MsgUserControlStreamIsRecorded

type MsgUserControlStreamIsRecorded struct {
	StreamID uint32
}

MsgUserControlStreamIsRecorded is a user control message.

func (MsgUserControlStreamIsRecorded) Marshal

Marshal implements Message.

func (*MsgUserControlStreamIsRecorded) Unmarshal

Unmarshal implements Message.

type MsgVideo

type MsgVideo struct {
	ChunkStreamID   byte
	DTS             time.Duration
	MessageStreamID uint32
	IsKeyFrame      bool
	H264Type        uint8
	PTSDelta        time.Duration
	Payload         []byte
}

MsgVideo is a video message.

func (MsgVideo) Marshal

func (m MsgVideo) Marshal() (*rawmessage.Message, error)

Marshal implements Message.

func (*MsgVideo) Unmarshal

func (m *MsgVideo) Unmarshal(raw *rawmessage.Message) error

Unmarshal implements Message.

type ReadWriter

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

ReadWriter is a message reader/writer.

func NewReadWriter

func NewReadWriter(bc *bytecounter.ReadWriter, checkAcknowledge bool) *ReadWriter

NewReadWriter allocates a ReadWriter.

func (*ReadWriter) Read

func (rw *ReadWriter) Read() (Message, error)

Read reads a message.

func (*ReadWriter) Write

func (rw *ReadWriter) Write(msg Message) error

Write writes a message.

type Reader

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

Reader is a message reader.

func NewReader

func NewReader(r *bytecounter.Reader, onAckNeeded func(uint32) error) *Reader

NewReader allocates a Reader.

func (*Reader) Read

func (r *Reader) Read() (Message, error)

Read reads a Message.

type Writer

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

Writer is a message writer.

func NewWriter

func NewWriter(w *bytecounter.Writer, checkAcknowledge bool) *Writer

NewWriter allocates a Writer.

func (*Writer) SetAcknowledgeValue

func (w *Writer) SetAcknowledgeValue(v uint32)

SetAcknowledgeValue sets the value of the last received acknowledge.

func (*Writer) Write

func (w *Writer) Write(msg Message) error

Write writes a message.

Jump to

Keyboard shortcuts

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