forbid using 'rpiCamera' as source on regexp paths

This commit is contained in:
aler9 2022-10-23 16:44:34 +02:00
parent e5ab731d14
commit ec4ec142b4
2 changed files with 9 additions and 4 deletions

View File

@ -110,7 +110,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "rtsp://") ||
strings.HasPrefix(pconf.Source, "rtsps://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTSP source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTSP source. use another path")
}
_, err := url.Parse(pconf.Source)
@ -121,7 +121,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "rtmp://") ||
strings.HasPrefix(pconf.Source, "rtmps://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTMP source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTMP source. use another path")
}
u, err := gourl.Parse(pconf.Source)
@ -141,7 +141,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "http://") ||
strings.HasPrefix(pconf.Source, "https://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a HLS source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a HLS source. use another path")
}
u, err := gourl.Parse(pconf.Source)
@ -172,6 +172,11 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
}
case pconf.Source == "rpiCamera":
if pconf.Regexp != nil {
return fmt.Errorf(
"a path with a regular expression (or path 'all') cannot have 'rpiCamera' as source. use another path")
}
if pconf.RPICameraWidth == 0 {
pconf.RPICameraWidth = 1280
}

View File

@ -14,7 +14,7 @@ readTimeout: 10s
# Timeout of write operations.
writeTimeout: 10s
# Number of read buffers.
# A higher number allows a wider throughput, a lower number allows to save RAM.
# A higher value allows a wider throughput, a lower value allows to save RAM.
readBufferCount: 512
# HTTP URL to perform external authentication.