mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
switch to v5 (#890)
* switch from v4 to v5 * remove deprecated entities * remove "2" suffix from entities * rename TransportProtocol into Protocol
This commit is contained in:
@@ -56,11 +56,11 @@ linters:
|
||||
- (github.com/datarhei/gosrt.Conn).Close
|
||||
- (github.com/datarhei/gosrt.Conn).SetReadDeadline
|
||||
- (github.com/datarhei/gosrt.Conn).SetWriteDeadline
|
||||
- (*github.com/bluenviron/gortsplib/v4.Client).Close
|
||||
- (*github.com/bluenviron/gortsplib/v4.Server).Close
|
||||
- (*github.com/bluenviron/gortsplib/v4.ServerSession).Close
|
||||
- (*github.com/bluenviron/gortsplib/v4.ServerStream).Close
|
||||
- (*github.com/bluenviron/gortsplib/v4.ServerConn).Close
|
||||
- (*github.com/bluenviron/gortsplib/v5.Client).Close
|
||||
- (*github.com/bluenviron/gortsplib/v5.Server).Close
|
||||
- (*github.com/bluenviron/gortsplib/v5.ServerSession).Close
|
||||
- (*github.com/bluenviron/gortsplib/v5.ServerStream).Close
|
||||
- (*github.com/bluenviron/gortsplib/v5.ServerConn).Close
|
||||
|
||||
govet:
|
||||
enable-all: true
|
||||
|
46
README.md
46
README.md
@@ -4,7 +4,7 @@
|
||||
[](https://github.com/bluenviron/gortsplib/actions/workflows/lint.yml)
|
||||
[](https://goreportcard.com/report/github.com/bluenviron/gortsplib)
|
||||
[](https://app.codecov.io/gh/bluenviron/gortsplib/tree/main)
|
||||
[](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4#pkg-index)
|
||||
[](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5#pkg-index)
|
||||
|
||||
RTSP client and server library for the Go programming language, written for [MediaMTX](https://github.com/bluenviron/mediamtx).
|
||||
|
||||
@@ -104,7 +104,7 @@ Features:
|
||||
|
||||
## API Documentation
|
||||
|
||||
[Click to open the API Documentation](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4#pkg-index)
|
||||
[Click to open the API Documentation](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5#pkg-index)
|
||||
|
||||
## RTP Payload Formats
|
||||
|
||||
@@ -114,37 +114,37 @@ In RTSP, media streams are transmitted by using RTP packets, which are encoded i
|
||||
|
||||
|format|documentation|encoder and decoder available|
|
||||
|------|-------------|-----------------------------|
|
||||
|AV1|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#AV1)|:heavy_check_mark:|
|
||||
|VP9|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#VP9)|:heavy_check_mark:|
|
||||
|VP8|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#VP8)|:heavy_check_mark:|
|
||||
|H265|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#H265)|:heavy_check_mark:|
|
||||
|H264|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#H264)|:heavy_check_mark:|
|
||||
|MPEG-4 Video (H263, Xvid)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEG4Video)|:heavy_check_mark:|
|
||||
|MPEG-1/2 Video|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEG1Video)|:heavy_check_mark:|
|
||||
|M-JPEG|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MJPEG)|:heavy_check_mark:|
|
||||
|AV1|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#AV1)|:heavy_check_mark:|
|
||||
|VP9|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#VP9)|:heavy_check_mark:|
|
||||
|VP8|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#VP8)|:heavy_check_mark:|
|
||||
|H265|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#H265)|:heavy_check_mark:|
|
||||
|H264|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#H264)|:heavy_check_mark:|
|
||||
|MPEG-4 Video (H263, Xvid)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEG4Video)|:heavy_check_mark:|
|
||||
|MPEG-1/2 Video|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEG1Video)|:heavy_check_mark:|
|
||||
|M-JPEG|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MJPEG)|:heavy_check_mark:|
|
||||
|
||||
### Audio
|
||||
|
||||
|format|documentation|encoder and decoder available|
|
||||
|------|-------------|-----------------------------|
|
||||
|Opus|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#Opus)|:heavy_check_mark:|
|
||||
|Vorbis|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#Vorbis)||
|
||||
|MPEG-4 Audio (AAC)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEG4Audio)|:heavy_check_mark:|
|
||||
|MPEG-4 Audio LATM (AAC-LATM)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEG4AudioLATM)|:heavy_check_mark:|
|
||||
|MPEG-1/2 Audio (MP3)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEG1Audio)|:heavy_check_mark:|
|
||||
|AC-3|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#AC3)|:heavy_check_mark:|
|
||||
|Speex|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#Speex)||
|
||||
|G726|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#G726)||
|
||||
|G722|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#G722)|:heavy_check_mark:|
|
||||
|G711 (PCMA, PCMU)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#G711)|:heavy_check_mark:|
|
||||
|LPCM|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#LPCM)|:heavy_check_mark:|
|
||||
|Opus|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#Opus)|:heavy_check_mark:|
|
||||
|Vorbis|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#Vorbis)||
|
||||
|MPEG-4 Audio (AAC)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEG4Audio)|:heavy_check_mark:|
|
||||
|MPEG-4 Audio LATM (AAC-LATM)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEG4AudioLATM)|:heavy_check_mark:|
|
||||
|MPEG-1/2 Audio (MP3)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEG1Audio)|:heavy_check_mark:|
|
||||
|AC-3|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#AC3)|:heavy_check_mark:|
|
||||
|Speex|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#Speex)||
|
||||
|G726|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#G726)||
|
||||
|G722|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#G722)|:heavy_check_mark:|
|
||||
|G711 (PCMA, PCMU)|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#G711)|:heavy_check_mark:|
|
||||
|LPCM|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#LPCM)|:heavy_check_mark:|
|
||||
|
||||
### Other
|
||||
|
||||
|format|documentation|encoder and decoder available|
|
||||
|------|-------------|-----------------------------|
|
||||
|MPEG-TS|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#MPEGTS)||
|
||||
|KLV|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v4/pkg/format#KLV)|:heavy_check_mark:|
|
||||
|MPEG-TS|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#MPEGTS)||
|
||||
|KLV|[link](https://pkg.go.dev/github.com/bluenviron/gortsplib/v5/pkg/format#KLV)|:heavy_check_mark:|
|
||||
|
||||
## Specifications
|
||||
|
||||
|
140
client.go
140
client.go
@@ -23,20 +23,20 @@ import (
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/internal/asyncprocessor"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/bytecounter"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/rtpreceiver"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/rtpsender"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/rtptime"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/internal/asyncprocessor"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/bytecounter"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/rtpreceiver"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/rtpsender"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/rtptime"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -84,14 +84,6 @@ func clientExtractExistingSSRCs(setuppedMedias map[*description.Media]*clientMed
|
||||
return ret
|
||||
}
|
||||
|
||||
// avoid an int64 overflow and preserve resolution by splitting division into two parts:
|
||||
// first add the integer part, then the decimal part.
|
||||
func multiplyAndDivide(v, m, d time.Duration) time.Duration {
|
||||
secs := v / d
|
||||
dec := v % d
|
||||
return (secs*m + dec*m/d)
|
||||
}
|
||||
|
||||
// convert an URL into an address, in particular:
|
||||
// * add default port
|
||||
// * handle IPv6 with or without square brackets.
|
||||
@@ -417,11 +409,6 @@ type ClientOnResponseFunc func(*base.Response)
|
||||
// ClientOnTransportSwitchFunc is the prototype of Client.OnTransportSwitch.
|
||||
type ClientOnTransportSwitchFunc func(err error)
|
||||
|
||||
// ClientOnPacketLostFunc is the prototype of Client.OnPacketLost.
|
||||
//
|
||||
// Deprecated: replaced by ClientOnPacketsLostFunc
|
||||
type ClientOnPacketLostFunc func(err error)
|
||||
|
||||
// ClientOnPacketsLostFunc is the prototype of Client.OnPacketsLost.
|
||||
type ClientOnPacketsLostFunc func(lost uint64)
|
||||
|
||||
@@ -467,7 +454,7 @@ type Client struct {
|
||||
// transport protocol (UDP, Multicast or TCP).
|
||||
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
|
||||
// It defaults to nil.
|
||||
Transport *TransportProtocol
|
||||
Protocol *Protocol
|
||||
// enable communication with servers which don't provide UDP server ports
|
||||
// or use different server ports than the announced ones.
|
||||
// This can be a security issue.
|
||||
@@ -495,14 +482,6 @@ type Client struct {
|
||||
DisableRTCPSenderReports bool
|
||||
// explicitly request back channels to the server.
|
||||
RequestBackChannels bool
|
||||
// pointer to a variable that stores received bytes.
|
||||
//
|
||||
// Deprecated: use Client.Stats()
|
||||
BytesReceived *uint64
|
||||
// pointer to a variable that stores sent bytes.
|
||||
//
|
||||
// Deprecated: use Client.Stats()
|
||||
BytesSent *uint64
|
||||
|
||||
//
|
||||
// system functions (all optional)
|
||||
@@ -528,10 +507,6 @@ type Client struct {
|
||||
// called when the transport protocol changes.
|
||||
OnTransportSwitch ClientOnTransportSwitchFunc
|
||||
// called when the client detects lost packets.
|
||||
//
|
||||
// Deprecated: replaced by OnPacketsLost
|
||||
OnPacketLost ClientOnPacketLostFunc
|
||||
// called when the client detects lost packets.
|
||||
OnPacketsLost ClientOnPacketsLostFunc
|
||||
// called when a non-fatal decode error occurs.
|
||||
OnDecodeError ClientOnDecodeErrorFunc
|
||||
@@ -575,7 +550,7 @@ type Client struct {
|
||||
writerMutex sync.RWMutex
|
||||
writer *asyncprocessor.Processor
|
||||
reader *clientReader
|
||||
timeDecoder *rtptime.GlobalDecoder2
|
||||
timeDecoder *rtptime.GlobalDecoder
|
||||
mustClose bool
|
||||
tcpFrame *base.InterleavedFrame
|
||||
tcpBuffer []byte
|
||||
@@ -600,16 +575,7 @@ type Client struct {
|
||||
}
|
||||
|
||||
// Start initializes the connection to a server.
|
||||
//
|
||||
// Deprecated: replaced by Start2.
|
||||
func (c *Client) Start(scheme string, host string) error {
|
||||
c.Scheme = scheme
|
||||
c.Host = host
|
||||
return c.Start2()
|
||||
}
|
||||
|
||||
// Start2 initializes the connection to a server.
|
||||
func (c *Client) Start2() error {
|
||||
func (c *Client) Start() error {
|
||||
// RTSP parameters
|
||||
if c.ReadTimeout == 0 {
|
||||
c.ReadTimeout = 10 * time.Second
|
||||
@@ -664,11 +630,6 @@ func (c *Client) Start2() error {
|
||||
log.Println(err.Error())
|
||||
}
|
||||
}
|
||||
if c.OnPacketLost != nil {
|
||||
c.OnPacketsLost = func(lost uint64) {
|
||||
c.OnPacketLost(liberrors.ErrClientRTPPacketsLost{Lost: uint(lost)}) //nolint:staticcheck
|
||||
}
|
||||
}
|
||||
if c.OnPacketsLost == nil {
|
||||
c.OnPacketsLost = func(lost uint64) {
|
||||
log.Printf("%d RTP %s lost",
|
||||
@@ -709,17 +670,8 @@ func (c *Client) Start2() error {
|
||||
c.checkTimeoutTimer = emptyTimer()
|
||||
c.keepAlivePeriod = 30 * time.Second
|
||||
c.keepAliveTimer = emptyTimer()
|
||||
|
||||
if c.BytesReceived != nil {
|
||||
c.bytesReceived = c.BytesReceived
|
||||
} else {
|
||||
c.bytesReceived = new(uint64)
|
||||
}
|
||||
if c.BytesSent != nil {
|
||||
c.bytesSent = c.BytesSent
|
||||
} else {
|
||||
c.bytesSent = new(uint64)
|
||||
}
|
||||
|
||||
c.chOptions = make(chan optionsReq)
|
||||
c.chDescribe = make(chan describeReq)
|
||||
@@ -749,7 +701,7 @@ func (c *Client) StartRecording(address string, desc *description.Session) error
|
||||
c.Scheme = u.Scheme
|
||||
c.Host = u.Host
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1063,7 +1015,7 @@ func (c *Client) trySwitchingProtocol() error {
|
||||
}
|
||||
|
||||
func (c *Client) startTransportRoutines() {
|
||||
c.timeDecoder = &rtptime.GlobalDecoder2{}
|
||||
c.timeDecoder = &rtptime.GlobalDecoder{}
|
||||
c.timeDecoder.Initialize()
|
||||
|
||||
for _, cm := range c.setuppedMedias {
|
||||
@@ -1334,7 +1286,7 @@ func (c *Client) isInTCPTimeout() bool {
|
||||
func (c *Client) doCheckTimeout() error {
|
||||
if c.setuppedTransport.Protocol == TransportUDP ||
|
||||
c.setuppedTransport.Protocol == TransportUDPMulticast {
|
||||
if c.checkTimeoutInitial && !c.backChannelSetupped && c.Transport == nil {
|
||||
if c.checkTimeoutInitial && !c.backChannelSetupped && c.Protocol == nil {
|
||||
c.checkTimeoutInitial = false
|
||||
|
||||
if !c.atLeastOneUDPPacketHasBeenReceived() {
|
||||
@@ -1539,7 +1491,7 @@ func (c *Client) doAnnounce(u *base.URL, desc *description.Session) (*base.Respo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if c.Transport != nil && *c.Transport == TransportUDPMulticast {
|
||||
if c.Protocol != nil && *c.Protocol == TransportUDPMulticast {
|
||||
return nil, fmt.Errorf("recording with UDP multicast is not supported")
|
||||
}
|
||||
|
||||
@@ -1558,7 +1510,7 @@ func (c *Client) doAnnounce(u *base.URL, desc *description.Session) (*base.Respo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
byts, err := desc.Marshal(false)
|
||||
byts, err := desc.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1633,7 +1585,7 @@ func (c *Client) doSetup(
|
||||
th.Mode = &v
|
||||
}
|
||||
|
||||
var protocol TransportProtocol
|
||||
var protocol Protocol
|
||||
|
||||
switch {
|
||||
// use transport from previous SETUP calls
|
||||
@@ -1642,8 +1594,8 @@ func (c *Client) doSetup(
|
||||
th.Profile = c.setuppedTransport.Profile
|
||||
|
||||
// use transport from config, secure flag from server
|
||||
case c.Transport != nil:
|
||||
protocol = *c.Transport
|
||||
case c.Protocol != nil:
|
||||
protocol = *c.Protocol
|
||||
if isSecure(medi.Profile) && c.Scheme == "rtsps" {
|
||||
th.Profile = headers.TransportProfileSAVP
|
||||
} else {
|
||||
@@ -1813,7 +1765,7 @@ func (c *Client) doSetup(
|
||||
if res.StatusCode != base.StatusOK {
|
||||
// switch transport automatically
|
||||
if res.StatusCode == base.StatusUnsupportedTransport &&
|
||||
c.setuppedTransport == nil && c.Transport == nil {
|
||||
c.setuppedTransport == nil && c.Protocol == nil {
|
||||
c.OnTransportSwitch(liberrors.ErrClientSwitchToTCP2{})
|
||||
c.setuppedTransport = &SessionTransport{
|
||||
Protocol: TransportTCP,
|
||||
@@ -1836,7 +1788,7 @@ func (c *Client) doSetup(
|
||||
case TransportUDP, TransportUDPMulticast:
|
||||
if thRes.Protocol == headers.TransportProtocolTCP {
|
||||
// switch transport automatically
|
||||
if c.setuppedTransport == nil && c.Transport == nil {
|
||||
if c.setuppedTransport == nil && c.Protocol == nil {
|
||||
c.OnTransportSwitch(liberrors.ErrClientSwitchToTCP2{})
|
||||
|
||||
c.baseURL = baseURL
|
||||
@@ -2358,18 +2310,6 @@ func (c *Client) Pause() (*base.Response, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Seek asks the server to re-start the stream from a specific timestamp.
|
||||
//
|
||||
// Deprecated: will be removed in next version. Equivalent to using Pause() followed by Play().
|
||||
func (c *Client) Seek(ra *headers.Range) (*base.Response, error) {
|
||||
_, err := c.Pause()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c.Play(ra)
|
||||
}
|
||||
|
||||
// OnPacketRTPAny sets a callback that is called when a RTP packet is read from any setupped media.
|
||||
func (c *Client) OnPacketRTPAny(cb OnPacketRTPAnyFunc) {
|
||||
for _, cm := range c.setuppedMedias {
|
||||
@@ -2438,23 +2378,7 @@ func (c *Client) WritePacketRTCP(medi *description.Media, pkt rtcp.Packet) error
|
||||
|
||||
// PacketPTS returns the PTS (presentation timestamp) of an incoming RTP packet.
|
||||
// It is computed by decoding the packet timestamp and sychronizing it with other tracks.
|
||||
//
|
||||
// Deprecated: replaced by PacketPTS2.
|
||||
func (c *Client) PacketPTS(medi *description.Media, pkt *rtp.Packet) (time.Duration, bool) {
|
||||
cm := c.setuppedMedias[medi]
|
||||
ct := cm.formats[pkt.PayloadType]
|
||||
|
||||
v, ok := c.timeDecoder.Decode(ct.format, pkt)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return multiplyAndDivide(time.Duration(v), time.Second, time.Duration(ct.format.ClockRate())), true
|
||||
}
|
||||
|
||||
// PacketPTS2 returns the PTS (presentation timestamp) of an incoming RTP packet.
|
||||
// It is computed by decoding the packet timestamp and sychronizing it with other tracks.
|
||||
func (c *Client) PacketPTS2(medi *description.Media, pkt *rtp.Packet) (int64, bool) {
|
||||
func (c *Client) PacketPTS(medi *description.Media, pkt *rtp.Packet) (int64, bool) {
|
||||
cm := c.setuppedMedias[medi]
|
||||
ct := cm.formats[pkt.PayloadType]
|
||||
return c.timeDecoder.Decode(ct.format, pkt)
|
||||
@@ -2468,8 +2392,8 @@ func (c *Client) PacketNTP(medi *description.Media, pkt *rtp.Packet) (time.Time,
|
||||
return ct.rtpReceiver.PacketNTP(pkt.Timestamp)
|
||||
}
|
||||
|
||||
// Transport2 returns transport details.
|
||||
func (c *Client) Transport2() *ClientTransport {
|
||||
// Transport returns transport details.
|
||||
func (c *Client) Transport() *ClientTransport {
|
||||
c.propsMutex.RLock()
|
||||
defer c.propsMutex.RUnlock()
|
||||
|
||||
@@ -2486,8 +2410,8 @@ func (c *Client) Stats() *ClientStats {
|
||||
c.propsMutex.RLock()
|
||||
defer c.propsMutex.RUnlock()
|
||||
|
||||
mediaStats := func() map[*description.Media]StatsSessionMedia { //nolint:dupl
|
||||
ret := make(map[*description.Media]StatsSessionMedia, len(c.setuppedMedias))
|
||||
mediaStats := func() map[*description.Media]SessionStatsMedia { //nolint:dupl
|
||||
ret := make(map[*description.Media]SessionStatsMedia, len(c.setuppedMedias))
|
||||
|
||||
for med, sm := range c.setuppedMedias {
|
||||
ret[med] = SessionStatsMedia{
|
||||
|
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/rtpreceiver"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/rtpsender"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/rtpreceiver"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/rtpsender"
|
||||
)
|
||||
|
||||
type clientFormat struct {
|
||||
@@ -53,7 +53,7 @@ func (cf *clientFormat) initialize() {
|
||||
} else {
|
||||
cf.rtpReceiver = &rtpreceiver.Receiver{
|
||||
ClockRate: cf.format.ClockRate(),
|
||||
LocalSSRC: &cf.localSSRC,
|
||||
LocalSSRC: cf.localSSRC,
|
||||
UnrealiableTransport: (cf.cm.udpRTPListener != nil),
|
||||
Period: cf.cm.c.receiverReportPeriod,
|
||||
TimeNow: cf.cm.c.timeNow,
|
||||
@@ -94,7 +94,7 @@ func (cf *clientFormat) remoteSSRC() (uint32, bool) {
|
||||
func (cf *clientFormat) readPacketRTP(pkt *rtp.Packet) {
|
||||
now := cf.cm.c.timeNow()
|
||||
|
||||
pkts, lost, err := cf.rtpReceiver.ProcessPacket2(pkt, now, cf.format.PTSEqualsDTS(pkt))
|
||||
pkts, lost, err := cf.rtpReceiver.ProcessPacket(pkt, now, cf.format.PTSEqualsDTS(pkt))
|
||||
if err != nil {
|
||||
cf.cm.onPacketRTPDecodeError(err)
|
||||
return
|
||||
|
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/liberrors"
|
||||
)
|
||||
|
||||
func createUDPListenerPair(
|
||||
|
@@ -18,14 +18,14 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/net/ipv4"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/ntp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/ntp"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ func mediasToSDP(medias []*description.Media) []byte {
|
||||
m.Control = "trackID=" + strconv.FormatInt(int64(i), 10)
|
||||
}
|
||||
|
||||
byts, err := desc.Marshal(false)
|
||||
byts, err := desc.Marshal()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func readAll(c *Client, ur string, cb func(*description.Media, format.Format, *r
|
||||
c.Scheme = u.Scheme
|
||||
c.Host = u.Host
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -339,16 +339,23 @@ func TestClientPlay(t *testing.T) {
|
||||
err2 = forma.Init()
|
||||
require.NoError(t, err2)
|
||||
|
||||
var profile headers.TransportProfile
|
||||
if ca.secure == "secure" {
|
||||
profile = headers.TransportProfileSAVP
|
||||
} else {
|
||||
profile = headers.TransportProfileAVP
|
||||
}
|
||||
|
||||
medias := []*description.Media{
|
||||
{
|
||||
Type: "application",
|
||||
Formats: []format.Format{forma},
|
||||
Secure: ca.secure == "secure",
|
||||
Profile: profile,
|
||||
},
|
||||
{
|
||||
Type: "application",
|
||||
Formats: []format.Format{forma},
|
||||
Secure: ca.secure == "secure",
|
||||
Profile: profile,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -600,7 +607,7 @@ func TestClientPlay(t *testing.T) {
|
||||
Scheme: u.Scheme,
|
||||
Host: u.Host,
|
||||
TLSConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
switch ca.transport {
|
||||
case "udp":
|
||||
v := TransportUDP
|
||||
@@ -617,7 +624,7 @@ func TestClientPlay(t *testing.T) {
|
||||
}(),
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -627,7 +634,7 @@ func TestClientPlay(t *testing.T) {
|
||||
// test that properties can be accessed in parallel
|
||||
go func() {
|
||||
c.Stats()
|
||||
c.Transport2()
|
||||
c.Transport()
|
||||
}()
|
||||
|
||||
err = c.SetupAll(sd.BaseURL, sd.Medias)
|
||||
@@ -814,7 +821,7 @@ func TestClientPlaySRTPVariants(t *testing.T) {
|
||||
require.Equal(t, (*headers.TransportMode)(nil), inTH.Mode)
|
||||
|
||||
th := headers.Transport{
|
||||
Secure: true,
|
||||
Profile: headers.TransportProfileSAVP,
|
||||
}
|
||||
|
||||
v := headers.TransportDeliveryUnicast
|
||||
@@ -876,14 +883,16 @@ func TestClientPlaySRTPVariants(t *testing.T) {
|
||||
require.Equal(t, base.Teardown, req.Method)
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
TLSConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
|
||||
u, err := base.ParseURL("rtsps://127.0.0.1:8554/stream")
|
||||
require.NoError(t, err)
|
||||
|
||||
err = c.Start(u.Scheme, u.Host)
|
||||
c := Client{
|
||||
Scheme: u.Scheme,
|
||||
Host: u.Host,
|
||||
TLSConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -1032,10 +1041,10 @@ func TestClientPlayPartial(t *testing.T) {
|
||||
c := Client{
|
||||
Scheme: u.Scheme,
|
||||
Host: u.Host,
|
||||
Transport: ptrOf(TransportTCP),
|
||||
Protocol: ptrOf(TransportTCP),
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -1978,7 +1987,7 @@ func TestClientPlayDifferentInterleavedIDs(t *testing.T) {
|
||||
packetRecv := make(chan struct{})
|
||||
|
||||
c := Client{
|
||||
Transport: ptrOf(TransportTCP),
|
||||
Protocol: ptrOf(TransportTCP),
|
||||
}
|
||||
|
||||
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
||||
@@ -2412,7 +2421,7 @@ func TestClientPlayPausePlay(t *testing.T) {
|
||||
packetRecv := make(chan struct{})
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if transport == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -2731,7 +2740,7 @@ func TestClientPlayErrorTimeout(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
switch transport {
|
||||
case "udp":
|
||||
v := TransportUDP
|
||||
@@ -2867,7 +2876,7 @@ func TestClientPlayIgnoreTCPInvalidMedia(t *testing.T) {
|
||||
recv := make(chan struct{})
|
||||
|
||||
c := Client{
|
||||
Transport: ptrOf(TransportTCP),
|
||||
Protocol: ptrOf(TransportTCP),
|
||||
}
|
||||
|
||||
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
||||
@@ -3020,7 +3029,7 @@ func TestClientPlayKeepAlive(t *testing.T) {
|
||||
|
||||
v := TransportTCP
|
||||
c := Client{
|
||||
Transport: &v,
|
||||
Protocol: &v,
|
||||
OnResponse: func(_ *base.Response) {
|
||||
m++
|
||||
if ca != "no response" {
|
||||
@@ -3118,7 +3127,7 @@ func TestClientPlayDifferentSource(t *testing.T) {
|
||||
Protocol: headers.TransportProtocolUDP,
|
||||
ClientPorts: inTH.ClientPorts,
|
||||
ServerPorts: &[2]int{34556, 34557},
|
||||
Source: ptrOf(net.ParseIP("127.0.1.1")),
|
||||
Source2: ptrOf("127.0.1.1"),
|
||||
}
|
||||
|
||||
l1, err2 := net.ListenPacket("udp", "127.0.1.1:34556")
|
||||
@@ -3165,7 +3174,7 @@ func TestClientPlayDifferentSource(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: ptrOf(TransportUDP),
|
||||
Protocol: ptrOf(TransportUDP),
|
||||
}
|
||||
|
||||
err = readAll(&c, "rtsp://localhost:8554/test/stream?param=value",
|
||||
@@ -3409,7 +3418,7 @@ func TestClientPlayDecodeErrors(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if ca.proto == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -3893,7 +3902,7 @@ func TestClientPlayBackChannel(t *testing.T) {
|
||||
Scheme: u.Scheme,
|
||||
Host: u.Host,
|
||||
RequestBackChannels: true,
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if transport == "tcp" {
|
||||
return ptrOf(TransportTCP)
|
||||
}
|
||||
@@ -3903,7 +3912,7 @@ func TestClientPlayBackChannel(t *testing.T) {
|
||||
receiverReportPeriod: 750 * time.Millisecond,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -3962,7 +3971,7 @@ func TestClientPlaySetupErrorBackChannel(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
|
@@ -3,8 +3,8 @@ package gortsplib
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/liberrors"
|
||||
)
|
||||
|
||||
type clientReader struct {
|
||||
|
@@ -16,14 +16,14 @@ import (
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/ntp"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/ntp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
)
|
||||
|
||||
var testH264Media = &description.Media{
|
||||
@@ -80,7 +80,7 @@ func record(c *Client, ur string, medias []*description.Media, cb func(*descript
|
||||
c.Scheme = u.Scheme
|
||||
c.Host = u.Host
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -417,7 +417,7 @@ func TestClientRecord(t *testing.T) {
|
||||
TLSConfig: &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
},
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if ca.transport == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -587,7 +587,7 @@ func TestClientRecordSocketError(t *testing.T) {
|
||||
TLSConfig: &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
},
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if transport == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -731,7 +731,7 @@ func TestClientRecordPauseRecordSerial(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if transport == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -890,7 +890,7 @@ func TestClientRecordPauseRecordParallel(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if transport == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -1215,7 +1215,7 @@ func TestClientRecordDecodeErrors(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if ca.proto == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -1389,7 +1389,7 @@ func TestClientRecordRTCPReport(t *testing.T) {
|
||||
var curTimeMutex sync.Mutex
|
||||
|
||||
c := Client{
|
||||
Transport: func() *TransportProtocol {
|
||||
Protocol: func() *Protocol {
|
||||
if ca == "udp" {
|
||||
v := TransportUDP
|
||||
return &v
|
||||
@@ -1536,7 +1536,7 @@ func TestClientRecordIgnoreTCPRTPPackets(t *testing.T) {
|
||||
rtcpReceived := make(chan struct{})
|
||||
|
||||
c := Client{
|
||||
Transport: ptrOf(TransportTCP),
|
||||
Protocol: ptrOf(TransportTCP),
|
||||
}
|
||||
|
||||
medias := []*description.Media{testH264Media}
|
||||
|
@@ -12,11 +12,11 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/internal/base64streamreader"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/internal/base64streamreader"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/auth"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/conn"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
@@ -65,7 +65,7 @@ func TestClientClose(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
|
||||
c.Close()
|
||||
@@ -127,7 +127,7 @@ func TestClientCloseDuringRequest(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
|
||||
optionsDone := make(chan struct{})
|
||||
@@ -200,7 +200,7 @@ func TestClientSession(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -280,7 +280,7 @@ func TestClientAuth(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -359,7 +359,7 @@ func TestClientCSeq(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -425,7 +425,7 @@ func TestClientDescribeCharset(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -515,7 +515,7 @@ func TestClientReplyToServerRequest(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -583,7 +583,7 @@ func TestClientRelativeContentBase(t *testing.T) {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
@@ -764,7 +764,7 @@ func TestClientHTTPTunnel(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/multicast"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/readbuffer"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/multicast"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/readbuffer"
|
||||
)
|
||||
|
||||
func ptrOf[T any](v T) *T {
|
||||
|
@@ -1,10 +1,5 @@
|
||||
package gortsplib
|
||||
|
||||
// StatsConn are connection statistics.
|
||||
//
|
||||
// Deprecated: renamed into ConnStats.
|
||||
type StatsConn = ConnStats
|
||||
|
||||
// ConnStats are connection statistics.
|
||||
type ConnStats struct {
|
||||
// received bytes
|
||||
|
@@ -1,5 +1,14 @@
|
||||
package gortsplib
|
||||
|
||||
// Tunnel is a tunneling method.
|
||||
type Tunnel int
|
||||
|
||||
// tunneling methods.
|
||||
const (
|
||||
TunnelNone Tunnel = iota
|
||||
TunnelHTTP
|
||||
)
|
||||
|
||||
// ConnTransport contains details about the transport of a connection.
|
||||
type ConnTransport struct {
|
||||
Tunnel Tunnel
|
||||
|
@@ -6,10 +6,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/g711"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -61,7 +61,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -11,10 +11,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpav1"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpav1"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/av1"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -58,7 +58,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -6,10 +6,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpav1"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpav1"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/av1"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -35,7 +35,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/g711"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func main() {
|
||||
// called when a H264/RTP packet arrives
|
||||
c.OnPacketRTP(h264Media, h264Format, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(h264Media, pkt)
|
||||
pts, ok := c.PacketPTS(h264Media, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
@@ -117,7 +117,7 @@ func main() {
|
||||
// called when a MPEG-4 audio / RTP packet arrives
|
||||
c.OnPacketRTP(mpeg4AudioMedia, mpeg4AudioFormat, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(mpeg4AudioMedia, pkt)
|
||||
pts, ok := c.PacketPTS(mpeg4AudioMedia, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -11,10 +11,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -58,7 +58,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -6,10 +6,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -35,7 +35,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph265"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -11,10 +11,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph265"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -58,7 +58,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -6,10 +6,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph265"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -35,7 +35,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -90,7 +90,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -7,10 +7,10 @@ import (
|
||||
"image/jpeg"
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmjpeg"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpmjpeg"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -67,7 +67,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"bufio"
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"bufio"
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
|
@@ -4,9 +4,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -6,10 +6,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpvp8"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpvp8"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -6,10 +6,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpvp9"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpvp9"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := c.PacketPTS2(medi, pkt)
|
||||
pts, ok := c.PacketPTS(medi, pkt)
|
||||
if !ok {
|
||||
log.Printf("waiting for timestamp")
|
||||
return
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
Scheme: u.Scheme,
|
||||
Host: u.Host,
|
||||
// transport protocol (UDP, Multicast or TCP). If nil, it is chosen automatically
|
||||
Transport: nil,
|
||||
Protocol: nil,
|
||||
// timeout of read operations
|
||||
ReadTimeout: 10 * time.Second,
|
||||
// timeout of write operations
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -32,7 +32,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -50,7 +50,7 @@ func main() {
|
||||
// called when a RTP packet arrives
|
||||
c.OnPacketRTPAny(func(medi *description.Media, _ format.Format, pkt *rtp.Packet) {
|
||||
// get the PTS (presentation timestamp) of the packet
|
||||
pts, ptsAvailable := c.PacketPTS2(medi, pkt)
|
||||
pts, ptsAvailable := c.PacketPTS(medi, pkt)
|
||||
log.Printf("PTS: available=%v, value=%v\n", ptsAvailable, pts)
|
||||
|
||||
// get the NTP (absolute timestamp) of the packet
|
||||
|
@@ -4,10 +4,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = reader.Start2()
|
||||
err = reader.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtcp"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
@@ -23,7 +23,7 @@ func main() {
|
||||
Host: u.Host,
|
||||
}
|
||||
|
||||
err = c.Start2()
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -6,9 +6,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/g711"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
@@ -10,9 +10,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -6,9 +6,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
|
||||
)
|
||||
|
||||
|
@@ -20,7 +20,7 @@ func frameLineSize(frame *C.AVFrame) *C.int {
|
||||
return (*C.int)(unsafe.Pointer(&frame.linesize[0]))
|
||||
}
|
||||
|
||||
func bigEndianS16ToFloat32(samples []byte) ([]byte, error) {
|
||||
func bigEndianS16ToFloat3(samples []byte) ([]byte, error) {
|
||||
sampleCount := len(samples) / 2
|
||||
outSize := len(samples) * 2
|
||||
outSamples := make([]byte, outSize)
|
||||
@@ -112,7 +112,7 @@ func (d *mp4aEncoder) close() {
|
||||
// encode encodes LPCM samples into Opus packets.
|
||||
func (d *mp4aEncoder) encode(samples []byte) ([][]byte, int64, error) {
|
||||
// convert from big-endian signed 16-bit integer to float32
|
||||
samples, err := bigEndianS16ToFloat32(samples)
|
||||
samples, err := bigEndianS16ToFloat3(samples)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
@@ -8,10 +8,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpsimpleaudio"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpsimpleaudio"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/opus"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
@@ -54,7 +54,7 @@ func encodeMultiple(rtpEnc *rtpsimpleaudio.Encoder, opusPkts [][]byte) ([]*rtp.P
|
||||
|
||||
ret[i].Timestamp += pts
|
||||
|
||||
pts += uint32(opus.PacketDuration2(opusPkt))
|
||||
pts += uint32(opus.PacketDuration(opusPkt))
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
@@ -55,7 +55,7 @@ func main() {
|
||||
// Client allows to set additional client options
|
||||
c := &gortsplib.Client{
|
||||
// transport protocol (UDP or TCP). If nil, it is chosen automatically
|
||||
Transport: nil,
|
||||
Protocol: nil,
|
||||
// timeout of read operations
|
||||
ReadTimeout: 10 * time.Second,
|
||||
// timeout of write operations
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -4,10 +4,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@ func (c *client) read() error {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = rc.Start2()
|
||||
err = rc.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
@@ -4,10 +4,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ func (c *client) read() error {
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
err = rc.Start2()
|
||||
err = rc.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
)
|
||||
|
||||
type server struct {
|
||||
|
@@ -7,11 +7,11 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/liberrors"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -5,8 +5,8 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/g711"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -78,7 +78,7 @@ func (sh *serverHandler) OnPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Re
|
||||
// called when receiving a RTP packet
|
||||
ctx.Session.OnPacketRTPAny(func(m *description.Media, _ format.Format, pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := ctx.Session.PacketPTS2(m, pkt)
|
||||
pts, ok := ctx.Session.PacketPTS(m, pkt)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
@@ -132,7 +132,7 @@ func (sh *serverHandler) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*bas
|
||||
// called when receiving a RTP packet
|
||||
ctx.Session.OnPacketRTP(sh.media, sh.format, func(pkt *rtp.Packet) {
|
||||
// decode timestamp
|
||||
pts, ok := ctx.Session.PacketPTS2(sh.media, pkt)
|
||||
pts, ok := ctx.Session.PacketPTS(sh.media, pkt)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
)
|
||||
|
||||
// This example shows how to:
|
||||
|
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/bluenviron/gortsplib/v4
|
||||
module github.com/bluenviron/gortsplib/v5
|
||||
|
||||
go 1.24.0
|
||||
|
||||
|
@@ -4,7 +4,7 @@ package asyncprocessor
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/ringbuffer"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/ringbuffer"
|
||||
)
|
||||
|
||||
// Processor is an asynchronous queue processor
|
||||
|
@@ -9,10 +9,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -172,7 +172,7 @@ func TestClientVsServer(t *testing.T) {
|
||||
publisherTunnel = gortsplib.TunnelNone
|
||||
}
|
||||
|
||||
var publisherProto gortsplib.Transport
|
||||
var publisherProto gortsplib.Protocol
|
||||
switch ca.publisherProto {
|
||||
case "udp":
|
||||
publisherProto = gortsplib.TransportUDP
|
||||
@@ -183,7 +183,7 @@ func TestClientVsServer(t *testing.T) {
|
||||
publisher := &gortsplib.Client{
|
||||
TLSConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
Tunnel: publisherTunnel,
|
||||
Transport: &publisherProto,
|
||||
Protocol: &publisherProto,
|
||||
}
|
||||
err = publisher.StartRecording(ca.publisherScheme+"://127.0.0.1:8554/test/stream?key=val", desc)
|
||||
require.NoError(t, err)
|
||||
@@ -198,7 +198,7 @@ func TestClientVsServer(t *testing.T) {
|
||||
readerTunnel = gortsplib.TunnelNone
|
||||
}
|
||||
|
||||
var readerProto gortsplib.Transport
|
||||
var readerProto gortsplib.Protocol
|
||||
switch ca.readerProto {
|
||||
case "udp":
|
||||
readerProto = gortsplib.TransportUDP
|
||||
@@ -216,9 +216,9 @@ func TestClientVsServer(t *testing.T) {
|
||||
Host: u.Host,
|
||||
TLSConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
Tunnel: readerTunnel,
|
||||
Transport: &readerProto,
|
||||
Protocol: &readerProto,
|
||||
}
|
||||
err = reader.Start2()
|
||||
err = reader.Start()
|
||||
require.NoError(t, err)
|
||||
defer reader.Close()
|
||||
|
||||
|
@@ -7,10 +7,10 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
@@ -19,19 +19,19 @@ func mustParseURL(s string) *base.URL {
|
||||
func TestCombined(t *testing.T) {
|
||||
for _, c1 := range []struct {
|
||||
name string
|
||||
methods []ValidateMethod
|
||||
methods []VerifyMethod
|
||||
}{
|
||||
{
|
||||
"basic",
|
||||
[]ValidateMethod{ValidateMethodBasic},
|
||||
[]VerifyMethod{VerifyMethodBasic},
|
||||
},
|
||||
{
|
||||
"digest md5",
|
||||
[]ValidateMethod{ValidateMethodDigestMD5},
|
||||
[]VerifyMethod{VerifyMethodDigestMD5},
|
||||
},
|
||||
{
|
||||
"digest sha256",
|
||||
[]ValidateMethod{ValidateMethodSHA256},
|
||||
[]VerifyMethod{VerifyMethodDigestSHA256},
|
||||
},
|
||||
{
|
||||
"all",
|
||||
@@ -52,20 +52,22 @@ func TestCombined(t *testing.T) {
|
||||
nonce, err := GenerateNonce()
|
||||
require.NoError(t, err)
|
||||
|
||||
se, err := NewSender(
|
||||
GenerateWWWAuthenticate(c1.methods, "IPCAM", nonce),
|
||||
func() string {
|
||||
se := &Sender{
|
||||
WWWAuth: GenerateWWWAuthenticate(c1.methods, "IPCAM", nonce),
|
||||
User: func() string {
|
||||
if conf == "wronguser" {
|
||||
return "test1user"
|
||||
}
|
||||
return "testuser"
|
||||
}(),
|
||||
func() string {
|
||||
Pass: func() string {
|
||||
if conf == "wrongpass" {
|
||||
return "test1pass"
|
||||
}
|
||||
return "testpass"
|
||||
}())
|
||||
}(),
|
||||
}
|
||||
err = se.Initialize()
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &base.Request{
|
||||
@@ -81,7 +83,7 @@ func TestCombined(t *testing.T) {
|
||||
|
||||
req.URL = mustParseURL("rtsp://myhost/mypath")
|
||||
|
||||
err = Validate(req, "testuser", "testpass", c1.methods, "IPCAM", nonce)
|
||||
err = Verify(req, "testuser", "testpass", c1.methods, "IPCAM", nonce)
|
||||
|
||||
if conf != "nofail" {
|
||||
require.Error(t, err)
|
||||
|
@@ -3,23 +3,10 @@ package auth
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
)
|
||||
|
||||
// NewSender allocates a Sender.
|
||||
//
|
||||
// Deprecated: replaced by Sender.Initialize().
|
||||
func NewSender(wwwAuth base.HeaderValue, user string, pass string) (*Sender, error) {
|
||||
s := &Sender{
|
||||
WWWAuth: wwwAuth,
|
||||
User: user,
|
||||
Pass: pass,
|
||||
}
|
||||
err := s.Initialize()
|
||||
return s, err
|
||||
}
|
||||
|
||||
// Sender allows to send credentials.
|
||||
// It requires a WWW-Authenticate header (provided by the server)
|
||||
// and a set of credentials.
|
||||
|
@@ -3,7 +3,7 @@ package auth
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -84,7 +84,12 @@ var casesSender = []struct {
|
||||
func TestSender(t *testing.T) {
|
||||
for _, ca := range casesSender {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
se, err := NewSender(ca.wwwAuthenticate, "myuser", "mypass")
|
||||
se := &Sender{
|
||||
WWWAuth: ca.wwwAuthenticate,
|
||||
User: "myuser",
|
||||
Pass: "mypass",
|
||||
}
|
||||
err := se.Initialize()
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &base.Request{
|
||||
@@ -104,7 +109,12 @@ func FuzzSender(f *testing.F) {
|
||||
}
|
||||
|
||||
f.Fuzz(func(_ *testing.T, a string) {
|
||||
se, err := NewSender(base.HeaderValue{a}, "myuser", "mypass")
|
||||
se := &Sender{
|
||||
WWWAuth: base.HeaderValue{a},
|
||||
User: "myuser",
|
||||
Pass: "mypass",
|
||||
}
|
||||
err := se.Initialize()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@@ -1,33 +0,0 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
)
|
||||
|
||||
// ValidateMethod is a validation method.
|
||||
//
|
||||
// Deprecated: replaced by VerifyMethod
|
||||
type ValidateMethod = VerifyMethod
|
||||
|
||||
// validation methods.
|
||||
//
|
||||
// Deprecated.
|
||||
const (
|
||||
ValidateMethodBasic = VerifyMethodBasic
|
||||
ValidateMethodDigestMD5 = VerifyMethodDigestMD5
|
||||
ValidateMethodSHA256 = VerifyMethodDigestSHA256
|
||||
)
|
||||
|
||||
// Validate validates a request sent by a client.
|
||||
//
|
||||
// Deprecated: replaced by Verify.
|
||||
func Validate(
|
||||
req *base.Request,
|
||||
user string,
|
||||
pass string,
|
||||
methods []ValidateMethod,
|
||||
realm string,
|
||||
nonce string,
|
||||
) error {
|
||||
return Verify(req, user, pass, methods, realm, nonce)
|
||||
}
|
@@ -8,8 +8,8 @@ import (
|
||||
"regexp"
|
||||
"slices"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
)
|
||||
|
||||
var reControlAttribute = regexp.MustCompile("^(.+/)trackID=[0-9]+$")
|
||||
|
@@ -3,7 +3,7 @@ package auth
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
)
|
||||
|
||||
// GenerateWWWAuthenticate generates a WWW-Authenticate header.
|
||||
func GenerateWWWAuthenticate(methods []ValidateMethod, realm string, nonce string) base.HeaderValue {
|
||||
func GenerateWWWAuthenticate(methods []VerifyMethod, realm string, nonce string) base.HeaderValue {
|
||||
if methods == nil {
|
||||
// disable VerifyMethodDigestSHA256 unless explicitly set
|
||||
// since it prevents FFmpeg from authenticating
|
||||
@@ -19,13 +19,13 @@ func GenerateWWWAuthenticate(methods []ValidateMethod, realm string, nonce strin
|
||||
var a base.HeaderValue
|
||||
|
||||
switch m {
|
||||
case ValidateMethodBasic:
|
||||
case VerifyMethodBasic:
|
||||
a = headers.Authenticate{
|
||||
Method: headers.AuthMethodBasic,
|
||||
Realm: realm,
|
||||
}.Marshal()
|
||||
|
||||
case ValidateMethodDigestMD5:
|
||||
case VerifyMethodDigestMD5:
|
||||
aa := headers.AuthAlgorithmMD5
|
||||
a = headers.Authenticate{
|
||||
Method: headers.AuthMethodDigest,
|
||||
|
@@ -1,17 +0,0 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PathSplitQuery splits a path from a query.
|
||||
//
|
||||
// Deprecated: not useful anymore.
|
||||
func PathSplitQuery(pathAndQuery string) (string, string) {
|
||||
i := strings.Index(pathAndQuery, "?")
|
||||
if i >= 0 {
|
||||
return pathAndQuery[:i], pathAndQuery[i+1:]
|
||||
}
|
||||
|
||||
return pathAndQuery, ""
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPathSplitQuery(t *testing.T) {
|
||||
for _, ca := range []struct {
|
||||
a string
|
||||
b string
|
||||
c string
|
||||
}{
|
||||
{
|
||||
"test?a=b",
|
||||
"test",
|
||||
"a=b",
|
||||
},
|
||||
{
|
||||
"test",
|
||||
"test",
|
||||
"",
|
||||
},
|
||||
} {
|
||||
b, c := PathSplitQuery(ca.a)
|
||||
require.Equal(t, ca.b, b)
|
||||
require.Equal(t, ca.c, c)
|
||||
}
|
||||
}
|
@@ -74,23 +74,6 @@ func (u *URL) CloneWithoutCredentials() *URL {
|
||||
})
|
||||
}
|
||||
|
||||
// RTSPPathAndQuery returns the path and query of a RTSP URL.
|
||||
//
|
||||
// Deprecated: not useful anymore.
|
||||
func (u *URL) RTSPPathAndQuery() (string, bool) {
|
||||
var pathAndQuery string
|
||||
if u.RawPath != "" {
|
||||
pathAndQuery = u.RawPath
|
||||
} else {
|
||||
pathAndQuery = u.Path
|
||||
}
|
||||
if u.RawQuery != "" {
|
||||
pathAndQuery += "?" + u.RawQuery
|
||||
}
|
||||
|
||||
return pathAndQuery, true
|
||||
}
|
||||
|
||||
// Hostname returns u.Host, stripping any valid port number if present.
|
||||
//
|
||||
// If the result is enclosed in square brackets, as literal IPv6 addresses are,
|
||||
|
@@ -110,56 +110,3 @@ func TestURLCloneWithoutCredentials(t *testing.T) {
|
||||
Path: "/test/stream",
|
||||
}, u2)
|
||||
}
|
||||
|
||||
func TestURLRTSPPathAndQuery(t *testing.T) {
|
||||
for _, ca := range []struct {
|
||||
name string
|
||||
u *URL
|
||||
b string
|
||||
}{
|
||||
{
|
||||
"standard",
|
||||
mustParseURL("rtsp://localhost:8554/teststream/trackID=1"),
|
||||
"/teststream/trackID=1",
|
||||
},
|
||||
{
|
||||
"subpath",
|
||||
mustParseURL("rtsp://localhost:8554/test/stream/trackID=1"),
|
||||
"/test/stream/trackID=1",
|
||||
},
|
||||
{
|
||||
"path and query",
|
||||
mustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=1"),
|
||||
"/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
{
|
||||
"path and query with special chars",
|
||||
mustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
"/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
{
|
||||
"path and query attached",
|
||||
mustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
"/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
{
|
||||
"no path",
|
||||
mustParseURL("rtsp://192.168.1.99:554"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"single slash",
|
||||
mustParseURL("rtsp://192.168.1.99:554/"),
|
||||
"/",
|
||||
},
|
||||
{
|
||||
"no slash and query",
|
||||
mustParseURL("rtsp://192.168.1.99:554?testing"),
|
||||
"?testing",
|
||||
},
|
||||
} {
|
||||
b, ok := ca.u.RTSPPathAndQuery()
|
||||
require.Equal(t, true, ok)
|
||||
require.Equal(t, ca.b, b)
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
"bufio"
|
||||
"io"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
)
|
||||
|
||||
// Conn is a RTSP connection.
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
|
@@ -13,10 +13,10 @@ import (
|
||||
|
||||
psdp "github.com/pion/sdp/v3"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
)
|
||||
|
||||
func getAttribute(attributes []psdp.Attribute, key string) string {
|
||||
@@ -79,11 +79,6 @@ type Media struct {
|
||||
// Whether this media is a back channel.
|
||||
IsBackChannel bool
|
||||
|
||||
// Whether the transport is secure.
|
||||
//
|
||||
// Deprecated: replaced by Profile
|
||||
Secure bool
|
||||
|
||||
// RTP Profile.
|
||||
Profile headers.TransportProfile
|
||||
|
||||
@@ -109,10 +104,8 @@ func (m *Media) Unmarshal(md *psdp.MediaDescription) error {
|
||||
m.IsBackChannel = isBackChannel(md.Attributes)
|
||||
|
||||
if slices.Contains(md.MediaName.Protos, "SAVP") {
|
||||
m.Secure = true
|
||||
m.Profile = headers.TransportProfileSAVP
|
||||
} else {
|
||||
m.Secure = false
|
||||
m.Profile = headers.TransportProfileAVP
|
||||
}
|
||||
|
||||
@@ -154,22 +147,7 @@ func (m *Media) Unmarshal(md *psdp.MediaDescription) error {
|
||||
}
|
||||
|
||||
// Marshal encodes the media in SDP format.
|
||||
//
|
||||
// Deprecated: replaced by Marshal2.
|
||||
func (m Media) Marshal() *psdp.MediaDescription {
|
||||
ret, err := m.Marshal2()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Marshal2 encodes the media in SDP format.
|
||||
func (m Media) Marshal2() (*psdp.MediaDescription, error) {
|
||||
if m.Secure {
|
||||
m.Profile = headers.TransportProfileSAVP
|
||||
}
|
||||
|
||||
func (m Media) Marshal() (*psdp.MediaDescription, error) {
|
||||
var protos []string
|
||||
|
||||
if m.Profile == headers.TransportProfileSAVP {
|
||||
|
@@ -5,9 +5,9 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
|
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
psdp "github.com/pion/sdp/v3"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
)
|
||||
|
||||
func atLeastOneHasMID(medias []*Media) bool {
|
||||
@@ -141,8 +141,7 @@ func (d *Session) Unmarshal(ssd *sdp.SessionDescription) error {
|
||||
}
|
||||
|
||||
// Marshal encodes the description in SDP format.
|
||||
// The argument is deprecated and has no effect. Set Session.Multicast to enable multicast.
|
||||
func (d Session) Marshal(_ bool) ([]byte, error) {
|
||||
func (d Session) Marshal() ([]byte, error) {
|
||||
var sessionName psdp.SessionName
|
||||
if d.Title != "" {
|
||||
sessionName = psdp.SessionName(d.Title)
|
||||
@@ -200,7 +199,7 @@ func (d Session) Marshal(_ bool) ([]byte, error) {
|
||||
sout.MediaDescriptions = make([]*psdp.MediaDescription, len(d.Medias))
|
||||
|
||||
for i, media := range d.Medias {
|
||||
med, err := media.Marshal2()
|
||||
med, err := media.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -5,10 +5,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/mikey"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
)
|
||||
|
||||
var casesSession = []struct {
|
||||
@@ -313,7 +313,6 @@ var casesSession = []struct {
|
||||
Formats: []format.Format{
|
||||
&format.Opus{
|
||||
PayloadTyp: 111,
|
||||
IsStereo: false,
|
||||
ChannelCount: 1,
|
||||
},
|
||||
&format.Generic{
|
||||
@@ -726,7 +725,6 @@ var casesSession = []struct {
|
||||
{
|
||||
Type: "video",
|
||||
Control: "trackID=0",
|
||||
Secure: true,
|
||||
Profile: headers.TransportProfileSAVP,
|
||||
Formats: []format.Format{&format.H264{
|
||||
PayloadTyp: 96,
|
||||
@@ -763,7 +761,6 @@ var casesSession = []struct {
|
||||
{
|
||||
Type: "video",
|
||||
Control: "trackID=0",
|
||||
Secure: true,
|
||||
Profile: headers.TransportProfileSAVP,
|
||||
KeyMgmtMikey: &mikey.Message{ //nolint:dupl
|
||||
Header: mikey.Header{
|
||||
@@ -850,7 +847,7 @@ func TestSessionUnmarshal(t *testing.T) {
|
||||
func TestSessionMarshal(t *testing.T) {
|
||||
for _, ca := range casesSession {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
byts, err := ca.desc.Marshal(false)
|
||||
byts, err := ca.desc.Marshal()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ca.out, string(byts))
|
||||
})
|
||||
@@ -887,7 +884,6 @@ func TestSessionFindFormat(t *testing.T) {
|
||||
Formats: []format.Format{
|
||||
&format.Opus{
|
||||
PayloadTyp: 111,
|
||||
IsStereo: true,
|
||||
ChannelCount: 2,
|
||||
},
|
||||
},
|
||||
@@ -975,7 +971,7 @@ func FuzzSessionUnmarshal(f *testing.F) {
|
||||
|
||||
require.NotZero(t, len(desc.Medias))
|
||||
|
||||
_, err = desc.Marshal(false)
|
||||
_, err = desc.Marshal()
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpac3"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpac3"
|
||||
)
|
||||
|
||||
// AC3 is the RTP format for the AC-3 codec.
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpav1"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpav1"
|
||||
)
|
||||
|
||||
// AV1 is the RTP format for the AV1 codec.
|
||||
|
@@ -3,7 +3,7 @@ package format
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/sdp"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/sdp"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -638,7 +638,6 @@ var casesFormat = []struct {
|
||||
"a=fmtp:96 sprop-stereo=1\n",
|
||||
&Opus{
|
||||
PayloadTyp: 96,
|
||||
IsStereo: true,
|
||||
ChannelCount: 2,
|
||||
},
|
||||
96,
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtplpcm"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtplpcm"
|
||||
)
|
||||
|
||||
// G711 is the RTP format for the G711 codec, encoded with mu-law or A-law.
|
||||
|
@@ -3,7 +3,7 @@ package format
|
||||
import (
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpsimpleaudio"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpsimpleaudio"
|
||||
)
|
||||
|
||||
// G722 is the RTP format for the G722 codec.
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
)
|
||||
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtph265"
|
||||
)
|
||||
|
||||
// H265 is the RTP format for the H265 codec.
|
||||
|
@@ -3,7 +3,7 @@ package format
|
||||
import (
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpklv"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpklv"
|
||||
)
|
||||
|
||||
// KLV is the RTP format for KLV data.
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtplpcm"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtplpcm"
|
||||
)
|
||||
|
||||
// LPCM is the RTP format for the LPCM codec.
|
||||
|
@@ -3,7 +3,7 @@ package format //nolint:dupl
|
||||
import (
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmjpeg"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpmjpeg"
|
||||
)
|
||||
|
||||
// MJPEG is the RTP format for the Motion-JPEG codec.
|
||||
|
@@ -3,7 +3,7 @@ package format //nolint:dupl
|
||||
import (
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmpeg1audio"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpmpeg1audio"
|
||||
)
|
||||
|
||||
// MPEG1Audio is the RTP format for a MPEG-1/2 Audio codec.
|
||||
|
@@ -3,7 +3,7 @@ package format //nolint:dupl
|
||||
import (
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmpeg1video"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpmpeg1video"
|
||||
)
|
||||
|
||||
// MPEG1Video is the RTP format for a MPEG-1/2 Video codec.
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmpeg4audio"
|
||||
"github.com/bluenviron/gortsplib/v5/pkg/format/rtpmpeg4audio"
|
||||
)
|
||||
|
||||
// MPEG4Audio is the RTP format for a MPEG-4 Audio codec.
|
||||
@@ -197,10 +197,3 @@ func (f *MPEG4Audio) CreateEncoder() (*rtpmpeg4audio.Encoder, error) {
|
||||
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// GetConfig returns the MPEG-4 Audio configuration.
|
||||
//
|
||||
// Deprecated: redundant. Use f.Config.
|
||||
func (f *MPEG4Audio) GetConfig() *mpeg4audio.Config {
|
||||
return f.Config
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user