Documentation
¶
Overview ¶
Package gortmplib is a RTMP library for the Go programming language.
Examples are available at https://github.com/codekami45/gortmplib/tree/main/examples
Index ¶
- type Client
- type Conn
- type OnDataAC3Func
- type OnDataAV1Func
- type OnDataG711Func
- type OnDataH26xFunc
- type OnDataLPCMFunc
- type OnDataMPEG1AudioFunc
- type OnDataMPEG4AudioFunc
- type OnDataOpusFunc
- type OnDataVP9Func
- type Reader
- func (r *Reader) Initialize() error
- func (r *Reader) OnDataAC3(track *format.AC3, cb OnDataAC3Func)
- func (r *Reader) OnDataAV1(track *format.AV1, cb OnDataAV1Func)
- func (r *Reader) OnDataG711(track *format.G711, cb OnDataG711Func)
- func (r *Reader) OnDataH264(track *format.H264, cb OnDataH26xFunc)
- func (r *Reader) OnDataH265(track *format.H265, cb OnDataH26xFunc)
- func (r *Reader) OnDataLPCM(track *format.LPCM, cb OnDataLPCMFunc)
- func (r *Reader) OnDataMPEG1Audio(track *format.MPEG1Audio, cb OnDataMPEG1AudioFunc)
- func (r *Reader) OnDataMPEG4Audio(track *format.MPEG4Audio, cb OnDataMPEG4AudioFunc)
- func (r *Reader) OnDataOpus(track *format.Opus, cb OnDataOpusFunc)
- func (r *Reader) OnDataVP9(track *format.VP9, cb OnDataVP9Func)
- func (r *Reader) Read() error
- func (r *Reader) Tracks() []format.Format
- type ServerConn
- func (c *ServerConn) Accept() error
- func (c *ServerConn) BytesReceived() uint64
- func (c *ServerConn) BytesSent() uint64
- func (c *ServerConn) CheckCredentials(expectedUser string, expectedPass string) error
- func (c *ServerConn) Initialize() error
- func (c *ServerConn) Read() (message.Message, error)
- func (c *ServerConn) Write(msg message.Message) error
- type Writer
- func (w *Writer) Initialize() error
- func (w *Writer) WriteAC3(track *format.AC3, pts time.Duration, frame []byte) error
- func (w *Writer) WriteAV1(track *format.AV1, pts time.Duration, tu [][]byte) error
- func (w *Writer) WriteG711(track *format.G711, pts time.Duration, samples []byte) error
- func (w *Writer) WriteH264(track *format.H264, pts time.Duration, dts time.Duration, au [][]byte) error
- func (w *Writer) WriteH265(track *format.H265, pts time.Duration, dts time.Duration, au [][]byte) error
- func (w *Writer) WriteLPCM(track *format.LPCM, pts time.Duration, samples []byte) error
- func (w *Writer) WriteMPEG1Audio(track *format.MPEG1Audio, pts time.Duration, frame []byte) error
- func (w *Writer) WriteMPEG4Audio(track format.Format, pts time.Duration, au []byte) error
- func (w *Writer) WriteOpus(track *format.Opus, pts time.Duration, pkt []byte) error
- func (w *Writer) WriteVP9(track *format.VP9, pts time.Duration, frame []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
URL *url.URL
TLSConfig *tls.Config
Publish bool
// contains filtered or unexported fields
}
Client is a client-side RTMP connection.
func (*Client) BytesReceived ¶
BytesReceived returns the number of bytes received.
func (*Client) Initialize ¶
Initialize initializes Client.
type Conn ¶
type Conn interface {
BytesReceived() uint64
BytesSent() uint64
Read() (message.Message, error)
Write(msg message.Message) error
}
Conn is implemented by Client and ServerConn.
type OnDataAC3Func ¶
OnDataAC3Func is the prototype of the callback passed to OnDataAC3().
type OnDataAV1Func ¶
OnDataAV1Func is the prototype of the callback passed to OnDataAV1().
type OnDataG711Func ¶
OnDataG711Func is the prototype of the callback passed to OnDataG711().
type OnDataH26xFunc ¶
OnDataH26xFunc is the prototype of the callback passed to OnDataH26x().
type OnDataLPCMFunc ¶
OnDataLPCMFunc is the prototype of the callback passed to OnDataLPCM().
type OnDataMPEG1AudioFunc ¶
OnDataMPEG1AudioFunc is the prototype of the callback passed to OnDataMPEG1Audio().
type OnDataMPEG4AudioFunc ¶
OnDataMPEG4AudioFunc is the prototype of the callback passed to OnDataMPEG4Audio().
type OnDataOpusFunc ¶
OnDataOpusFunc is the prototype of the callback passed to OnDataOpus().
type OnDataVP9Func ¶
OnDataVP9Func is the prototype of the callback passed to OnDataVP9().
type Reader ¶
type Reader struct {
Conn Conn
// contains filtered or unexported fields
}
Reader provides functions to read incoming data.
func (*Reader) OnDataAC3 ¶
func (r *Reader) OnDataAC3(track *format.AC3, cb OnDataAC3Func)
OnDataAC3 sets a callback that is called when AC-3 data is received.
func (*Reader) OnDataAV1 ¶
func (r *Reader) OnDataAV1(track *format.AV1, cb OnDataAV1Func)
OnDataAV1 sets a callback that is called when AV1 data is received.
func (*Reader) OnDataG711 ¶
func (r *Reader) OnDataG711(track *format.G711, cb OnDataG711Func)
OnDataG711 sets a callback that is called when G711 data is received.
func (*Reader) OnDataH264 ¶
func (r *Reader) OnDataH264(track *format.H264, cb OnDataH26xFunc)
OnDataH264 sets a callback that is called when H264 data is received.
func (*Reader) OnDataH265 ¶
func (r *Reader) OnDataH265(track *format.H265, cb OnDataH26xFunc)
OnDataH265 sets a callback that is called when H265 data is received.
func (*Reader) OnDataLPCM ¶
func (r *Reader) OnDataLPCM(track *format.LPCM, cb OnDataLPCMFunc)
OnDataLPCM sets a callback that is called when LPCM data is received.
func (*Reader) OnDataMPEG1Audio ¶
func (r *Reader) OnDataMPEG1Audio(track *format.MPEG1Audio, cb OnDataMPEG1AudioFunc)
OnDataMPEG1Audio sets a callback that is called when MPEG-1 Audio data is received.
func (*Reader) OnDataMPEG4Audio ¶
func (r *Reader) OnDataMPEG4Audio(track *format.MPEG4Audio, cb OnDataMPEG4AudioFunc)
OnDataMPEG4Audio sets a callback that is called when MPEG-4 Audio data is received.
func (*Reader) OnDataOpus ¶
func (r *Reader) OnDataOpus(track *format.Opus, cb OnDataOpusFunc)
OnDataOpus sets a callback that is called when Opus data is received.
type ServerConn ¶
type ServerConn struct {
RW io.ReadWriter
FourCcList amf0.StrictArray
// filled by Accept
URL *url.URL
Publish bool
// contains filtered or unexported fields
}
ServerConn is a server-side RTMP connection.
func (*ServerConn) BytesReceived ¶
func (c *ServerConn) BytesReceived() uint64
BytesReceived returns the number of bytes received.
func (*ServerConn) BytesSent ¶
func (c *ServerConn) BytesSent() uint64
BytesSent returns the number of bytes sent.
func (*ServerConn) CheckCredentials ¶
func (c *ServerConn) CheckCredentials(expectedUser string, expectedPass string) error
CheckCredentials checks credentials.
func (*ServerConn) Initialize ¶
func (c *ServerConn) Initialize() error
Initialize initializes ServerConn.
type Writer ¶
Writer provides functions to write outgoing data.
func (*Writer) WriteH264 ¶
func (w *Writer) WriteH264(track *format.H264, pts time.Duration, dts time.Duration, au [][]byte) error
WriteH264 writes a H264 access unit.
func (*Writer) WriteH265 ¶
func (w *Writer) WriteH265(track *format.H265, pts time.Duration, dts time.Duration, au [][]byte) error
WriteH265 writes a H265 access unit.
func (*Writer) WriteMPEG1Audio ¶
WriteMPEG1Audio writes a MPEG-1 Audio frame.
func (*Writer) WriteMPEG4Audio ¶
WriteMPEG4Audio writes a MPEG-4 Audio access unit.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
client-publish-264
command
Package main contains an example.
|
Package main contains an example. |
|
client-read
command
Package main contains an example.
|
Package main contains an example. |
|
server
command
Package main contains an example.
|
Package main contains an example. |
|
pkg
|
|
|
amf0
Package amf0 contains an AMF0 decoder and encoder.
|
Package amf0 contains an AMF0 decoder and encoder. |
|
bytecounter
Package bytecounter contains a reader/writer that allows to count bytes.
|
Package bytecounter contains a reader/writer that allows to count bytes. |
|
chunk
Package chunk implements RTMP chunks.
|
Package chunk implements RTMP chunks. |
|
h264conf
Package h264conf contains a H264 configuration parser.
|
Package h264conf contains a H264 configuration parser. |
|
handshake
Package handshake contains the RTMP handshake mechanism.
|
Package handshake contains the RTMP handshake mechanism. |
|
message
Package message contains a RTMP message reader/writer.
|
Package message contains a RTMP message reader/writer. |
|
rawmessage
Package rawmessage contains a RTMP raw message reader/writer.
|
Package rawmessage contains a RTMP raw message reader/writer. |