Documentation ¶
Index ¶
- Constants
- Variables
- func WithAudioMuxer(muxer flv.AVTagMuxer) func(*RtmpClient)
- func WithChunkSize(chunkSize uint32) func(*RtmpClient)
- func WithComplexHandshake() func(*RtmpClient)
- func WithComplexHandshakeSchema(schema int) func(*RtmpClient)
- func WithEnablePublish() func(*RtmpClient)
- func WithWndAckSize(ackSize uint32) func(*RtmpClient)
- type AMF0_DATA_TYPE
- type HandShakeState
- type MessageType
- type NetStreamStatusCode
- type OnError
- type OnFrame
- type OnPlay
- type OnPublish
- type OnReleaseStream
- type OnStateChange
- type OnStatus
- type OutputCB
- type ParserState
- type RtmpClient
- func (cli *RtmpClient) GetState() RtmpState
- func (cli *RtmpClient) Input(data []byte) error
- func (cli *RtmpClient) OnError(onerror OnError)
- func (cli *RtmpClient) OnFrame(onframe OnFrame)
- func (cli *RtmpClient) OnStateChange(stateChange OnStateChange)
- func (cli *RtmpClient) OnStatus(onstatus OnStatus)
- func (cli *RtmpClient) SetOutput(output OutputCB)
- func (cli *RtmpClient) Start(url string)
- func (cli *RtmpClient) WriteAudio(cid codec.CodecID, frame []byte, pts, dts uint32) error
- func (cli *RtmpClient) WriteFrame(cid codec.CodecID, frame []byte, pts, dts uint32) error
- func (cli *RtmpClient) WriteVideo(cid codec.CodecID, frame []byte, pts, dts uint32) error
- type RtmpConnectCmd
- type RtmpParserState
- type RtmpServerHandle
- func (server *RtmpServerHandle) GetApp() string
- func (server *RtmpServerHandle) GetState() RtmpState
- func (server *RtmpServerHandle) GetStreamName() string
- func (server *RtmpServerHandle) Input(data []byte) error
- func (server *RtmpServerHandle) OnFrame(onframe OnFrame)
- func (server *RtmpServerHandle) OnPlay(onPlay OnPlay)
- func (server *RtmpServerHandle) OnPublish(onPub OnPublish)
- func (server *RtmpServerHandle) OnRelease(onRelease OnReleaseStream)
- func (server *RtmpServerHandle) OnStateChange(stateChange OnStateChange)
- func (server *RtmpServerHandle) SetOutput(output OutputCB)
- func (server *RtmpServerHandle) WriteAudio(cid codec.CodecID, frame []byte, pts, dts uint32) error
- func (server *RtmpServerHandle) WriteFrame(cid codec.CodecID, frame []byte, pts, dts uint32) error
- func (server *RtmpServerHandle) WriteVideo(cid codec.CodecID, frame []byte, pts, dts uint32) error
- type RtmpState
- type StatusCode
- type StatusLevel
- type UserEvent
Constants ¶
View Source
const ( CHUNK_CHANNEL_USE_CTRL = 2 CHUNK_CHANNEL_CMD = 3 CHUNK_CHANNEL_VIDEO = 5 CHUNK_CHANNEL_AUDIO = 6 CHUNK_CHANNEL_META = 7 CHUNK_CHANNEL_NET_STREAM = 8 )
View Source
const ( FIX_CHUNK_SIZE = 128 DEFAULT_CHUNK_SIZE = 60000 DEFAULT_ACK_SIZE = 5000000 )
View Source
const ( HANDSHAKE_SIZE = 1536 HANDSHAKE_FIX_SIZE = 8 HANDSHAKE_OFFSET_SIZE = 4 HANDSHAKE_DIGEST_SIZE = 32 HANDSHAKE_SCHEMA_SIZE = 764 HANDSHAKE_SCHEMA0_OFFSET = 776 // 8 + 764 + 4 HANDSHAKE_SCHEMA1_OFFSET = 12 // 8 + 4 )
View Source
const ( HANDSHAKE_COMPLEX_SCHEMA0 = 0 HANDSHAKE_COMPLEX_SCHEMA1 = 1 )
View Source
const ( PUBLISHING_LIVE = "live" PUBLISHING_RECORD = "record" PUBLISHING_APPEND = "append" )
View Source
const ( LimitType_HARD = 0 LimitType_SOFT = 1 LimitType_DYNAMIC = 2 )
View Source
const ( StreamBegin = 0 StreamEOF = 1 StreamDry = 2 SetBufferLength = 3 StreamIsRecorded = 4 PingRequest = 6 PingResponse = 7 )
Variables ¶
View Source
var ChunkType [4]byte = [4]byte{11, 7, 3, 0}
View Source
var EndObj []byte = []byte{0, 0, byte(AMF0_OBJECT_END)}
View Source
var NullItem []byte = []byte{byte(AMF0_NULL)}
Functions ¶
func WithAudioMuxer ¶
func WithAudioMuxer(muxer flv.AVTagMuxer) func(*RtmpClient)
func WithChunkSize ¶
func WithChunkSize(chunkSize uint32) func(*RtmpClient)
func WithComplexHandshake ¶
func WithComplexHandshake() func(*RtmpClient)
func WithComplexHandshakeSchema ¶
func WithComplexHandshakeSchema(schema int) func(*RtmpClient)
func WithEnablePublish ¶
func WithEnablePublish() func(*RtmpClient)
func WithWndAckSize ¶
func WithWndAckSize(ackSize uint32) func(*RtmpClient)
Types ¶
type AMF0_DATA_TYPE ¶
type AMF0_DATA_TYPE int
const ( AMF0_NUMBER AMF0_DATA_TYPE = iota AMF0_BOOLEAN AMF0_STRING AMF0_OBJECT AMF0_MOVIECLIP AMF0_NULL AMF0_UNDEFINED AMF0_REFERENCE AMF0_ECMA_ARRAY AMF0_OBJECT_END AMF0_STRICT_ARRAY AMF0_DATE AMF0_LONG_STRING AMF0_UNSUPPORTED AMF0_RECORDSET AMF0_XML_DOCUMENT AMF0_TYPED_OBJECT AMF0_AVMPLUS_OBJECT )
type HandShakeState ¶
type HandShakeState int
const ( CLIENT_S0 HandShakeState = iota CLIENT_S1 CLIENT_S2 SERVER_C0 HandShakeState = iota + 10 SERVER_C1 SERVER_C2 HANDSHAKE_DONE HandShakeState = iota + 100 )
type MessageType ¶
type MessageType int
const ( //Protocol control messages SET_CHUNK_SIZE MessageType = 1 ABORT_MESSAGE MessageType = 2 ACKNOWLEDGEMENT MessageType = 3 USER_CONTROL MessageType = 4 WND_ACK_SIZE MessageType = 5 SET_PEER_BW MessageType = 6 AUDIO MessageType = 8 VIDEO MessageType = 9 Command_AMF0 MessageType = 20 Command_AMF3 MessageType = 17 Metadata_AMF0 MessageType = 18 Metadata_AMF3 MessageType = 15 Aggregate MessageType = 22 )
type NetStreamStatusCode ¶
type NetStreamStatusCode string
type OnPlay ¶
type OnPlay func(app, streamName string, start, duration float64, reset bool) StatusCode
type OnPublish ¶
type OnPublish func(app, streamName string) StatusCode
type OnReleaseStream ¶
type OnReleaseStream func(app, streamName string)
type OnStateChange ¶
type OnStateChange func(newState RtmpState)
type ParserState ¶
type ParserState int
const ( S_BASIC_HEAD ParserState = iota S_MSG_HEAD S_EXTEND_TS S_PAYLOAD )
type RtmpClient ¶
type RtmpClient struct {
// contains filtered or unexported fields
}
func NewRtmpClient ¶
func NewRtmpClient(options ...func(*RtmpClient)) *RtmpClient
func (*RtmpClient) GetState ¶
func (cli *RtmpClient) GetState() RtmpState
func (*RtmpClient) Input ¶
func (cli *RtmpClient) Input(data []byte) error
func (*RtmpClient) OnError ¶
func (cli *RtmpClient) OnError(onerror OnError)
func (*RtmpClient) OnFrame ¶
func (cli *RtmpClient) OnFrame(onframe OnFrame)
func (*RtmpClient) OnStateChange ¶
func (cli *RtmpClient) OnStateChange(stateChange OnStateChange)
func (*RtmpClient) OnStatus ¶
func (cli *RtmpClient) OnStatus(onstatus OnStatus)
func (*RtmpClient) SetOutput ¶
func (cli *RtmpClient) SetOutput(output OutputCB)
func (*RtmpClient) WriteAudio ¶
func (cli *RtmpClient) WriteAudio(cid codec.CodecID, frame []byte, pts, dts uint32) error
func (*RtmpClient) WriteFrame ¶
func (cli *RtmpClient) WriteFrame(cid codec.CodecID, frame []byte, pts, dts uint32) error
func (*RtmpClient) WriteVideo ¶
func (cli *RtmpClient) WriteVideo(cid codec.CodecID, frame []byte, pts, dts uint32) error
type RtmpConnectCmd ¶
type RtmpConnectCmd int
const ( CONNECT RtmpConnectCmd = iota CLOSE CREATE_STREAM GET_STREAM_LENGTH )
type RtmpParserState ¶
type RtmpParserState int
const ( HandShake RtmpParserState = iota ReadChunk )
type RtmpServerHandle ¶
type RtmpServerHandle struct {
// contains filtered or unexported fields
}
func NewRtmpServerHandle ¶
func NewRtmpServerHandle(options ...func(*RtmpServerHandle)) *RtmpServerHandle
func (*RtmpServerHandle) GetApp ¶
func (server *RtmpServerHandle) GetApp() string
func (*RtmpServerHandle) GetState ¶
func (server *RtmpServerHandle) GetState() RtmpState
func (*RtmpServerHandle) GetStreamName ¶
func (server *RtmpServerHandle) GetStreamName() string
func (*RtmpServerHandle) Input ¶
func (server *RtmpServerHandle) Input(data []byte) error
func (*RtmpServerHandle) OnFrame ¶
func (server *RtmpServerHandle) OnFrame(onframe OnFrame)
func (*RtmpServerHandle) OnPlay ¶
func (server *RtmpServerHandle) OnPlay(onPlay OnPlay)
func (*RtmpServerHandle) OnPublish ¶
func (server *RtmpServerHandle) OnPublish(onPub OnPublish)
func (*RtmpServerHandle) OnRelease ¶
func (server *RtmpServerHandle) OnRelease(onRelease OnReleaseStream)
func (*RtmpServerHandle) OnStateChange ¶
func (server *RtmpServerHandle) OnStateChange(stateChange OnStateChange)
状态变更,回调函数, 服务端在STATE_RTMP_PLAY_START状态下,开始发流 客户端在STATE_RTMP_PUBLISH_START状态,开始推流
func (*RtmpServerHandle) SetOutput ¶
func (server *RtmpServerHandle) SetOutput(output OutputCB)
func (*RtmpServerHandle) WriteAudio ¶
func (server *RtmpServerHandle) WriteAudio(cid codec.CodecID, frame []byte, pts, dts uint32) error
func (*RtmpServerHandle) WriteFrame ¶
func (server *RtmpServerHandle) WriteFrame(cid codec.CodecID, frame []byte, pts, dts uint32) error
func (*RtmpServerHandle) WriteVideo ¶
func (server *RtmpServerHandle) WriteVideo(cid codec.CodecID, frame []byte, pts, dts uint32) error
type StatusCode ¶
type StatusCode string
const ( NETSTREAM_PUBLISH_START StatusCode = "NetStream.Publish.Start" NETSTREAM_PLAY_START StatusCode = "NetStream.Play.Start" NETSTREAM_PLAY_STOP StatusCode = "NetStream.Play.Stop" NETSTREAM_PLAY_FAILED StatusCode = "NetStream.Play.Failed" NETSTREAM_PLAY_NOTFOUND StatusCode = "NetStream.Play.StreamNotFound" NETSTREAM_PLAY_RESET StatusCode = "NetStream.Play.Reset" NETSTREAM_PAUSE_NOTIFY StatusCode = "NetStream.Pause.Notify" NETSTREAM_UNPAUSE_NOTIFY StatusCode = "NetStream.Unpause.Notify" NETSTREAM_RECORD_START StatusCode = "NetStream.Record.Start" NETSTREAM_RECORD_STOP StatusCode = "NetStream.Record.Stop" NETSTREAM_RECORD_FAILED StatusCode = "NetStream.Record.Failed" NETSTREAM_SEEK_FAILED StatusCode = "NetStream.Seek.Failed" NETSTREAM_SEEK_NOTIFY StatusCode = "NetStream.Seek.Notify" NETCONNECT_CONNECT_CLOSED StatusCode = "NetConnection.Connect.Closed" NETCONNECT_CONNECT_FAILED StatusCode = "NetConnection.Connect.Failed" NETCONNECT_CONNECT_SUCCESS StatusCode = "NetConnection.Connect.Success" NETCONNECT_CONNECT_REJECTED StatusCode = "NetConnection.Connect.Rejected" NETSTREAM_CONNECT_CLOSED StatusCode = "NetStream.Connect.Closed" NETSTREAM_CONNECT_FAILED StatusCode = "NetStream.Connect.Failed" NETSTREAM_CONNECT_SUCCESSS StatusCode = "NetStream.Connect.Success" NETSTREAM_CONNECT_REJECTED StatusCode = "NetStream.Connect.Rejected" )
func (StatusCode) Description ¶
func (c StatusCode) Description() StatusLevel
func (StatusCode) Level ¶
func (c StatusCode) Level() StatusLevel
type StatusLevel ¶
type StatusLevel string
const ( LEVEL_STATUS StatusLevel = "status" LEVEL_ERROR StatusLevel = "error" LEVEL_WARN StatusLevel = "warning" )
Click to show internal directories.
Click to hide internal directories.