Documentation
¶
Overview ¶
Package gortmplib is a RTMP library for the Go programming language.
Examples are available at https://github.com/bluenviron/gortmplib/tree/main/examples
Index ¶
- type Client
- type Conn
- type OnDataAC3Func
- type OnDataAV1Func
- type OnDataFLACFunc
- 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 *Track, cb OnDataAC3Func)
- func (r *Reader) OnDataAV1(track *Track, cb OnDataAV1Func)
- func (r *Reader) OnDataFLAC(track *Track, cb OnDataFLACFunc)
- func (r *Reader) OnDataG711(track *Track, cb OnDataG711Func)
- func (r *Reader) OnDataH264(track *Track, cb OnDataH26xFunc)
- func (r *Reader) OnDataH265(track *Track, cb OnDataH26xFunc)
- func (r *Reader) OnDataLPCM(track *Track, cb OnDataLPCMFunc)
- func (r *Reader) OnDataMPEG1Audio(track *Track, cb OnDataMPEG1AudioFunc)
- func (r *Reader) OnDataMPEG4Audio(track *Track, cb OnDataMPEG4AudioFunc)
- func (r *Reader) OnDataOpus(track *Track, cb OnDataOpusFunc)
- func (r *Reader) OnDataVP9(track *Track, cb OnDataVP9Func)
- func (r *Reader) Read() error
- func (r *Reader) Tracks() []*Track
- 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 Track
- type Writer
- func (w *Writer) Initialize() error
- func (w *Writer) WriteAC3(track *Track, pts time.Duration, frame []byte) error
- func (w *Writer) WriteAV1(track *Track, pts time.Duration, tu [][]byte) error
- func (w *Writer) WriteFLAC(track *Track, pts time.Duration, frame []byte) error
- func (w *Writer) WriteG711(track *Track, pts time.Duration, samples []byte) error
- func (w *Writer) WriteH264(track *Track, pts time.Duration, dts time.Duration, au [][]byte) error
- func (w *Writer) WriteH265(track *Track, pts time.Duration, dts time.Duration, au [][]byte) error
- func (w *Writer) WriteLPCM(track *Track, pts time.Duration, samples []byte) error
- func (w *Writer) WriteMPEG1Audio(track *Track, pts time.Duration, frame []byte) error
- func (w *Writer) WriteMPEG4Audio(track *Track, pts time.Duration, au []byte) error
- func (w *Writer) WriteOpus(track *Track, pts time.Duration, pkt []byte) error
- func (w *Writer) WriteVP9(track *Track, 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 {
//
// Target
//
// URL of the RTMP server to connect to.
URL *url.URL
// Whether to publish or play.
Publish bool
//
// RTMP parameters (all optional)
//
// a TLS configuration to connect to RTMPS servers.
// It defaults to nil.
TLSConfig *tls.Config
//
// system functions (all optional)
//
// function used to initialize the TCP client.
// It defaults to (&net.Dialer{}).DialContext.
DialContext func(ctx context.Context, network, address string) (net.Conn, error)
// function used to initialize a TLS connection.
// When nil, DialContext and tls.Client are used in its place.
// It defaults to nil.
DialTLSContext func(ctx context.Context, network string, addr string) (net.Conn, error)
// 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 OnDataFLACFunc ¶ added in v0.4.0
OnDataFLACFunc is the prototype of the callback passed to OnDataFLAC().
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 *Track, cb OnDataAC3Func)
OnDataAC3 sets a callback that is called when AC-3 data is received.
func (*Reader) OnDataAV1 ¶
func (r *Reader) OnDataAV1(track *Track, cb OnDataAV1Func)
OnDataAV1 sets a callback that is called when AV1 data is received.
func (*Reader) OnDataFLAC ¶ added in v0.4.0
func (r *Reader) OnDataFLAC(track *Track, cb OnDataFLACFunc)
OnDataFLAC sets a callback that is called when FLAC data is received.
func (*Reader) OnDataG711 ¶
func (r *Reader) OnDataG711(track *Track, cb OnDataG711Func)
OnDataG711 sets a callback that is called when G711 data is received.
func (*Reader) OnDataH264 ¶
func (r *Reader) OnDataH264(track *Track, cb OnDataH26xFunc)
OnDataH264 sets a callback that is called when H264 data is received.
func (*Reader) OnDataH265 ¶
func (r *Reader) OnDataH265(track *Track, cb OnDataH26xFunc)
OnDataH265 sets a callback that is called when H265 data is received.
func (*Reader) OnDataLPCM ¶
func (r *Reader) OnDataLPCM(track *Track, cb OnDataLPCMFunc)
OnDataLPCM sets a callback that is called when LPCM data is received.
func (*Reader) OnDataMPEG1Audio ¶
func (r *Reader) OnDataMPEG1Audio(track *Track, cb OnDataMPEG1AudioFunc)
OnDataMPEG1Audio sets a callback that is called when MPEG-1 Audio data is received.
func (*Reader) OnDataMPEG4Audio ¶
func (r *Reader) OnDataMPEG4Audio(track *Track, cb OnDataMPEG4AudioFunc)
OnDataMPEG4Audio sets a callback that is called when MPEG-4 Audio data is received.
func (*Reader) OnDataOpus ¶
func (r *Reader) OnDataOpus(track *Track, cb OnDataOpusFunc)
OnDataOpus sets a callback that is called when Opus data is received.
func (*Reader) OnDataVP9 ¶
func (r *Reader) OnDataVP9(track *Track, cb OnDataVP9Func)
OnDataVP9 sets a callback that is called when VP9 data is received.
type ServerConn ¶
type ServerConn struct {
RW io.ReadWriter
FourCcList amf0.StrictArray
FlashVer string
// 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) 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-h264
command
Package main contains an example.
|
Package main contains an example. |
|
client-publish-mpeg4audio
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. |
|
codecs
Package codecs contains codec definitions.
|
Package codecs contains codec definitions. |
|
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. |