mirror of https://bitbucket.org/ausocean/av.git
revid: remove ShowWindows variable
This commit is contained in:
parent
b6d6090e25
commit
86ec511697
|
@ -27,8 +27,6 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/codec/codecutil"
|
"bitbucket.org/ausocean/av/codec/codecutil"
|
||||||
|
@ -136,9 +134,6 @@ const (
|
||||||
FilterBasic
|
FilterBasic
|
||||||
)
|
)
|
||||||
|
|
||||||
// OS names
|
|
||||||
const raspian = "Raspbian GNU/Linux"
|
|
||||||
|
|
||||||
// Config provides parameters relevant to a revid instance. A new config must
|
// Config provides parameters relevant to a revid instance. A new config must
|
||||||
// be passed to the constructor. Default values for these fields are defined
|
// be passed to the constructor. Default values for these fields are defined
|
||||||
// as consts above.
|
// as consts above.
|
||||||
|
@ -259,10 +254,6 @@ type Config struct {
|
||||||
// of the file.
|
// of the file.
|
||||||
Exposure string
|
Exposure string
|
||||||
|
|
||||||
// ShowWindows enables or disables the display of windows used for debugging
|
|
||||||
// motion filters.
|
|
||||||
ShowWindows bool
|
|
||||||
|
|
||||||
// AutoWhiteBalance defines the auto white balance mode used by Raspivid input.
|
// AutoWhiteBalance defines the auto white balance mode used by Raspivid input.
|
||||||
// Valid modes are defined in the exported []string AutoWhiteBalanceModes
|
// Valid modes are defined in the exported []string AutoWhiteBalanceModes
|
||||||
// defined at the start of the file.
|
// defined at the start of the file.
|
||||||
|
@ -370,7 +361,6 @@ var TypeData = map[string]string{
|
||||||
"RTMPURL": "string",
|
"RTMPURL": "string",
|
||||||
"RTPAddress": "string",
|
"RTPAddress": "string",
|
||||||
"Saturation": "int",
|
"Saturation": "int",
|
||||||
"ShowWindows": "bool",
|
|
||||||
"VBRBitrate": "int",
|
"VBRBitrate": "int",
|
||||||
"VBRQuality": "enum:standard,fair,good,great,excellent",
|
"VBRQuality": "enum:standard,fair,good,great,excellent",
|
||||||
"VerticalFlip": "bool",
|
"VerticalFlip": "bool",
|
||||||
|
@ -554,17 +544,6 @@ func (c *Config) Validate() error {
|
||||||
c.MotionDownscaling = defaultMotionDownscaling
|
c.MotionDownscaling = defaultMotionDownscaling
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ShowWindows {
|
|
||||||
os, err := osName()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if os == raspian {
|
|
||||||
c.Logger.Log(logger.Info, pkg+"ShowWindows disabled on Raspbian GNU/Linux", "ShowWindows", false)
|
|
||||||
c.ShowWindows = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.FileFPS <= 0 || (c.FileFPS > 0 && c.Input != InputFile) {
|
if c.FileFPS <= 0 || (c.FileFPS > 0 && c.Input != InputFile) {
|
||||||
c.logInvalidField("FileFPS", defaultFileFPS)
|
c.logInvalidField("FileFPS", defaultFileFPS)
|
||||||
c.FileFPS = defaultFileFPS
|
c.FileFPS = defaultFileFPS
|
||||||
|
@ -573,15 +552,6 @@ func (c *Config) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func osName() (string, error) {
|
|
||||||
out, err := exec.Command("grep", "^NAME=", "/etc/os-release").Output()
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("could not get OS name: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(out)[6 : len(out)-2], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Config) logInvalidField(name string, def interface{}) {
|
func (c *Config) logInvalidField(name string, def interface{}) {
|
||||||
c.Logger.Log(logger.Info, pkg+name+" bad or unset, defaulting", name, def)
|
c.Logger.Log(logger.Info, pkg+name+" bad or unset, defaulting", name, def)
|
||||||
}
|
}
|
||||||
|
|
|
@ -804,16 +804,6 @@ func (r *Revid) Update(vars map[string]string) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
r.cfg.CameraChan = v
|
r.cfg.CameraChan = v
|
||||||
case "ShowWindows":
|
|
||||||
switch strings.ToLower(value) {
|
|
||||||
case "true":
|
|
||||||
r.cfg.ShowWindows = true
|
|
||||||
case "false":
|
|
||||||
r.cfg.ShowWindows = false
|
|
||||||
default:
|
|
||||||
r.cfg.Logger.Log(logger.Warning, pkg+"invalid ShowWindows var", "value", value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case "MinFPS":
|
case "MinFPS":
|
||||||
v, err := strconv.ParseFloat(value, 64)
|
v, err := strconv.ParseFloat(value, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue