change variable name FilterFrames to MotionFilter

This commit is contained in:
Ella Pietraroia 2020-01-22 14:57:35 +10:30
parent b597fb9a1a
commit 963b74bed0
3 changed files with 10 additions and 11 deletions

View File

@ -147,5 +147,4 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
}
}
return m.dst.Write(f)
}

View File

@ -85,7 +85,7 @@ const (
defaultClipDuration = 0
defaultAudioInputCodec = codecutil.ADPCM
defaultPSITime = 2
defaultFilterFrames = 1
defaultMotionInterval = 5
// Ring buffer defaults.
defaultRBMaxElements = 10000
@ -276,7 +276,7 @@ type Config struct {
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input.
Filters []int // Defines the methods of filtering to be used in between lexing and encoding.
FilterFrames int // Sets the number of frames that are held before the filter is used (on the nth frame)
MotionInterval int // Sets the number of frames that are held before the filter is used (on the nth frame)
PSITime int // Sets the time between a packet being sent.
// Ring buffer parameters.
@ -462,9 +462,9 @@ func (c *Config) Validate() error {
c.Logger.Log(logger.Info, pkg+"PSITime bad or unset, defaulting", "PSITime", defaultPSITime)
c.PSITime = defaultPSITime
}
if c.FilterFrames <= 0 {
c.Logger.Log(logger.Info, pkg+"FilterFrames bad or unset, defaulting", "FilterFrames", defaultFilterFrames)
c.FilterFrames = defaultFilterFrames
if c.MotionInterval <= 0 {
c.Logger.Log(logger.Info, pkg+"MotionInterval bad or unset, defaulting", "MotionInterval", defaultMotionInterval)
c.MotionInterval = defaultMotionInterval
}
if c.MinFPS <= 0 {

View File

@ -355,9 +355,9 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
case config.FilterNoOp:
r.filters[i] = filter.NewNoOp(dst)
case config.FilterMOG:
r.filters[i] = filter.NewMOGFilter(dst, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.FilterFrames)
r.filters[i] = filter.NewMOGFilter(dst, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.MotionInterval)
case config.FilterVariableFPS:
r.filters[i] = filter.NewVariableFPSFilter(dst, minFPS, filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.FilterFrames))
r.filters[i] = filter.NewVariableFPSFilter(dst, minFPS, filter.NewMOGFilter(r.encoders, mogMinArea, mogThreshold, mogHistory, r.cfg.ShowWindows, r.cfg.MotionInterval))
case config.FilterKNN:
r.filters[i] = filter.NewKNNFilter(dst, knnMinArea, knnThreshold, knnHistory, knnKernel, r.cfg.ShowWindows)
default:
@ -689,13 +689,13 @@ func (r *Revid) Update(vars map[string]string) error {
}
r.cfg.Filters[i] = v
}
case "FilterFrames":
case "MotionInterval":
v, err := strconv.Atoi(value)
if err != nil || v < 0 {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterFrames var", "value", value)
r.cfg.Logger.Log(logger.Warning, pkg+"invalid MotionInterval var", "value", value)
break
}
r.cfg.FilterFrames = v
r.cfg.MotionInterval = v
case "PSITime":
v, err := strconv.Atoi(value)
if err != nil || v < 0 {