mirror of
https://github.com/aler9/gortsplib
synced 2025-10-24 07:34:17 +08:00
remove deprecated functions
This commit is contained in:
27
client.go
27
client.go
@@ -207,11 +207,6 @@ type OnPacketRTCPFunc func(rtcp.Packet)
|
||||
// OnPacketRTCPAnyFunc is the prototype of the callback passed to OnPacketRTCPAny().
|
||||
type OnPacketRTCPAnyFunc func(*media.Media, rtcp.Packet)
|
||||
|
||||
// ClientLogFunc is the prototype of the log function.
|
||||
//
|
||||
// Deprecated: Log() is deprecated.
|
||||
type ClientLogFunc func(level LogLevel, format string, args ...interface{})
|
||||
|
||||
// Client is a RTSP client.
|
||||
type Client struct {
|
||||
//
|
||||
@@ -257,8 +252,6 @@ type Client struct {
|
||||
BytesReceived *uint64
|
||||
// pointer to a variable that stores sent bytes.
|
||||
BytesSent *uint64
|
||||
// Deprecated: disabling redirects doesn't improve security.
|
||||
RedirectDisable bool
|
||||
|
||||
//
|
||||
// system functions (all optional)
|
||||
@@ -283,8 +276,6 @@ type Client struct {
|
||||
OnPacketLost ClientOnPacketLostFunc
|
||||
// called when a non-fatal decode error occurs.
|
||||
OnDecodeError ClientOnDecodeErrorFunc
|
||||
// Deprecated: replaced by OnTransportSwitch, OnPacketLost, OnDecodeError
|
||||
Log ClientLogFunc
|
||||
|
||||
//
|
||||
// private
|
||||
@@ -383,29 +374,14 @@ func (c *Client) Start(scheme string, host string) error {
|
||||
c.OnResponse = func(*base.Response) {
|
||||
}
|
||||
}
|
||||
if c.Log != nil && c.OnTransportSwitch == nil {
|
||||
c.OnTransportSwitch = func(err error) {
|
||||
c.Log(LogLevelWarn, "%v", err)
|
||||
}
|
||||
}
|
||||
if c.OnTransportSwitch == nil {
|
||||
c.OnTransportSwitch = func(err error) {
|
||||
}
|
||||
}
|
||||
if c.Log != nil && c.OnPacketLost == nil {
|
||||
c.OnPacketLost = func(err error) {
|
||||
c.Log(LogLevelWarn, "%v", err)
|
||||
}
|
||||
}
|
||||
if c.OnPacketLost == nil {
|
||||
c.OnPacketLost = func(err error) {
|
||||
}
|
||||
}
|
||||
if c.Log != nil && c.OnDecodeError == nil {
|
||||
c.OnDecodeError = func(err error) {
|
||||
c.Log(LogLevelWarn, "%v", err)
|
||||
}
|
||||
}
|
||||
if c.OnDecodeError == nil {
|
||||
c.OnDecodeError = func(err error) {
|
||||
}
|
||||
@@ -1016,8 +992,7 @@ func (c *Client) doDescribe(u *url.URL) (media.Medias, *url.URL, *base.Response,
|
||||
|
||||
if res.StatusCode != base.StatusOK {
|
||||
// redirect
|
||||
if !c.RedirectDisable &&
|
||||
res.StatusCode >= base.StatusMovedPermanently &&
|
||||
if res.StatusCode >= base.StatusMovedPermanently &&
|
||||
res.StatusCode <= base.StatusUseProxy &&
|
||||
len(res.Header["Location"]) == 1 {
|
||||
c.reset()
|
||||
|
||||
16
loglevel.go
16
loglevel.go
@@ -1,16 +0,0 @@
|
||||
package gortsplib
|
||||
|
||||
// LogLevel is a log level.
|
||||
//
|
||||
// Deprecated: Log() is deprecated.
|
||||
type LogLevel int
|
||||
|
||||
// Log levels.
|
||||
//
|
||||
// Deprecated: Log() is deprecated.
|
||||
const (
|
||||
LogLevelDebug LogLevel = iota + 1
|
||||
LogLevelInfo
|
||||
LogLevelWarn
|
||||
LogLevelError
|
||||
)
|
||||
@@ -1,6 +1,7 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
@@ -10,6 +11,12 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/url"
|
||||
)
|
||||
|
||||
func md5Hex(in string) string {
|
||||
h := md5.New()
|
||||
h.Write([]byte(in))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
// GenerateNonce2 generates a nonce that can be used in Validate().
|
||||
func GenerateNonce2() (string, error) {
|
||||
byts := make([]byte, 16)
|
||||
@@ -21,17 +28,6 @@ func GenerateNonce2() (string, error) {
|
||||
return hex.EncodeToString(byts), nil
|
||||
}
|
||||
|
||||
// GenerateNonce generates a nonce that can be used in Validate().
|
||||
//
|
||||
// Deprecated: use GenerateNonce2.
|
||||
func GenerateNonce() string {
|
||||
v, err := GenerateNonce2()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// GenerateWWWAuthenticate generates a WWW-Authenticate header.
|
||||
func GenerateWWWAuthenticate(methods []headers.AuthMethod, realm string, nonce string) base.HeaderValue {
|
||||
if methods == nil {
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/headers"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/url"
|
||||
)
|
||||
|
||||
func md5Hex(in string) string {
|
||||
h := md5.New()
|
||||
h.Write([]byte(in))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func sha256Base64(in string) string {
|
||||
h := sha256.New()
|
||||
h.Write([]byte(in))
|
||||
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
// Validator allows to validate credentials generated by a Sender.
|
||||
//
|
||||
// Deprecated: Validator{} has been replaced by Validate()
|
||||
type Validator struct {
|
||||
user string
|
||||
userHashed bool
|
||||
pass string
|
||||
passHashed bool
|
||||
methods []headers.AuthMethod
|
||||
realm string
|
||||
nonce string
|
||||
}
|
||||
|
||||
// NewValidator allocates a Validator.
|
||||
// If methods is nil, the Basic and Digest methods are used.
|
||||
//
|
||||
// Deprecated: Validator{} has been replaced by Validate()
|
||||
func NewValidator(user string, pass string, methods []headers.AuthMethod) *Validator {
|
||||
if methods == nil {
|
||||
methods = []headers.AuthMethod{headers.AuthBasic, headers.AuthDigest}
|
||||
}
|
||||
|
||||
userHashed := false
|
||||
if strings.HasPrefix(user, "sha256:") {
|
||||
user = strings.TrimPrefix(user, "sha256:")
|
||||
userHashed = true
|
||||
}
|
||||
|
||||
passHashed := false
|
||||
if strings.HasPrefix(pass, "sha256:") {
|
||||
pass = strings.TrimPrefix(pass, "sha256:")
|
||||
passHashed = true
|
||||
}
|
||||
|
||||
// if credentials are hashed, only basic auth is supported
|
||||
if userHashed || passHashed {
|
||||
methods = []headers.AuthMethod{headers.AuthBasic}
|
||||
}
|
||||
|
||||
nonce := GenerateNonce()
|
||||
|
||||
return &Validator{
|
||||
user: user,
|
||||
userHashed: userHashed,
|
||||
pass: pass,
|
||||
passHashed: passHashed,
|
||||
methods: methods,
|
||||
realm: "IPCAM",
|
||||
nonce: nonce,
|
||||
}
|
||||
}
|
||||
|
||||
// Header generates the WWW-Authenticate header needed by a client to
|
||||
// authenticate.
|
||||
//
|
||||
// Deprecated: Validator{} has been replaced by Validate()
|
||||
func (va *Validator) Header() base.HeaderValue {
|
||||
var ret base.HeaderValue
|
||||
for _, m := range va.methods {
|
||||
switch m {
|
||||
case headers.AuthBasic:
|
||||
ret = append(ret, (&headers.Authenticate{
|
||||
Method: headers.AuthBasic,
|
||||
Realm: &va.realm,
|
||||
}).Marshal()...)
|
||||
|
||||
case headers.AuthDigest:
|
||||
ret = append(ret, headers.Authenticate{
|
||||
Method: headers.AuthDigest,
|
||||
Realm: &va.realm,
|
||||
Nonce: &va.nonce,
|
||||
}.Marshal()...)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// ValidateRequest validates a request sent by a client.
|
||||
//
|
||||
// Deprecated: Validator{} has been replaced by Validate()
|
||||
func (va *Validator) ValidateRequest(req *base.Request, baseURL *url.URL) error {
|
||||
var auth headers.Authorization
|
||||
err := auth.Unmarshal(req.Header["Authorization"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch auth.Method {
|
||||
case headers.AuthBasic:
|
||||
if !va.userHashed {
|
||||
if auth.BasicUser != va.user {
|
||||
return fmt.Errorf("wrong response")
|
||||
}
|
||||
} else {
|
||||
if sha256Base64(auth.BasicUser) != va.user {
|
||||
return fmt.Errorf("wrong response")
|
||||
}
|
||||
}
|
||||
|
||||
if !va.passHashed {
|
||||
if auth.BasicPass != va.pass {
|
||||
return fmt.Errorf("wrong response")
|
||||
}
|
||||
} else {
|
||||
if sha256Base64(auth.BasicPass) != va.pass {
|
||||
return fmt.Errorf("wrong response")
|
||||
}
|
||||
}
|
||||
|
||||
default: // headers.AuthDigest
|
||||
if auth.DigestValues.Realm == nil {
|
||||
return fmt.Errorf("realm is missing")
|
||||
}
|
||||
|
||||
if auth.DigestValues.Nonce == nil {
|
||||
return fmt.Errorf("nonce is missing")
|
||||
}
|
||||
|
||||
if auth.DigestValues.Username == nil {
|
||||
return fmt.Errorf("username is missing")
|
||||
}
|
||||
|
||||
if auth.DigestValues.URI == nil {
|
||||
return fmt.Errorf("uri is missing")
|
||||
}
|
||||
|
||||
if auth.DigestValues.Response == nil {
|
||||
return fmt.Errorf("response is missing")
|
||||
}
|
||||
|
||||
if *auth.DigestValues.Nonce != va.nonce {
|
||||
return fmt.Errorf("wrong nonce")
|
||||
}
|
||||
|
||||
if *auth.DigestValues.Realm != va.realm {
|
||||
return fmt.Errorf("wrong realm")
|
||||
}
|
||||
|
||||
if *auth.DigestValues.Username != va.user {
|
||||
return fmt.Errorf("wrong username")
|
||||
}
|
||||
|
||||
ur := req.URL
|
||||
|
||||
if *auth.DigestValues.URI != ur.String() {
|
||||
// in SETUP requests, VLC strips the control attribute.
|
||||
// try again with the base URL.
|
||||
if baseURL != nil {
|
||||
ur = baseURL
|
||||
if *auth.DigestValues.URI != ur.String() {
|
||||
return fmt.Errorf("wrong URL")
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("wrong URL")
|
||||
}
|
||||
}
|
||||
|
||||
response := md5Hex(md5Hex(va.user+":"+va.realm+":"+va.pass) +
|
||||
":" + va.nonce + ":" + md5Hex(string(req.Method)+":"+ur.String()))
|
||||
|
||||
if *auth.DigestValues.Response != response {
|
||||
return fmt.Errorf("wrong response")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
)
|
||||
|
||||
func TestValidatorErrors(t *testing.T) {
|
||||
for _, ca := range []struct {
|
||||
name string
|
||||
hv base.HeaderValue
|
||||
err string
|
||||
}{
|
||||
{
|
||||
"invalid auth",
|
||||
base.HeaderValue{`Invalid`},
|
||||
"invalid authorization header",
|
||||
},
|
||||
{
|
||||
"digest missing realm",
|
||||
base.HeaderValue{`Digest `},
|
||||
"realm is missing",
|
||||
},
|
||||
{
|
||||
"digest missing nonce",
|
||||
base.HeaderValue{`Digest realm=123`},
|
||||
"nonce is missing",
|
||||
},
|
||||
{
|
||||
"digest missing username",
|
||||
base.HeaderValue{`Digest realm=123,nonce=123`},
|
||||
"username is missing",
|
||||
},
|
||||
{
|
||||
"digest missing uri",
|
||||
base.HeaderValue{`Digest realm=123,nonce=123,username=123`},
|
||||
"uri is missing",
|
||||
},
|
||||
{
|
||||
"digest missing response",
|
||||
base.HeaderValue{`Digest realm=123,nonce=123,username=123,uri=123`},
|
||||
"response is missing",
|
||||
},
|
||||
{
|
||||
"digest wrong nonce",
|
||||
base.HeaderValue{`Digest realm=123,nonce=123,username=123,uri=123,response=123`},
|
||||
"wrong nonce",
|
||||
},
|
||||
{
|
||||
"digest wrong realm",
|
||||
base.HeaderValue{`Digest realm=123,nonce=abcde,username=123,uri=123,response=123`},
|
||||
"wrong realm",
|
||||
},
|
||||
} {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
va := NewValidator("myuser", "mypass", nil)
|
||||
va.nonce = "abcde"
|
||||
err := va.ValidateRequest(&base.Request{
|
||||
Method: base.Describe,
|
||||
URL: nil,
|
||||
Header: base.Header{
|
||||
"Authorization": ca.hv,
|
||||
},
|
||||
}, nil)
|
||||
require.EqualError(t, err, ca.err)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -60,13 +60,6 @@ func (f *AV1) Codec() string {
|
||||
return "AV1"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *AV1) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *AV1) ClockRate() int {
|
||||
return 90000
|
||||
@@ -104,14 +97,6 @@ func (f *AV1) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *AV1) CreateDecoder() *rtpav1.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *AV1) CreateDecoder2() (*rtpav1.Decoder, error) {
|
||||
d := &rtpav1.Decoder{}
|
||||
@@ -124,14 +109,6 @@ func (f *AV1) CreateDecoder2() (*rtpav1.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *AV1) CreateEncoder() *rtpav1.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *AV1) CreateEncoder2() (*rtpav1.Encoder, error) {
|
||||
e := &rtpav1.Encoder{
|
||||
|
||||
@@ -11,7 +11,7 @@ func TestAV1Attributes(t *testing.T) {
|
||||
format := &AV1{
|
||||
PayloadTyp: 100,
|
||||
}
|
||||
require.Equal(t, "AV1", format.String())
|
||||
require.Equal(t, "AV1", format.Codec())
|
||||
require.Equal(t, 90000, format.ClockRate())
|
||||
require.Equal(t, true, format.PTSEqualsDTS(&rtp.Packet{}))
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ type Format interface {
|
||||
// Codec returns the codec name.
|
||||
Codec() string
|
||||
|
||||
// Deprecated: replaced by Codec().
|
||||
String() string
|
||||
|
||||
// ClockRate returns the clock rate.
|
||||
ClockRate() int
|
||||
|
||||
|
||||
@@ -23,13 +23,6 @@ func (f *G711) Codec() string {
|
||||
return "G711"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *G711) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *G711) ClockRate() int {
|
||||
return 8000
|
||||
@@ -61,14 +54,6 @@ func (f *G711) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *G711) CreateDecoder() *rtpsimpleaudio.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *G711) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
d := &rtpsimpleaudio.Decoder{
|
||||
@@ -83,14 +68,6 @@ func (f *G711) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *G711) CreateEncoder() *rtpsimpleaudio.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *G711) CreateEncoder2() (*rtpsimpleaudio.Encoder, error) {
|
||||
e := &rtpsimpleaudio.Encoder{
|
||||
|
||||
@@ -19,13 +19,6 @@ func (f *G722) Codec() string {
|
||||
return "G722"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *G722) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *G722) ClockRate() int {
|
||||
return 8000
|
||||
@@ -51,14 +44,6 @@ func (f *G722) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *G722) CreateDecoder() *rtpsimpleaudio.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *G722) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
d := &rtpsimpleaudio.Decoder{
|
||||
@@ -73,14 +58,6 @@ func (f *G722) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *G722) CreateEncoder() *rtpsimpleaudio.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *G722) CreateEncoder2() (*rtpsimpleaudio.Encoder, error) {
|
||||
e := &rtpsimpleaudio.Encoder{
|
||||
|
||||
@@ -41,13 +41,6 @@ func (f *G726) Codec() string {
|
||||
return "G726"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *G726) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *G726) ClockRate() int {
|
||||
return 8000
|
||||
|
||||
@@ -80,13 +80,6 @@ func (f *Generic) Codec() string {
|
||||
return "Generic"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *Generic) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *Generic) ClockRate() int {
|
||||
return f.ClockRat
|
||||
|
||||
@@ -65,13 +65,6 @@ func (f *H264) Codec() string {
|
||||
return "H264"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *H264) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *H264) ClockRate() int {
|
||||
return 90000
|
||||
@@ -172,14 +165,6 @@ func (f *H264) PTSEqualsDTS(pkt *rtp.Packet) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *H264) CreateDecoder() *rtph264.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *H264) CreateDecoder2() (*rtph264.Decoder, error) {
|
||||
d := &rtph264.Decoder{
|
||||
@@ -194,14 +179,6 @@ func (f *H264) CreateDecoder2() (*rtph264.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *H264) CreateEncoder() *rtph264.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *H264) CreateEncoder2() (*rtph264.Encoder, error) {
|
||||
e := &rtph264.Encoder{
|
||||
|
||||
@@ -67,13 +67,6 @@ func (f *H265) Codec() string {
|
||||
return "H265"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *H265) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *H265) ClockRate() int {
|
||||
return 90000
|
||||
@@ -171,14 +164,6 @@ func (f *H265) PTSEqualsDTS(pkt *rtp.Packet) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *H265) CreateDecoder() *rtph265.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *H265) CreateDecoder2() (*rtph265.Decoder, error) {
|
||||
d := &rtph265.Decoder{
|
||||
@@ -193,14 +178,6 @@ func (f *H265) CreateDecoder2() (*rtph265.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *H265) CreateEncoder() *rtph265.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *H265) CreateEncoder2() (*rtph265.Encoder, error) {
|
||||
e := &rtph265.Encoder{
|
||||
|
||||
@@ -58,13 +58,6 @@ func (f *LPCM) Codec() string {
|
||||
return "LPCM"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *LPCM) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *LPCM) ClockRate() int {
|
||||
return f.SampleRate
|
||||
@@ -103,14 +96,6 @@ func (f *LPCM) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *LPCM) CreateDecoder() *rtplpcm.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *LPCM) CreateDecoder2() (*rtplpcm.Decoder, error) {
|
||||
d := &rtplpcm.Decoder{
|
||||
@@ -127,14 +112,6 @@ func (f *LPCM) CreateDecoder2() (*rtplpcm.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *LPCM) CreateEncoder() *rtplpcm.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *LPCM) CreateEncoder2() (*rtplpcm.Encoder, error) {
|
||||
e := &rtplpcm.Encoder{
|
||||
|
||||
@@ -19,13 +19,6 @@ func (f *MJPEG) Codec() string {
|
||||
return "M-JPEG"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MJPEG) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MJPEG) ClockRate() int {
|
||||
return 90000
|
||||
@@ -51,14 +44,6 @@ func (f *MJPEG) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *MJPEG) CreateDecoder() *rtpmjpeg.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *MJPEG) CreateDecoder2() (*rtpmjpeg.Decoder, error) {
|
||||
d := &rtpmjpeg.Decoder{}
|
||||
@@ -71,14 +56,6 @@ func (f *MJPEG) CreateDecoder2() (*rtpmjpeg.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *MJPEG) CreateEncoder() *rtpmjpeg.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *MJPEG) CreateEncoder2() (*rtpmjpeg.Encoder, error) {
|
||||
e := &rtpmjpeg.Encoder{}
|
||||
|
||||
@@ -19,13 +19,6 @@ func (f *MPEG1Audio) Codec() string {
|
||||
return "MPEG-1/2 Audio"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEG1Audio) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEG1Audio) ClockRate() int {
|
||||
return 90000
|
||||
@@ -51,14 +44,6 @@ func (f *MPEG1Audio) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *MPEG1Audio) CreateDecoder() *rtpmpeg1audio.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *MPEG1Audio) CreateDecoder2() (*rtpmpeg1audio.Decoder, error) {
|
||||
d := &rtpmpeg1audio.Decoder{}
|
||||
@@ -71,14 +56,6 @@ func (f *MPEG1Audio) CreateDecoder2() (*rtpmpeg1audio.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *MPEG1Audio) CreateEncoder() *rtpmpeg1audio.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *MPEG1Audio) CreateEncoder2() (*rtpmpeg1audio.Encoder, error) {
|
||||
e := &rtpmpeg1audio.Encoder{}
|
||||
@@ -90,8 +67,3 @@ func (f *MPEG1Audio) CreateEncoder2() (*rtpmpeg1audio.Encoder, error) {
|
||||
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// MPEG2Audio is an alias for MPEG1Audio.
|
||||
//
|
||||
// Deprecated: replaced by MPEG1Audio.
|
||||
type MPEG2Audio = MPEG1Audio
|
||||
|
||||
@@ -17,13 +17,6 @@ func (f *MPEG1Video) Codec() string {
|
||||
return "MPEG-1/2 Video"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEG1Video) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEG1Video) ClockRate() int {
|
||||
return 90000
|
||||
@@ -48,8 +41,3 @@ func (f *MPEG1Video) FMTP() map[string]string {
|
||||
func (f *MPEG1Video) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// MPEG2Video is an alias for MPEG1Video.
|
||||
//
|
||||
// Deprecated: replaced by MPEG1Video.
|
||||
type MPEG2Video = MPEG1Video
|
||||
|
||||
@@ -103,13 +103,6 @@ func (f *MPEG4AudioGeneric) Codec() string {
|
||||
return "MPEG-4 Audio"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEG4AudioGeneric) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEG4AudioGeneric) ClockRate() int {
|
||||
return f.Config.SampleRate
|
||||
@@ -176,14 +169,6 @@ func (f *MPEG4AudioGeneric) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *MPEG4AudioGeneric) CreateDecoder() *rtpmpeg4audio.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *MPEG4AudioGeneric) CreateDecoder2() (*rtpmpeg4audio.Decoder, error) {
|
||||
d := &rtpmpeg4audio.Decoder{
|
||||
@@ -201,14 +186,6 @@ func (f *MPEG4AudioGeneric) CreateDecoder2() (*rtpmpeg4audio.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *MPEG4AudioGeneric) CreateEncoder() *rtpmpeg4audio.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *MPEG4AudioGeneric) CreateEncoder2() (*rtpmpeg4audio.Encoder, error) {
|
||||
e := &rtpmpeg4audio.Encoder{
|
||||
|
||||
@@ -90,13 +90,6 @@ func (f *MPEG4AudioLATM) Codec() string {
|
||||
return "MPEG-4 Audio"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEG4AudioLATM) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEG4AudioLATM) ClockRate() int {
|
||||
return f.Config.Programs[0].Layers[0].AudioSpecificConfig.SampleRate
|
||||
@@ -164,14 +157,6 @@ func (f *MPEG4AudioLATM) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *MPEG4AudioLATM) CreateDecoder() *rtpmpeg4audiolatm.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *MPEG4AudioLATM) CreateDecoder2() (*rtpmpeg4audiolatm.Decoder, error) {
|
||||
d := &rtpmpeg4audiolatm.Decoder{
|
||||
@@ -186,14 +171,6 @@ func (f *MPEG4AudioLATM) CreateDecoder2() (*rtpmpeg4audiolatm.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *MPEG4AudioLATM) CreateEncoder() *rtpmpeg4audiolatm.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *MPEG4AudioLATM) CreateEncoder2() (*rtpmpeg4audiolatm.Encoder, error) {
|
||||
e := &rtpmpeg4audiolatm.Encoder{
|
||||
|
||||
@@ -56,13 +56,6 @@ func (f *MPEG4VideoES) Codec() string {
|
||||
return "MPEG-4 Video"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEG4VideoES) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEG4VideoES) ClockRate() int {
|
||||
return 90000
|
||||
@@ -93,14 +86,6 @@ func (f *MPEG4VideoES) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *MPEG4VideoES) CreateDecoder() *rtpmpeg4video.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *MPEG4VideoES) CreateDecoder2() (*rtpmpeg4video.Decoder, error) {
|
||||
d := &rtpmpeg4video.Decoder{}
|
||||
@@ -113,14 +98,6 @@ func (f *MPEG4VideoES) CreateDecoder2() (*rtpmpeg4video.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *MPEG4VideoES) CreateEncoder() *rtpmpeg4video.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *MPEG4VideoES) CreateEncoder2() (*rtpmpeg4video.Encoder, error) {
|
||||
e := &rtpmpeg4video.Encoder{
|
||||
|
||||
@@ -17,13 +17,6 @@ func (f *MPEGTS) Codec() string {
|
||||
return "MPEG-TS"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *MPEGTS) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *MPEGTS) ClockRate() int {
|
||||
return 90000
|
||||
|
||||
@@ -49,13 +49,6 @@ func (f *Opus) Codec() string {
|
||||
return "Opus"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *Opus) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *Opus) ClockRate() int {
|
||||
// RFC7587: the RTP timestamp is incremented with a 48000 Hz
|
||||
@@ -93,14 +86,6 @@ func (f *Opus) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *Opus) CreateDecoder() *rtpsimpleaudio.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *Opus) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
d := &rtpsimpleaudio.Decoder{
|
||||
@@ -115,14 +100,6 @@ func (f *Opus) CreateDecoder2() (*rtpsimpleaudio.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *Opus) CreateEncoder() *rtpsimpleaudio.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *Opus) CreateEncoder2() (*rtpsimpleaudio.Encoder, error) {
|
||||
e := &rtpsimpleaudio.Encoder{
|
||||
|
||||
@@ -51,13 +51,6 @@ func (d *Decoder) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode decodes OBUs from a RTP packet.
|
||||
//
|
||||
// Deprecated: this method returns incomplete temporal units.
|
||||
func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
return d.decodeOBUs(pkt)
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeOBUs(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
var av1header codecs.AV1Packet
|
||||
_, err := av1header.Unmarshal(pkt.Payload)
|
||||
|
||||
@@ -59,13 +59,6 @@ func (d *Decoder) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode decodes NALUs from a RTP packet.
|
||||
//
|
||||
// Deprecated: this method returns incomplete access units.
|
||||
func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
return d.decodeNALUs(pkt)
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeNALUs(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
if len(pkt.Payload) < 1 {
|
||||
d.fragments = d.fragments[:0] // discard pending fragments
|
||||
|
||||
@@ -57,13 +57,6 @@ func (d *Decoder) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode decodes NALUs from a RTP packet.
|
||||
//
|
||||
// Deprecated: this method returns incomplete access units.
|
||||
func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
return d.decodeNALUs(pkt)
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeNALUs(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||
if len(pkt.Payload) < 2 {
|
||||
d.fragments = d.fragments[:0] // discard pending fragments
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Package rtpmpeg2audio contains a RTP/MPEG-1/2 Audio decoder and encoder.
|
||||
package rtpmpeg2audio
|
||||
|
||||
import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/formats/rtpmpeg1audio"
|
||||
)
|
||||
|
||||
// ErrMorePacketsNeeded is an alis for rtpmpeg1audio.ErrMorePacketsNeeded.
|
||||
//
|
||||
// Deprecated: replaced by rtpmpeg1audio.ErrMorePacketsNeeded.
|
||||
var ErrMorePacketsNeeded = rtpmpeg1audio.ErrMorePacketsNeeded
|
||||
|
||||
// ErrNonStartingPacketAndNoPrevious is an alis for rtpmpeg1audio.ErrNonStartingPacketAndNoPrevious.
|
||||
//
|
||||
// Deprecated: replaced by rtpmpeg1audio.ErrNonStartingPacketAndNoPrevious.
|
||||
var ErrNonStartingPacketAndNoPrevious = rtpmpeg1audio.ErrNonStartingPacketAndNoPrevious
|
||||
|
||||
// Decoder is an alis for rtpmpeg1audio.Decoder.
|
||||
//
|
||||
// Deprecated: replaced by rtpmpeg1audio.Decoder.
|
||||
type Decoder = rtpmpeg1audio.Decoder
|
||||
|
||||
// Encoder is an alis for rtpmpeg1audio.Encoder.
|
||||
//
|
||||
// Deprecated: replaced by rtpmpeg1audio.Encoder.
|
||||
type Encoder = rtpmpeg1audio.Encoder
|
||||
@@ -61,13 +61,6 @@ func (f *Vorbis) Codec() string {
|
||||
return "Vorbis"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *Vorbis) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *Vorbis) ClockRate() int {
|
||||
return f.SampleRate
|
||||
|
||||
@@ -50,13 +50,6 @@ func (f *VP8) Codec() string {
|
||||
return "VP8"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *VP8) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *VP8) ClockRate() int {
|
||||
return 90000
|
||||
@@ -92,14 +85,6 @@ func (f *VP8) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *VP8) CreateDecoder() *rtpvp8.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *VP8) CreateDecoder2() (*rtpvp8.Decoder, error) {
|
||||
d := &rtpvp8.Decoder{}
|
||||
@@ -112,14 +97,6 @@ func (f *VP8) CreateDecoder2() (*rtpvp8.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *VP8) CreateEncoder() *rtpvp8.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *VP8) CreateEncoder2() (*rtpvp8.Encoder, error) {
|
||||
e := &rtpvp8.Encoder{
|
||||
|
||||
@@ -60,13 +60,6 @@ func (f *VP9) Codec() string {
|
||||
return "VP9"
|
||||
}
|
||||
|
||||
// String implements Format.
|
||||
//
|
||||
// Deprecated: replaced by Codec().
|
||||
func (f *VP9) String() string {
|
||||
return f.Codec()
|
||||
}
|
||||
|
||||
// ClockRate implements Format.
|
||||
func (f *VP9) ClockRate() int {
|
||||
return 90000
|
||||
@@ -104,14 +97,6 @@ func (f *VP9) PTSEqualsDTS(*rtp.Packet) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CreateDecoder creates a decoder able to decode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateDecoder2() that can also return an error.
|
||||
func (f *VP9) CreateDecoder() *rtpvp9.Decoder {
|
||||
d, _ := f.CreateDecoder2()
|
||||
return d
|
||||
}
|
||||
|
||||
// CreateDecoder2 creates a decoder able to decode the content of the format.
|
||||
func (f *VP9) CreateDecoder2() (*rtpvp9.Decoder, error) {
|
||||
d := &rtpvp9.Decoder{}
|
||||
@@ -124,14 +109,6 @@ func (f *VP9) CreateDecoder2() (*rtpvp9.Decoder, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// CreateEncoder creates an encoder able to encode the content of the format.
|
||||
//
|
||||
// Deprecated: this has been replaced by CreateEncoder2() that can also return an error.
|
||||
func (f *VP9) CreateEncoder() *rtpvp9.Encoder {
|
||||
e, _ := f.CreateEncoder2()
|
||||
return e
|
||||
}
|
||||
|
||||
// CreateEncoder2 creates an encoder able to encode the content of the format.
|
||||
func (f *VP9) CreateEncoder2() (*rtpvp9.Encoder, error) {
|
||||
e := &rtpvp9.Encoder{
|
||||
|
||||
@@ -194,21 +194,6 @@ type ServerHandlerOnSetParameter interface {
|
||||
OnSetParameter(*ServerHandlerOnSetParameterCtx) (*base.Response, error)
|
||||
}
|
||||
|
||||
// ServerHandlerOnWarningCtx is the context of OnWarning.
|
||||
//
|
||||
// Deprecated: ServerHandlerOnWarning is deprecated.
|
||||
type ServerHandlerOnWarningCtx struct {
|
||||
Session *ServerSession
|
||||
Error error
|
||||
}
|
||||
|
||||
// ServerHandlerOnWarning can be implemented by a ServerHandler.
|
||||
//
|
||||
// Deprecated: replaced by OnPacketLost, OnDecodeError.
|
||||
type ServerHandlerOnWarning interface {
|
||||
OnWarning(*ServerHandlerOnWarningCtx)
|
||||
}
|
||||
|
||||
// ServerHandlerOnPacketLostCtx is the context of OnPacketLost.
|
||||
type ServerHandlerOnPacketLostCtx struct {
|
||||
Session *ServerSession
|
||||
|
||||
@@ -251,11 +251,6 @@ func (ss *ServerSession) onPacketLost(err error) {
|
||||
Session: ss,
|
||||
Error: err,
|
||||
})
|
||||
} else if h, ok := ss.s.Handler.(ServerHandlerOnWarning); ok {
|
||||
h.OnWarning(&ServerHandlerOnWarningCtx{
|
||||
Session: ss,
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,11 +260,6 @@ func (ss *ServerSession) onDecodeError(err error) {
|
||||
Session: ss,
|
||||
Error: err,
|
||||
})
|
||||
} else if h, ok := ss.s.Handler.(ServerHandlerOnWarning); ok {
|
||||
h.OnWarning(&ServerHandlerOnWarningCtx{
|
||||
Session: ss,
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user