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