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) return m.dst.Write(f)
} }

View File

@ -85,7 +85,7 @@ const (
defaultClipDuration = 0 defaultClipDuration = 0
defaultAudioInputCodec = codecutil.ADPCM defaultAudioInputCodec = codecutil.ADPCM
defaultPSITime = 2 defaultPSITime = 2
defaultFilterFrames = 1 defaultMotionInterval = 5
// Ring buffer defaults. // Ring buffer defaults.
defaultRBMaxElements = 10000 defaultRBMaxElements = 10000
@ -276,7 +276,7 @@ type Config struct {
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input. HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
VerticalFlip bool // VerticalFlip flips video vertically 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. 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. PSITime int // Sets the time between a packet being sent.
// Ring buffer parameters. // 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.Logger.Log(logger.Info, pkg+"PSITime bad or unset, defaulting", "PSITime", defaultPSITime)
c.PSITime = defaultPSITime c.PSITime = defaultPSITime
} }
if c.FilterFrames <= 0 { if c.MotionInterval <= 0 {
c.Logger.Log(logger.Info, pkg+"FilterFrames bad or unset, defaulting", "FilterFrames", defaultFilterFrames) c.Logger.Log(logger.Info, pkg+"MotionInterval bad or unset, defaulting", "MotionInterval", defaultMotionInterval)
c.FilterFrames = defaultFilterFrames c.MotionInterval = defaultMotionInterval
} }
if c.MinFPS <= 0 { 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: case config.FilterNoOp:
r.filters[i] = filter.NewNoOp(dst) r.filters[i] = filter.NewNoOp(dst)
case config.FilterMOG: 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: 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: case config.FilterKNN:
r.filters[i] = filter.NewKNNFilter(dst, knnMinArea, knnThreshold, knnHistory, knnKernel, r.cfg.ShowWindows) r.filters[i] = filter.NewKNNFilter(dst, knnMinArea, knnThreshold, knnHistory, knnKernel, r.cfg.ShowWindows)
default: default:
@ -689,13 +689,13 @@ func (r *Revid) Update(vars map[string]string) error {
} }
r.cfg.Filters[i] = v r.cfg.Filters[i] = v
} }
case "FilterFrames": case "MotionInterval":
v, err := strconv.Atoi(value) v, err := strconv.Atoi(value)
if err != nil || v < 0 { 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 break
} }
r.cfg.FilterFrames = v r.cfg.MotionInterval = v
case "PSITime": case "PSITime":
v, err := strconv.Atoi(value) v, err := strconv.Atoi(value)
if err != nil || v < 0 { if err != nil || v < 0 {