Browse Source

rename "record" source value into "publisher"

pull/509/head
aler9 4 years ago committed by Alessandro Ros
parent
commit
fdd487f3c5
  1. 28
      internal/conf/path.go
  2. 8
      rtsp-simple-server.yml

28
internal/conf/path.go

@ -126,11 +126,11 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
} }
if pconf.Source == "" { if pconf.Source == "" {
pconf.Source = "record" pconf.Source = "publisher"
} }
switch { switch {
case pconf.Source == "record": case pconf.Source == "publisher":
case strings.HasPrefix(pconf.Source, "rtsp://") || case strings.HasPrefix(pconf.Source, "rtsp://") ||
strings.HasPrefix(pconf.Source, "rtsps://"): strings.HasPrefix(pconf.Source, "rtsps://"):
@ -207,8 +207,8 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
} }
if pconf.SourceOnDemand { if pconf.SourceOnDemand {
if pconf.Source == "record" { if pconf.Source == "publisher" {
return fmt.Errorf("'sourceOnDemand' is useless when source is 'record'") return fmt.Errorf("'sourceOnDemand' is useless when source is 'publisher'")
} }
} }
@ -239,8 +239,8 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
return fmt.Errorf("read username and password must be both filled") return fmt.Errorf("read username and password must be both filled")
} }
if pconf.PublishUser != "" { if pconf.PublishUser != "" {
if pconf.Source != "record" { if pconf.Source != "publisher" {
return fmt.Errorf("'publishUser' is useless when source is not 'record'") return fmt.Errorf("'publishUser' is useless when source is not 'publisher'")
} }
if !strings.HasPrefix(pconf.PublishUser, "sha256:") && !reUserPass.MatchString(pconf.PublishUser) { if !strings.HasPrefix(pconf.PublishUser, "sha256:") && !reUserPass.MatchString(pconf.PublishUser) {
@ -248,8 +248,8 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
} }
} }
if pconf.PublishPass != "" { if pconf.PublishPass != "" {
if pconf.Source != "record" { if pconf.Source != "publisher" {
return fmt.Errorf("'publishPass' is useless when source is not 'record', since the stream is not provided by a publisher, but by a fixed source") return fmt.Errorf("'publishPass' is useless when source is not 'publisher', since the stream is not provided by a publisher, but by a fixed source")
} }
if !strings.HasPrefix(pconf.PublishPass, "sha256:") && !reUserPass.MatchString(pconf.PublishPass) { if !strings.HasPrefix(pconf.PublishPass, "sha256:") && !reUserPass.MatchString(pconf.PublishPass) {
@ -265,8 +265,8 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
return nil, nil return nil, nil
} }
if pconf.Source != "record" { if pconf.Source != "publisher" {
return nil, fmt.Errorf("'publishIPs' is useless when source is not 'record', since the stream is not provided by a publisher, but by a fixed source") return nil, fmt.Errorf("'publishIPs' is useless when source is not 'publisher', since the stream is not provided by a publisher, but by a fixed source")
} }
return parseIPCidrList(pconf.PublishIPs) return parseIPCidrList(pconf.PublishIPs)
@ -302,12 +302,12 @@ func (pconf *PathConf) checkAndFillMissing(name string) error {
return fmt.Errorf("a path with a regular expression does not support option 'runOnInit'; use another path") return fmt.Errorf("a path with a regular expression does not support option 'runOnInit'; use another path")
} }
if pconf.RunOnPublish != "" && pconf.Source != "record" { if pconf.RunOnPublish != "" && pconf.Source != "publisher" {
return fmt.Errorf("'runOnPublish' is useless when source is not 'record', since the stream is not provided by a publisher, but by a fixed source") return fmt.Errorf("'runOnPublish' is useless when source is not 'publisher', since the stream is not provided by a publisher, but by a fixed source")
} }
if pconf.RunOnDemand != "" && pconf.Source != "record" { if pconf.RunOnDemand != "" && pconf.Source != "publisher" {
return fmt.Errorf("'runOnDemand' can be used only when source is 'record'") return fmt.Errorf("'runOnDemand' can be used only when source is 'publisher'")
} }
if pconf.RunOnDemandStartTimeout == 0 { if pconf.RunOnDemandStartTimeout == 0 {

8
rtsp-simple-server.yml

@ -125,12 +125,12 @@ hlsAllowOrigin: '*'
paths: paths:
all: all:
# source of the stream - this can be: # source of the stream - this can be:
# * record -> the stream is published by a RTSP or RTMP client # * publisher -> the stream is published by a RTSP or RTMP client
# * rtsp://existing-url -> the stream is pulled from another RTSP server # * rtsp://existing-url -> the stream is pulled from another RTSP server
# * rtsps://existing-url -> the stream is pulled from another RTSP server, with RTSPS # * rtsps://existing-url -> the stream is pulled from another RTSP server, with RTSPS
# * rtmp://existing-url -> the stream is pulled from a RTMP server # * rtmp://existing-url -> the stream is pulled from a RTMP server
# * redirect -> the stream is provided by another path or server # * redirect -> the stream is provided by another path or server
source: record source: publisher
# if the source is an RTSP or RTSPS URL, this is the protocol that will be used to # if the source is an RTSP or RTSPS URL, this is the protocol that will be used to
# pull the stream. available values are "automatic", "udp", "multicast", "tcp". # pull the stream. available values are "automatic", "udp", "multicast", "tcp".
@ -163,11 +163,11 @@ paths:
# redirected to. # redirected to.
sourceRedirect: sourceRedirect:
# if the source is "record" and a client is publishing, do not allow another # if the source is "publisher" and a client is publishing, do not allow another
# client to disconnect the former and publish in its place. # client to disconnect the former and publish in its place.
disablePublisherOverride: no disablePublisherOverride: no
# if the source is "record" and no one is publishing, redirect readers to this # if the source is "publisher" and no one is publishing, redirect readers to this
# path. It can be can be a relative path (i.e. /otherstream) or an absolute RTSP URL. # path. It can be can be a relative path (i.e. /otherstream) or an absolute RTSP URL.
fallback: fallback:

Loading…
Cancel
Save