gortsplib

package module
v0.0.0-...-684fe47 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 33 Imported by: 0

README

gortsplib

Test Lint Go Report Card CodeCov PkgGoDev

COPIED PROJECT FROM:

Project is copied from user https://github.com/aler9, from project https://github.com/aler9

RTSP 1.0 client and server library for the Go programming language, written for rtsp-simple-server.

Go ≥ 1.15 is required.

Features:

  • Client
    • Query servers about available streams
    • Read
      • Read streams from servers with the UDP, UDP-multicast or TCP transport protocols
      • Read streams encrypted with TLS
      • Switch protocol automatically (switch to TCP in case of server error or UDP timeout)
      • Read only selected tracks of a stream
      • Pause or seek without disconnecting from the server
      • Generate RTCP receiver reports automatically
    • Publish
      • Publish streams to servers with the UDP or TCP transport protocols
      • Publish streams encrypted with TLS
      • Switch protocol automatically (switch to TCP in case of server error)
      • Pause without disconnecting from the server
      • Generate RTCP sender reports automatically
  • Server
    • Handle requests from clients
    • Sessions and connections are independent
    • Write streams to clients with the UDP, UDP-multicast or TCP transport protocols
    • Write streams to clients encrypted with TLS
    • Read streams from clients with the UDP or TCP transport protocols
    • Write streams to clients encrypted with TLS
    • Provide SSRC, RTP-Info to clients automatically
    • Generate RTCP receiver reports automatically
  • Utilities
    • Encode and decode RTSP primitives, RTP/H264, RTP/AAC, SDP

Table of contents

Examples

API Documentation

https://pkg.go.dev/github.com/aler9/gortsplib#pkg-index

Related projects

IETF Standards

Conventions

Documentation

Overview

Package gortsplib is a RTSP 1.0 library for the Go programming language, written for rtsp-simple-server.

Examples are available at https://github.com/kuartis/gortsplib_go/tree/master/examples

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	//
	// callbacks
	//
	// called before every request.
	OnRequest func(*base.Request)
	// called after every response.
	OnResponse func(*base.Response)
	// called when a RTP packet arrives.
	OnPacketRTP func(int, *rtp.Packet)
	// called when a RTCP packet arrives.
	OnPacketRTCP func(int, uint64, uint32, rtcp.Packet)

	//
	// RTSP parameters
	//
	// timeout of read operations.
	// It defaults to 10 seconds.
	ReadTimeout time.Duration
	// timeout of write operations.
	// It defaults to 10 seconds.
	WriteTimeout time.Duration
	// a TLS configuration to connect to TLS (RTSPS) servers.
	// It defaults to nil.
	TLSConfig *tls.Config
	// disable being redirected to other servers, that can happen during Describe().
	// It defaults to false.
	RedirectDisable bool
	// enable communication with servers which don't provide server ports or use
	// different server ports than the ones announced.
	// This can be a security issue.
	// It defaults to false.
	AnyPortEnable bool
	// the stream transport (UDP, Multicast or TCP).
	// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
	// It defaults to nil.
	Transport *Transport
	// If the client is reading with UDP, it must receive
	// at least a packet within this timeout.
	// It defaults to 3 seconds.
	InitialUDPReadTimeout time.Duration
	// read buffer count.
	// If greater than 1, allows to pass buffers to routines different than the one
	// that is reading frames.
	// It defaults to 256.
	ReadBufferCount int
	// read buffer size.
	// This must be touched only when the server reports errors about buffer sizes.
	// It defaults to 2048.
	ReadBufferSize int
	// write buffer count.
	// It allows to queue packets before sending them.
	// It defaults to 8.
	WriteBufferCount int

	//
	// system functions
	//
	// 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 UDP listeners.
	// It defaults to net.ListenPacket.
	ListenPacket func(network, address string) (net.PacketConn, error)
	// contains filtered or unexported fields
}

Client is a RTSP client.

func (*Client) Announce

func (c *Client) Announce(u *base.URL, tracks Tracks) (*base.Response, error)

Announce writes an ANNOUNCE request and reads a Response.

func (*Client) Close

func (c *Client) Close() error

Close closes all client resources and waits for them to close.

func (*Client) Describe

func (c *Client) Describe(u *base.URL) (Tracks, *base.URL, *base.Response, error)

Describe writes a DESCRIBE request and reads a Response.

func (*Client) Options

func (c *Client) Options(u *base.URL) (*base.Response, error)

Options writes an OPTIONS request and reads a response.

func (*Client) Pause

func (c *Client) Pause() (*base.Response, error)

Pause writes a PAUSE request and reads a Response. This can be called only after Play() or Record().

func (*Client) Play

func (c *Client) Play(ra *headers.Range) (*base.Response, error)

Play writes a PLAY request and reads a Response. This can be called only after Setup().

func (*Client) Record

func (c *Client) Record() (*base.Response, error)

Record writes a RECORD request and reads a Response. This can be called only after Announce() and Setup().

func (*Client) Seek

func (c *Client) Seek(ra *headers.Range) (*base.Response, error)

Seek asks the server to re-start the stream from a specific timestamp.

func (*Client) Setup

func (c *Client) Setup(
	forPlay bool,
	track Track,
	baseURL *base.URL,
	rtpPort int,
	rtcpPort int) (*base.Response, error)

Setup writes a SETUP request and reads a Response. rtpPort and rtcpPort are used only if transport is UDP. if rtpPort and rtcpPort are zero, they are chosen automatically.

func (*Client) SetupAndPlay

func (c *Client) SetupAndPlay(tracks Tracks, baseURL *base.URL) error

SetupAndPlay setups and play the given tracks.

func (*Client) Start

func (c *Client) Start(scheme string, host string) error

Start initializes the connection to a server.

func (*Client) StartPublishing

func (c *Client) StartPublishing(address string, tracks Tracks) error

StartPublishing connects to the address and starts publishing the tracks.

func (*Client) StartReading

func (c *Client) StartReading(address string) error

StartReading connects to the address and starts reading all tracks.

func (*Client) StartReadingAndWait

func (c *Client) StartReadingAndWait(address string) error

StartReadingAndWait connects to the address, starts reading all tracks and waits until a read error.

func (*Client) Tracks

func (c *Client) Tracks() Tracks

Tracks returns all the tracks that the client is reading or publishing.

func (*Client) Wait

func (c *Client) Wait() error

Wait waits until all client resources are closed. This can happen when a fatal error occurs or when Close() is called.

func (*Client) WritePacketRTCP

func (c *Client) WritePacketRTCP(trackID int, pkt rtcp.Packet) error

WritePacketRTCP writes a RTCP packet.

func (*Client) WritePacketRTP

func (c *Client) WritePacketRTP(trackID int, pkt *rtp.Packet) error

WritePacketRTP writes a RTP packet.

type Server

type Server struct {
	//
	// handler
	//
	// an handler to handle server events.
	Handler ServerHandler

	//
	// RTSP parameters
	//
	// timeout of read operations.
	// It defaults to 10 seconds
	ReadTimeout time.Duration
	// timeout of write operations.
	// It defaults to 10 seconds
	WriteTimeout time.Duration
	// the RTSP address of the server, to accept connections and send and receive
	// packets with the TCP transport.
	RTSPAddress string
	// a TLS configuration to accept TLS (RTSPS) connections.
	TLSConfig *tls.Config
	// a port to send and receive RTP packets with the UDP transport.
	// If UDPRTPAddress and UDPRTCPAddress are filled, the server can support the UDP transport.
	UDPRTPAddress string
	// a port to send and receive RTCP packets with the UDP transport.
	// If UDPRTPAddress and UDPRTCPAddress are filled, the server can support the UDP transport.
	UDPRTCPAddress string
	// a range of multicast IPs to use with the UDP-multicast transport.
	// If MulticastIPRange, MulticastRTPPort, MulticastRTCPPort are filled, the server
	// can support the UDP-multicast transport.
	MulticastIPRange string
	// a port to send RTP packets with the UDP-multicast transport.
	// If MulticastIPRange, MulticastRTPPort, MulticastRTCPPort are filled, the server
	// can support the UDP-multicast transport.
	MulticastRTPPort int
	// a port to send RTCP packets with the UDP-multicast transport.
	// If MulticastIPRange, MulticastRTPPort, MulticastRTCPPort are filled, the server
	// can support the UDP-multicast transport.
	MulticastRTCPPort int
	// read buffer count.
	// If greater than 1, allows to pass buffers to routines different than the one
	// that is reading frames.
	// It also allows to buffer routed frames and mitigate network fluctuations
	// that are particularly relevant when using UDP.
	// It defaults to 256.
	ReadBufferCount int
	// read buffer size.
	// This must be touched only when the server reports errors about buffer sizes.
	// It defaults to 2048.
	ReadBufferSize int
	// write buffer count.
	// It allows to queue packets before sending them.
	// It defaults to 256.
	WriteBufferCount int

	//
	// system functions
	//
	// function used to initialize the TCP listener.
	// It defaults to net.Listen.
	Listen func(network string, address string) (net.Listener, error)
	// function used to initialize UDP listeners.
	// It defaults to net.ListenPacket.
	ListenPacket func(network, address string) (net.PacketConn, error)
	// contains filtered or unexported fields
}

Server is a RTSP server.

func (*Server) Close

func (s *Server) Close() error

Close closes all the server resources and waits for them to close.

func (*Server) Start

func (s *Server) Start() error

Start starts the server.

func (*Server) StartAndWait

func (s *Server) StartAndWait() error

StartAndWait starts the server and waits until a fatal error.

func (*Server) Wait

func (s *Server) Wait() error

Wait waits until all server resources are closed. This can happen when a fatal error occurs or when Close() is called.

type ServerConn

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

ServerConn is a server-side RTSP connection.

func (*ServerConn) Close

func (sc *ServerConn) Close() error

Close closes the ServerConn.

func (*ServerConn) NetConn

func (sc *ServerConn) NetConn() net.Conn

NetConn returns the underlying net.Conn.

type ServerHandler

type ServerHandler interface{}

ServerHandler is the interface implemented by all the server handlers.

type ServerHandlerOnAnnounce

type ServerHandlerOnAnnounce interface {
	OnAnnounce(*ServerHandlerOnAnnounceCtx) (*base.Response, error)
}

ServerHandlerOnAnnounce can be implemented by a ServerHandler.

type ServerHandlerOnAnnounceCtx

type ServerHandlerOnAnnounceCtx struct {
	Server  *Server
	Session *ServerSession
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
	Tracks  Tracks
}

ServerHandlerOnAnnounceCtx is the context of an ANNOUNCE request.

type ServerHandlerOnConnClose

type ServerHandlerOnConnClose interface {
	OnConnClose(*ServerHandlerOnConnCloseCtx)
}

ServerHandlerOnConnClose can be implemented by a ServerHandler.

type ServerHandlerOnConnCloseCtx

type ServerHandlerOnConnCloseCtx struct {
	Conn  *ServerConn
	Error error
}

ServerHandlerOnConnCloseCtx is the context of a connection closure.

type ServerHandlerOnConnOpen

type ServerHandlerOnConnOpen interface {
	OnConnOpen(*ServerHandlerOnConnOpenCtx)
}

ServerHandlerOnConnOpen can be implemented by a ServerHandler.

type ServerHandlerOnConnOpenCtx

type ServerHandlerOnConnOpenCtx struct {
	Conn *ServerConn
}

ServerHandlerOnConnOpenCtx is the context of a connection opening.

type ServerHandlerOnDescribe

type ServerHandlerOnDescribe interface {
	OnDescribe(*ServerHandlerOnDescribeCtx) (*base.Response, *ServerStream, error)
}

ServerHandlerOnDescribe can be implemented by a ServerHandler.

type ServerHandlerOnDescribeCtx

type ServerHandlerOnDescribeCtx struct {
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnDescribeCtx is the context of a DESCRIBE request.

type ServerHandlerOnGetParameter

type ServerHandlerOnGetParameter interface {
	OnGetParameter(*ServerHandlerOnGetParameterCtx) (*base.Response, error)
}

ServerHandlerOnGetParameter can be implemented by a ServerHandler.

type ServerHandlerOnGetParameterCtx

type ServerHandlerOnGetParameterCtx struct {
	Session *ServerSession
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnGetParameterCtx is the context of a GET_PARAMETER request.

type ServerHandlerOnPacketRTCP

type ServerHandlerOnPacketRTCP interface {
	OnPacketRTCP(*ServerHandlerOnPacketRTCPCtx)
}

ServerHandlerOnPacketRTCP can be implemented by a ServerHandler.

type ServerHandlerOnPacketRTCPCtx

type ServerHandlerOnPacketRTCPCtx struct {
	Session *ServerSession
	TrackID int
	Packet  rtcp.Packet
}

ServerHandlerOnPacketRTCPCtx is the context of a RTCP packet.

type ServerHandlerOnPacketRTP

type ServerHandlerOnPacketRTP interface {
	OnPacketRTP(*ServerHandlerOnPacketRTPCtx)
}

ServerHandlerOnPacketRTP can be implemented by a ServerHandler.

type ServerHandlerOnPacketRTPCtx

type ServerHandlerOnPacketRTPCtx struct {
	Session *ServerSession
	TrackID int
	Packet  *rtp.Packet
}

ServerHandlerOnPacketRTPCtx is the context of a RTP packet.

type ServerHandlerOnPause

type ServerHandlerOnPause interface {
	OnPause(*ServerHandlerOnPauseCtx) (*base.Response, error)
}

ServerHandlerOnPause can be implemented by a ServerHandler.

type ServerHandlerOnPauseCtx

type ServerHandlerOnPauseCtx struct {
	Session *ServerSession
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnPauseCtx is the context of a PAUSE request.

type ServerHandlerOnPlay

type ServerHandlerOnPlay interface {
	OnPlay(*ServerHandlerOnPlayCtx) (*base.Response, error)
}

ServerHandlerOnPlay can be implemented by a ServerHandler.

type ServerHandlerOnPlayCtx

type ServerHandlerOnPlayCtx struct {
	Session *ServerSession
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnPlayCtx is the context of a PLAY request.

type ServerHandlerOnRecord

type ServerHandlerOnRecord interface {
	OnRecord(*ServerHandlerOnRecordCtx) (*base.Response, error)
}

ServerHandlerOnRecord can be implemented by a ServerHandler.

type ServerHandlerOnRecordCtx

type ServerHandlerOnRecordCtx struct {
	Session *ServerSession
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnRecordCtx is the context of a RECORD request.

type ServerHandlerOnRequest

type ServerHandlerOnRequest interface {
	OnRequest(*ServerConn, *base.Request)
}

ServerHandlerOnRequest can be implemented by a ServerHandler.

type ServerHandlerOnResponse

type ServerHandlerOnResponse interface {
	OnResponse(*ServerConn, *base.Response)
}

ServerHandlerOnResponse can be implemented by a ServerHandler.

type ServerHandlerOnSessionClose

type ServerHandlerOnSessionClose interface {
	OnSessionClose(*ServerHandlerOnSessionCloseCtx)
}

ServerHandlerOnSessionClose can be implemented by a ServerHandler.

type ServerHandlerOnSessionCloseCtx

type ServerHandlerOnSessionCloseCtx struct {
	Session *ServerSession
	Error   error
}

ServerHandlerOnSessionCloseCtx is the context of a session closure.

type ServerHandlerOnSessionOpen

type ServerHandlerOnSessionOpen interface {
	OnSessionOpen(*ServerHandlerOnSessionOpenCtx)
}

ServerHandlerOnSessionOpen can be implemented by a ServerHandler.

type ServerHandlerOnSessionOpenCtx

type ServerHandlerOnSessionOpenCtx struct {
	Session *ServerSession
	Conn    *ServerConn
}

ServerHandlerOnSessionOpenCtx is the context of a session opening.

type ServerHandlerOnSetParameter

type ServerHandlerOnSetParameter interface {
	OnSetParameter(*ServerHandlerOnSetParameterCtx) (*base.Response, error)
}

ServerHandlerOnSetParameter can be implemented by a ServerHandler.

type ServerHandlerOnSetParameterCtx

type ServerHandlerOnSetParameterCtx struct {
	Conn    *ServerConn
	Request *base.Request
	Path    string
	Query   string
}

ServerHandlerOnSetParameterCtx is the context of a SET_PARAMETER request.

type ServerHandlerOnSetup

type ServerHandlerOnSetup interface {
	// must return a Response and a stream.
	// the stream is needed to
	// - add the session the the stream's readers
	// - send the stream SSRC to the session
	OnSetup(*ServerHandlerOnSetupCtx) (*base.Response, *ServerStream, error)
}

ServerHandlerOnSetup can be implemented by a ServerHandler.

type ServerHandlerOnSetupCtx

type ServerHandlerOnSetupCtx struct {
	Server    *Server
	Session   *ServerSession
	Conn      *ServerConn
	Request   *base.Request
	Path      string
	Query     string
	TrackID   int
	Transport Transport
}

ServerHandlerOnSetupCtx is the context of a OPTIONS request.

type ServerSession

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

ServerSession is a server-side RTSP session.

func (*ServerSession) AnnouncedTracks

func (ss *ServerSession) AnnouncedTracks() []ServerSessionAnnouncedTrack

AnnouncedTracks returns the announced tracks.

func (*ServerSession) Close

func (ss *ServerSession) Close() error

Close closes the ServerSession.

func (*ServerSession) SetuppedTracks

func (ss *ServerSession) SetuppedTracks() map[int]ServerSessionSetuppedTrack

SetuppedTracks returns the setupped tracks.

func (*ServerSession) SetuppedTransport

func (ss *ServerSession) SetuppedTransport() *Transport

SetuppedTransport returns the transport of the setupped tracks.

func (*ServerSession) State

func (ss *ServerSession) State() ServerSessionState

State returns the state of the session.

func (*ServerSession) WritePacketRTCP

func (ss *ServerSession) WritePacketRTCP(trackID int, pkt rtcp.Packet)

WritePacketRTCP writes a RTCP packet to the session.

func (*ServerSession) WritePacketRTP

func (ss *ServerSession) WritePacketRTP(trackID int, pkt *rtp.Packet)

WritePacketRTP writes a RTP packet to the session.

type ServerSessionAnnouncedTrack

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

ServerSessionAnnouncedTrack is an announced track of a ServerSession.

type ServerSessionSetuppedTrack

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

ServerSessionSetuppedTrack is a setupped track of a ServerSession.

type ServerSessionState

type ServerSessionState int

ServerSessionState is a state of a ServerSession.

const (
	ServerSessionStateInitial ServerSessionState = iota
	ServerSessionStatePrePlay
	ServerSessionStatePlay
	ServerSessionStatePreRecord
	ServerSessionStateRecord
)

standard states.

func (ServerSessionState) String

func (s ServerSessionState) String() string

String implements fmt.Stringer.

type ServerStream

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

ServerStream represents a single stream. This is in charge of - distributing the stream to each reader - allocating multicast listeners - gathering infos about the stream to generate SSRC and RTP-Info

func NewServerStream

func NewServerStream(tracks Tracks) *ServerStream

NewServerStream allocates a ServerStream.

func (*ServerStream) Close

func (st *ServerStream) Close() error

Close closes a ServerStream.

func (*ServerStream) Tracks

func (st *ServerStream) Tracks() Tracks

Tracks returns the tracks of the stream.

func (*ServerStream) WritePacketRTCP

func (st *ServerStream) WritePacketRTCP(trackID int, pkt rtcp.Packet)

WritePacketRTCP writes a RTCP packet to all the readers of the stream.

func (*ServerStream) WritePacketRTP

func (st *ServerStream) WritePacketRTP(trackID int, pkt *rtp.Packet)

WritePacketRTP writes a RTP packet to all the readers of the stream.

type Track

type Track interface {
	// ClockRate returns the track clock rate.
	ClockRate() int
	// GetControl returns the track control.
	GetControl() string
	// SetControl sets the track control.
	SetControl(string)
	// MediaDescription returns the media description in SDP format.
	MediaDescription() *psdp.MediaDescription
	// contains filtered or unexported methods
}

Track is a RTSP track.

type TrackAAC

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

TrackAAC is an AAC track.

func NewTrackAAC

func NewTrackAAC(payloadType uint8, typ int, sampleRate int,
	channelCount int, aotSpecificConfig []byte) (*TrackAAC, error)

NewTrackAAC allocates a TrackAAC.

func (*TrackAAC) AOTSpecificConfig

func (t *TrackAAC) AOTSpecificConfig() []byte

AOTSpecificConfig returns the track AOT specific config.

func (*TrackAAC) ChannelCount

func (t *TrackAAC) ChannelCount() int

ChannelCount returns the track channel count.

func (*TrackAAC) ClockRate

func (t *TrackAAC) ClockRate() int

ClockRate returns the track clock rate.

func (*TrackAAC) GetControl

func (t *TrackAAC) GetControl() string

GetControl gets the track control.

func (*TrackAAC) MediaDescription

func (t *TrackAAC) MediaDescription() *psdp.MediaDescription

MediaDescription returns the media description in SDP format.

func (*TrackAAC) SetControl

func (t *TrackAAC) SetControl(c string)

SetControl sets the track control.

func (*TrackAAC) Type

func (t *TrackAAC) Type() int

Type returns the track MPEG4-audio type.

type TrackGeneric

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

TrackGeneric is a generic track.

func NewTrackGeneric

func NewTrackGeneric(media string, formats []string, rtpmap string, fmtp string) (*TrackGeneric, error)

NewTrackGeneric allocates a generic track.

func (*TrackGeneric) ClockRate

func (t *TrackGeneric) ClockRate() int

ClockRate returns the track clock rate.

func (*TrackGeneric) GetControl

func (t *TrackGeneric) GetControl() string

GetControl returns the track control.

func (*TrackGeneric) MediaDescription

func (t *TrackGeneric) MediaDescription() *psdp.MediaDescription

MediaDescription returns the media description in SDP format.

func (*TrackGeneric) SetControl

func (t *TrackGeneric) SetControl(c string)

SetControl set the track control.

type TrackH264

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

TrackH264 is a H264 track.

func NewTrackH264

func NewTrackH264(payloadType uint8, sps []byte, pps []byte, extradata []byte) (*TrackH264, error)

NewTrackH264 allocates a TrackH264.

func (*TrackH264) ClockRate

func (t *TrackH264) ClockRate() int

ClockRate returns the track clock rate.

func (*TrackH264) ExtraData

func (t *TrackH264) ExtraData() []byte

ExtraData returns the track extra data.

func (*TrackH264) GetControl

func (t *TrackH264) GetControl() string

GetControl gets the track control.

func (*TrackH264) MediaDescription

func (t *TrackH264) MediaDescription() *psdp.MediaDescription

MediaDescription returns the media description in SDP format.

func (*TrackH264) PPS

func (t *TrackH264) PPS() []byte

PPS returns the track PPS.

func (*TrackH264) SPS

func (t *TrackH264) SPS() []byte

SPS returns the track SPS.

func (*TrackH264) SetControl

func (t *TrackH264) SetControl(c string)

SetControl sets the track control.

func (*TrackH264) SetPPS

func (t *TrackH264) SetPPS(v []byte)

SetPPS sets the track PPS.

func (*TrackH264) SetSPS

func (t *TrackH264) SetSPS(v []byte)

SetSPS sets the track SPS.

type TrackOpus

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

TrackOpus is a Opus track.

func NewTrackOpus

func NewTrackOpus(payloadType uint8, sampleRate int, channelCount int) (*TrackOpus, error)

NewTrackOpus allocates a TrackOpus.

func (*TrackOpus) ChannelCount

func (t *TrackOpus) ChannelCount() int

ChannelCount returns the channel count.

func (*TrackOpus) ClockRate

func (t *TrackOpus) ClockRate() int

ClockRate returns the track clock rate.

func (*TrackOpus) GetControl

func (t *TrackOpus) GetControl() string

GetControl returns the track control.

func (*TrackOpus) MediaDescription

func (t *TrackOpus) MediaDescription() *psdp.MediaDescription

MediaDescription returns the media description in SDP format.

func (*TrackOpus) SetControl

func (t *TrackOpus) SetControl(c string)

SetControl sets the track control.

type Tracks

type Tracks []Track

Tracks is a list of tracks.

func ReadTracks

func ReadTracks(byts []byte) (Tracks, error)

ReadTracks decodes tracks from the SDP format.

func (Tracks) Write

func (ts Tracks) Write(multicast bool) []byte

Write encodes tracks in the SDP format.

type Transport

type Transport int

Transport is a RTSP transport protocol.

const (
	TransportUDP Transport = iota
	TransportUDPMulticast
	TransportTCP
)

standard transport protocols.

func (Transport) String

func (t Transport) String() string

String implements fmt.Stringer.

Directories

Path Synopsis
examples
pkg
aac
Package aac contains utilities to work with the AAC codec.
Package aac contains utilities to work with the AAC codec.
auth
Package auth contains utilities to perform authentication.
Package auth contains utilities to perform authentication.
base
Package base contains the primitives of the RTSP protocol.
Package base contains the primitives of the RTSP protocol.
h264
Package h264 contains utilities to work with the H264 codec.
Package h264 contains utilities to work with the H264 codec.
headers
Package headers contains various RTSP headers.
Package headers contains various RTSP headers.
liberrors
Package liberrors contains errors returned by the library.
Package liberrors contains errors returned by the library.
multibuffer
Package multibuffer contains a buffer with multiple levels.
Package multibuffer contains a buffer with multiple levels.
ringbuffer
Package ringbuffer contains a ring buffer.
Package ringbuffer contains a ring buffer.
rtcpreceiver
Package rtcpreceiver contains a utility to generate RTCP receiver reports.
Package rtcpreceiver contains a utility to generate RTCP receiver reports.
rtcpsender
Package rtcpsender contains a utility to generate RTCP sender reports.
Package rtcpsender contains a utility to generate RTCP sender reports.
rtpaac
Package rtpaac contains a RTP/AAC decoder and encoder.
Package rtpaac contains a RTP/AAC decoder and encoder.
rtph264
Package rtph264 contains a RTP/H264 decoder and encoder.
Package rtph264 contains a RTP/H264 decoder and encoder.
rtptimedec
Package rtptimedec contains a RTP timestamp decoder.
Package rtptimedec contains a RTP timestamp decoder.
sdp
Package sdp contains a SDP encoder/decoder compatible with most RTSP implementations.
Package sdp contains a SDP encoder/decoder compatible with most RTSP implementations.

Jump to

Keyboard shortcuts

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