mirror of https://bitbucket.org/ausocean/av.git
Documentation comments
This commit is contained in:
parent
d4bfa08288
commit
6d5acb8941
|
@ -30,6 +30,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Interface for all filters.
|
||||||
type Filter interface {
|
type Filter interface {
|
||||||
io.WriteCloser
|
io.WriteCloser
|
||||||
//NB: Filter interface may evolve with more methods as required.
|
//NB: Filter interface may evolve with more methods as required.
|
||||||
|
|
|
@ -108,8 +108,7 @@ const (
|
||||||
QualityExcellent
|
QualityExcellent
|
||||||
)
|
)
|
||||||
|
|
||||||
// The different filter methods that can be used (currently these are all motion filters
|
// The different media filters.
|
||||||
// that will only send video with motion in it)
|
|
||||||
const (
|
const (
|
||||||
FilterNoOp = iota
|
FilterNoOp = iota
|
||||||
FilterMOG
|
FilterMOG
|
||||||
|
@ -255,7 +254,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.
|
||||||
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
|
PSITime int // Sets the time between a packet being sent
|
||||||
|
|
||||||
// RTMP ring buffer parameters.
|
// RTMP ring buffer parameters.
|
||||||
|
|
|
@ -328,13 +328,13 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
||||||
|
|
||||||
r.encoders = multiWriter(encoders...)
|
r.encoders = multiWriter(encoders...)
|
||||||
|
|
||||||
switch r.cfg.FilterMethod {
|
switch r.cfg.Filter {
|
||||||
case config.FilterNoOp:
|
case config.FilterNoOp:
|
||||||
r.filter = filter.NewNoOp(r.encoders)
|
r.filter = filter.NewNoOp(r.encoders)
|
||||||
case config.FilterMOG:
|
case config.FilterMOG:
|
||||||
r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)
|
r.filter = filter.NewMOGFilter(r.encoders, 25, 20, 500, 3, true)
|
||||||
default:
|
default:
|
||||||
r.filter = filter.NewNoOp(r.encoders)
|
panic("Undefined Filter")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch r.cfg.Input {
|
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())
|
r.cfg.Logger.Log(logger.Error, pkg+"failed to close pipeline", "error", err.Error())
|
||||||
}
|
}
|
||||||
err = r.filter.Close()
|
err = r.filter.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.cfg.Logger.Log(logger.Error, pkg+"failed to close pipeline", "error", err.Error())
|
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:
|
default:
|
||||||
r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
|
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}
|
m := map[string]int{"NoOp": config.FilterNoOp, "MOG": config.FilterMOG}
|
||||||
v, ok := m[value]
|
v, ok := m[value]
|
||||||
if !ok {
|
if !ok {
|
||||||
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value)
|
r.cfg.Logger.Log(logger.Warning, pkg+"invalid FilterMethod param", "value", value)
|
||||||
}
|
}
|
||||||
r.cfg.FilterMethod = v
|
r.cfg.Filter = 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 {
|
||||||
|
|
Loading…
Reference in New Issue