mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-09-26 19:51:14 +08:00
Update dependencies and add audio format support
This commit is contained in:
6
go.mod
6
go.mod
@@ -3,7 +3,7 @@ module m7s.live/plugin/rtsp/v4
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bluenviron/gortsplib/v4 v4.2.2-0.20231023175953-d4bb674a5091
|
github.com/bluenviron/gortsplib/v4 v4.3.0
|
||||||
github.com/bluenviron/mediacommon v1.5.0
|
github.com/bluenviron/mediacommon v1.5.0
|
||||||
github.com/pion/rtp v1.8.2
|
github.com/pion/rtp v1.8.2
|
||||||
go.uber.org/zap v1.24.0
|
go.uber.org/zap v1.24.0
|
||||||
@@ -17,7 +17,7 @@ require (
|
|||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
||||||
github.com/google/uuid v1.3.1 // indirect
|
github.com/google/uuid v1.4.0 // indirect
|
||||||
github.com/logrusorgru/aurora/v4 v4.0.0 // indirect
|
github.com/logrusorgru/aurora/v4 v4.0.0 // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
|
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
|
||||||
github.com/mcuadros/go-defaults v1.2.0 // indirect
|
github.com/mcuadros/go-defaults v1.2.0 // indirect
|
||||||
@@ -46,4 +46,4 @@ require (
|
|||||||
golang.org/x/sys v0.13.0 // indirect
|
golang.org/x/sys v0.13.0 // indirect
|
||||||
golang.org/x/tools v0.9.1 // indirect
|
golang.org/x/tools v0.9.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
8
go.sum
8
go.sum
@@ -1,7 +1,7 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||||
github.com/bluenviron/gortsplib/v4 v4.2.2-0.20231023175953-d4bb674a5091 h1:VY+xh0y9kIrAqwuJHUOdS/ZdY2JPtNqzWtVN4QJr2Lo=
|
github.com/bluenviron/gortsplib/v4 v4.3.0 h1:wYtXickYP9zkCxbBIt2WEseQPX0wROB+K0DAew4Ls7g=
|
||||||
github.com/bluenviron/gortsplib/v4 v4.2.2-0.20231023175953-d4bb674a5091/go.mod h1:VOoeI2VxRKh5eEg6Y48DGb/oLxU1i+X0Xzv9z8dvsUQ=
|
github.com/bluenviron/gortsplib/v4 v4.3.0/go.mod h1:4XBcXsbK4MDFqnraexSDeKj++ZzrSd81CVplSpSNqKk=
|
||||||
github.com/bluenviron/mediacommon v1.5.0 h1:lS0YKNo22ZOyCsYcLh3jn3TgUALqYw0f7RVwalC09vI=
|
github.com/bluenviron/mediacommon v1.5.0 h1:lS0YKNo22ZOyCsYcLh3jn3TgUALqYw0f7RVwalC09vI=
|
||||||
github.com/bluenviron/mediacommon v1.5.0/go.mod h1:Ij/kE1LEucSjryNBVTyPL/gBI0d6/Css3f5PyrM957w=
|
github.com/bluenviron/mediacommon v1.5.0/go.mod h1:Ij/kE1LEucSjryNBVTyPL/gBI0d6/Css3f5PyrM957w=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
@@ -51,8 +51,8 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
|||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package rtsp
|
package rtsp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/bluenviron/gortsplib/v4"
|
"github.com/bluenviron/gortsplib/v4"
|
||||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||||
@@ -72,16 +74,22 @@ func (s *RTSPSubscriber) OnEvent(event any) {
|
|||||||
s.tracks = append(s.tracks, audio)
|
s.tracks = append(s.tracks, audio)
|
||||||
case codec.CodecID_PCMA:
|
case codec.CodecID_PCMA:
|
||||||
audio := &description.Media{
|
audio := &description.Media{
|
||||||
Type: description.MediaTypeAudio,
|
Type: description.MediaTypeAudio,
|
||||||
Formats: []format.Format{&format.G711{}},
|
Formats: []format.Format{&format.Generic{
|
||||||
|
PayloadTyp: v.PayloadType,
|
||||||
|
ClockRat: int(v.SampleRate),
|
||||||
|
RTPMa: fmt.Sprintf("PCMA/%d", v.SampleRate),
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
s.audioTrack = audio
|
s.audioTrack = audio
|
||||||
s.tracks = append(s.tracks, audio)
|
s.tracks = append(s.tracks, audio)
|
||||||
case codec.CodecID_PCMU:
|
case codec.CodecID_PCMU:
|
||||||
audio := &description.Media{
|
audio := &description.Media{
|
||||||
Type: description.MediaTypeAudio,
|
Type: description.MediaTypeAudio,
|
||||||
Formats: []format.Format{&format.G711{
|
Formats: []format.Format{&format.Generic{
|
||||||
MULaw: true,
|
PayloadTyp: v.PayloadType,
|
||||||
|
ClockRat: int(v.SampleRate),
|
||||||
|
RTPMa: fmt.Sprintf("PCMU/%d", v.SampleRate),
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
s.audioTrack = audio
|
s.audioTrack = audio
|
||||||
@@ -90,7 +98,7 @@ func (s *RTSPSubscriber) OnEvent(event any) {
|
|||||||
s.AddTrack(v)
|
s.AddTrack(v)
|
||||||
case ISubscriber:
|
case ISubscriber:
|
||||||
s.session = &description.Session{
|
s.session = &description.Session{
|
||||||
Medias: s.tracks,
|
Medias: s.tracks,
|
||||||
}
|
}
|
||||||
if s.server != nil {
|
if s.server != nil {
|
||||||
s.stream = gortsplib.NewServerStream(s.server, s.session)
|
s.stream = gortsplib.NewServerStream(s.server, s.session)
|
||||||
|
Reference in New Issue
Block a user