Documentation ¶
Overview ¶
Package message contains a RTMP message reader/writer.
Index ¶
- Constants
- type Acknowledge
- type Audio
- type AudioAACType
- type AudioExChannelOrder
- type AudioExCodedFrames
- type AudioExMultichannelConfig
- type AudioExMultitrack
- type AudioExMultitrackType
- type AudioExSequenceEnd
- type AudioExSequenceStart
- type AudioExType
- type CommandAMF0
- type DataAMF0
- type FourCC
- type Message
- type OpusIDHeader
- type ReadWriter
- type Reader
- type SetChunkSize
- type SetPeerBandwidth
- type SetWindowAckSize
- type Type
- type UserControlPingRequest
- type UserControlPingResponse
- type UserControlSetBufferLength
- type UserControlStreamBegin
- type UserControlStreamDry
- type UserControlStreamEOF
- type UserControlStreamIsRecorded
- type UserControlType
- type Video
- type VideoExCodedFrames
- type VideoExFramesX
- type VideoExMetadata
- type VideoExMultitrack
- type VideoExMultitrackType
- type VideoExSequenceEnd
- type VideoExSequenceStart
- type VideoExType
- type VideoType
- type Writer
Constants ¶
const ( CodecMPEG1Audio = 2 CodecLPCM = 3 CodecPCMA = 7 CodecPCMU = 8 CodecMPEG4Audio = 10 )
audio codecs
const ( Rate5512 = 0 Rate11025 = 1 Rate22050 = 2 Rate44100 = 3 )
audio rates
const ( Depth8 = 0 Depth16 = 1 )
audio depths
const (
// AudioChunkStreamID is the chunk stream ID that is usually used to send Audio{}
AudioChunkStreamID = 4
)
const (
CodecH264 = 7
)
supported video codecs
const (
// ControlChunkStreamID is the stream ID used for control messages.
ControlChunkStreamID = 2
)
const (
// VideoChunkStreamID is the chunk stream ID that is usually used to send Video{}
VideoChunkStreamID = 6
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acknowledge ¶
type Acknowledge struct {
Value uint32
}
Acknowledge is an acknowledgement message.
type Audio ¶
type Audio struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 Codec uint8 Rate uint8 Depth uint8 IsStereo bool AACType AudioAACType // only for CodecMPEG4Audio Payload []byte }
Audio is an audio message.
type AudioAACType ¶
type AudioAACType uint8
AudioAACType is the AAC type of a Audio.
const ( AudioAACTypeConfig AudioAACType = 0 AudioAACTypeAU AudioAACType = 1 )
AudioAACType values.
type AudioExChannelOrder ¶ added in v1.11.0
type AudioExChannelOrder uint8
AudioExChannelOrder is an audio channel order.
const ( AudioExChannelOrderUnspecified AudioExChannelOrder = 0 AudioExChannelOrderNative AudioExChannelOrder = 1 AudioExChannelOrderCustom AudioExChannelOrder = 2 )
audio channel orders.
type AudioExCodedFrames ¶ added in v1.11.0
type AudioExCodedFrames struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 FourCC FourCC Payload []byte }
AudioExCodedFrames is a CodedFrames extended message.
type AudioExMultichannelConfig ¶ added in v1.11.0
type AudioExMultichannelConfig struct { ChunkStreamID byte MessageStreamID uint32 FourCC FourCC AudioChannelOrder AudioExChannelOrder ChannelCount uint8 AudioChannelMapping uint8 // if AudioChannelOrder == AudioExChannelOrderCustom AudioChannelFlags uint32 // if AudioChannelOrder == AudioExChannelOrderNative }
AudioExMultichannelConfig is a multichannel config extended message.
type AudioExMultitrack ¶ added in v1.11.0
type AudioExMultitrack struct { MultitrackType AudioExMultitrackType TrackID uint8 Wrapped Message }
AudioExMultitrack is a multitrack extended message.
type AudioExMultitrackType ¶ added in v1.11.0
type AudioExMultitrackType uint8
AudioExMultitrackType is a multitrack type.
const ( AudioExMultitrackTypeOneTrack AudioExMultitrackType = 0 AudioExMultitrackTypeManyTracks AudioExMultitrackType = 1 AudioExMultitrackTypeManyTracksManyCodecs AudioExMultitrackType = 2 )
multitrack types.
type AudioExSequenceEnd ¶ added in v1.11.0
AudioExSequenceEnd is a sequence end extended message.
type AudioExSequenceStart ¶ added in v1.11.0
type AudioExSequenceStart struct { ChunkStreamID byte MessageStreamID uint32 FourCC FourCC OpusHeader *OpusIDHeader AACHeader *mpeg4audio.AudioSpecificConfig }
AudioExSequenceStart is a sequence start extended message.
type AudioExType ¶ added in v1.11.0
type AudioExType uint8
AudioExType is an audio message extended type.
const ( AudioExTypeSequenceStart AudioExType = 0 AudioExTypeCodedFrames AudioExType = 1 AudioExTypeSequenceEnd AudioExType = 2 AudioExTypeMultichannelConfig AudioExType = 4 AudioExTypeMultitrack AudioExType = 5 )
audio message extended types.
type CommandAMF0 ¶
type CommandAMF0 struct { ChunkStreamID byte MessageStreamID uint32 Name string CommandID int Arguments amf0.Data }
CommandAMF0 is a AMF0 command message.
type FourCC ¶
type FourCC uint32
FourCC is an identifier of a Extended-RTMP codec.
var ( // video FourCCAV1 FourCC = 'a'<<24 | 'v'<<16 | '0'<<8 | '1' FourCCVP9 FourCC = 'v'<<24 | 'p'<<16 | '0'<<8 | '9' FourCCHEVC FourCC = 'h'<<24 | 'v'<<16 | 'c'<<8 | '1' FourCCAVC FourCC = 'a'<<24 | 'v'<<16 | 'c'<<8 | '1' // audio FourCCOpus FourCC = 'O'<<24 | 'p'<<16 | 'u'<<8 | 's' FourCCAC3 FourCC = 'a'<<24 | 'c'<<16 | '-'<<8 | '3' FourCCMP4A FourCC = 'm'<<24 | 'p'<<16 | '4'<<8 | 'a' FourCCMP3 FourCC = '.'<<24 | 'm'<<16 | 'p'<<8 | '3' )
codec identifiers.
type Message ¶
type Message interface {
// contains filtered or unexported methods
}
Message is a message.
type OpusIDHeader ¶ added in v1.11.0
type OpusIDHeader struct { Version uint8 ChannelCount uint8 PreSkip uint16 InputSampleRate uint32 OutputGain uint16 ChannelMappingFamily uint8 ChannelMappingTable []uint8 }
OpusIDHeader is an Opus identification header. Specification: https://datatracker.ietf.org/doc/html/rfc7845#section-5.1
type ReadWriter ¶
type ReadWriter struct {
// contains filtered or unexported fields
}
ReadWriter is a message reader/writer.
func NewReadWriter ¶
func NewReadWriter( rw io.ReadWriter, bcrw *bytecounter.ReadWriter, checkAcknowledge bool, ) *ReadWriter
NewReadWriter allocates a ReadWriter.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a message reader.
type SetChunkSize ¶
type SetChunkSize struct {
Value uint32
}
SetChunkSize is a set chunk size message.
type SetPeerBandwidth ¶
SetPeerBandwidth is a set peer bandwidth message.
type SetWindowAckSize ¶
type SetWindowAckSize struct {
Value uint32
}
SetWindowAckSize is a set window acknowledgement message.
type Type ¶
type Type byte
Type is a message type.
const ( TypeSetChunkSize Type = 1 TypeAbortMessage Type = 2 TypeAcknowledge Type = 3 TypeUserControl Type = 4 TypeSetWindowAckSize Type = 5 TypeSetPeerBandwidth Type = 6 TypeAudio Type = 8 TypeVideo Type = 9 TypeDataAMF3 Type = 15 TypeDataAMF0 Type = 18 TypeCommandAMF3 Type = 17 TypeCommandAMF0 Type = 20 )
message types.
type UserControlPingRequest ¶
type UserControlPingRequest struct {
ServerTime uint32
}
UserControlPingRequest is a user control message.
type UserControlPingResponse ¶
type UserControlPingResponse struct {
ServerTime uint32
}
UserControlPingResponse is a user control message.
type UserControlSetBufferLength ¶
UserControlSetBufferLength is a user control message.
type UserControlStreamBegin ¶
type UserControlStreamBegin struct {
StreamID uint32
}
UserControlStreamBegin is a user control message.
type UserControlStreamDry ¶
type UserControlStreamDry struct {
StreamID uint32
}
UserControlStreamDry is a user control message.
type UserControlStreamEOF ¶
type UserControlStreamEOF struct {
StreamID uint32
}
UserControlStreamEOF is a user control message.
type UserControlStreamIsRecorded ¶
type UserControlStreamIsRecorded struct {
StreamID uint32
}
UserControlStreamIsRecorded is a user control message.
type UserControlType ¶
type UserControlType uint16
UserControlType is a user control type.
const ( UserControlTypeStreamBegin UserControlType = 0 UserControlTypeStreamEOF UserControlType = 1 UserControlTypeStreamDry UserControlType = 2 UserControlTypeSetBufferLength UserControlType = 3 UserControlTypeStreamIsRecorded UserControlType = 4 UserControlTypePingRequest UserControlType = 6 UserControlTypePingResponse UserControlType = 7 )
user control types.
type Video ¶
type Video struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 Codec uint8 IsKeyFrame bool Type VideoType PTSDelta time.Duration Payload []byte }
Video is a video message.
type VideoExCodedFrames ¶ added in v1.11.0
type VideoExCodedFrames struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 FourCC FourCC PTSDelta time.Duration Payload []byte }
VideoExCodedFrames is a CodedFrames extended message.
type VideoExFramesX ¶ added in v1.11.0
type VideoExFramesX struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 FourCC FourCC Payload []byte }
VideoExFramesX is a FramesX extended message.
type VideoExMetadata ¶ added in v1.11.0
type VideoExMetadata struct { ChunkStreamID byte DTS time.Duration MessageStreamID uint32 FourCC FourCC Payload amf0.Data }
VideoExMetadata is a metadata extended message.
type VideoExMultitrack ¶ added in v1.11.0
type VideoExMultitrack struct { MultitrackType VideoExMultitrackType TrackID uint8 Wrapped Message }
VideoExMultitrack is a multitrack extended message.
type VideoExMultitrackType ¶ added in v1.11.0
type VideoExMultitrackType uint8
VideoExMultitrackType is a multitrack type.
const ( VideoExMultitrackTypeOneTrack VideoExMultitrackType = 0 VideoExMultitrackTypeManyTracks VideoExMultitrackType = 1 VideoExMultitrackTypeManyTracksManyCodecs VideoExMultitrackType = 2 )
multitrack types.
type VideoExSequenceEnd ¶ added in v1.11.0
VideoExSequenceEnd is a sequence end extended message.
type VideoExSequenceStart ¶ added in v1.11.0
type VideoExSequenceStart struct { ChunkStreamID byte MessageStreamID uint32 FourCC FourCC AV1Header *mp4.Av1C VP9Header *mp4.VpcC HEVCHeader *mp4.HvcC AVCHeader *mp4.AVCDecoderConfiguration }
VideoExSequenceStart is a sequence start extended message.
type VideoExType ¶ added in v1.11.0
type VideoExType uint8
VideoExType is a video message extended type.
const ( VideoExTypeSequenceStart VideoExType = 0 VideoExTypeCodedFrames VideoExType = 1 VideoExTypeSequenceEnd VideoExType = 2 VideoExTypeFramesX VideoExType = 3 VideoExTypeMetadata VideoExType = 4 VideoExTypeMPEG2TSSequenceStart VideoExType = 5 VideoExTypeMultitrack VideoExType = 6 )
video message extended types.
Source Files ¶
- message.go
- msg_acknowledge.go
- msg_audio.go
- msg_audio_ex_coded_frames.go
- msg_audio_ex_multichannel_config.go
- msg_audio_ex_multitrack.go
- msg_audio_ex_sequence_end.go
- msg_audio_ex_sequence_start.go
- msg_command_amf0.go
- msg_data_amf0.go
- msg_set_chunk_size.go
- msg_set_peer_bandwidth.go
- msg_set_window_ack_size.go
- msg_user_control_ping_request.go
- msg_user_control_ping_response.go
- msg_user_control_set_buffer_length.go
- msg_user_control_stream_begin.go
- msg_user_control_stream_dry.go
- msg_user_control_stream_eof.go
- msg_user_control_stream_is_recorded.go
- msg_video.go
- msg_video_ex_coded_frames.go
- msg_video_ex_frames_x.go
- msg_video_ex_metadata.go
- msg_video_ex_multitrack.go
- msg_video_ex_sequence_end.go
- msg_video_ex_sequence_start.go
- opus_id_header.go
- reader.go
- readwriter.go
- writer.go