Documentation comments

This commit is contained in:
Ella Pietraroia 2019-12-23 11:59:17 +10:30
parent d4bfa08288
commit 6d5acb8941
3 changed files with 8 additions and 7 deletions

View File

@ -30,6 +30,7 @@ import (
"io"
)
// Interface for all filters.
type Filter interface {
io.WriteCloser
//NB: Filter interface may evolve with more methods as required.

View File

@ -108,8 +108,7 @@ const (
QualityExcellent
)
// The different filter methods that can be used (currently these are all motion filters
// that will only send video with motion in it)
// The different media filters.
const (
FilterNoOp = iota
FilterMOG
@ -255,7 +254,7 @@ type Config struct {
HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input.
VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input.
FilterMethod int // Defines the method of filtering to be used in between lexing and encoding
Filter int // Defines the method of filtering to be used in between lexing and encoding.
PSITime int // Sets the time between a packet being sent
// RTMP ring buffer parameters.

View File

@ -328,13 +328,13 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
r.encoders = multiWriter(encoders...)
switch r.cfg.FilterMethod {
switch r.cfg.Filter {
case config.FilterNoOp:
r.filter = filter.NewNoOp(r.encoders)
case config.FilterMOG:
r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)
default:
r.filter = filter.NewNoOp(r.encoders)
panic("Undefined Filter")
}
switch r.cfg.Input {
@ -451,6 +451,7 @@ func (r *Revid) Stop() {
r.cfg.Logger.Log(logger.Error, pkg+"failed to close pipeline", "error", err.Error())
}
err = r.filter.Close()
if err != nil {
r.cfg.Logger.Log(logger.Error, pkg+"failed to close pipeline", "error", err.Error())
}
@ -628,13 +629,13 @@ func (r *Revid) Update(vars map[string]string) error {
default:
r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
}
case "FilterMethod":
case "Filter":
m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG}
v, ok := m[value]
if !ok {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value)
}
r.cfg.FilterMethod = v
r.cfg.Filter = v
case "PSITime":
v, err := strconv.Atoi(value)
if err != nil || v < 0 {