allow using MTX_QUERY inside source (#3486)

this allows to pass query parameters to sources, for instance:

source: rtsp://my_host/my_path?$MTX_QUERY
sourceOnDemand: true
This commit is contained in:
Alessandro Ros 2024-06-18 22:10:26 +02:00 committed by GitHub
parent dfa2e81e61
commit 65d90f7cc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 118 additions and 106 deletions

View file

@ -45,9 +45,8 @@ type packetConn interface {
// Source is a UDP static source.
type Source struct {
ResolvedSource string
ReadTimeout conf.StringDuration
Parent defs.StaticSourceParent
ReadTimeout conf.StringDuration
Parent defs.StaticSourceParent
}
// Log implements logger.Writer.
@ -59,7 +58,7 @@ func (s *Source) Log(level logger.Level, format string, args ...interface{}) {
func (s *Source) Run(params defs.StaticSourceRunParams) error {
s.Log(logger.Debug, "connecting")
hostPort := s.ResolvedSource[len("udp://"):]
hostPort := params.ResolvedSource[len("udp://"):]
addr, err := net.ResolveUDPAddr("udp", hostPort)
if err != nil {