Merged in avdevice-name (pull request #284)

Added Name to AVDevice.

Approved-by: Saxon Milton <saxon.milton@gmail.com>
Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Alan Noble 2019-11-22 01:57:43 +00:00
commit 1c2329d3a5
6 changed files with 28 additions and 0 deletions

View File

@ -95,6 +95,11 @@ type OpenError error
// New initializes and returns an ALSA device which has its logger set as the given logger.
func New(l Logger) *ALSA { return &ALSA{l: l} }
// Name returns the name of the device.
func (d *ALSA) Name() string {
return "ALSA"
}
// Set will take a Config struct, check the validity of the relevant fields
// and then performs any configuration necessary. If fields are not valid,
// an error is added to the multiError and a default value is used.

View File

@ -38,6 +38,9 @@ import (
type AVDevice interface {
io.Reader
// Name returns the name of the AVDevice.
Name() string
// Set allows for configuration of the AVDevice using a Config struct. All,
// some or none of the fields of the Config struct may be used for configuration
// by an implementation. An implementation should specify what fields are

View File

@ -43,6 +43,11 @@ type AVFile struct {
// NewAVFile returns a new AVFile.
func New() *AVFile { return &AVFile{} }
// Name returns the name of the device.
func (m *AVFile) Name() string {
return "File"
}
// Set simply sets the AVFile's config to the passed config.
func (m *AVFile) Set(c config.Config) error {
m.cfg = c

View File

@ -97,6 +97,11 @@ type GeoVision struct {
// NewGeoVision returns a new GeoVision.
func New(l avconfig.Logger) *GeoVision { return &GeoVision{log: l} }
// Name returns the name of the device.
func (g *GeoVision) Name() string {
return "GeoVision"
}
// Set will take a Config struct, check the validity of the relevant fields
// and then performs any configuration necessary using config to control the
// GeoVision web interface. If fields are not valid, an error is added to the

View File

@ -114,6 +114,11 @@ type Raspivid struct {
// New returns a new Raspivid.
func New(l config.Logger) *Raspivid { return &Raspivid{log: l} }
// Name returns the name of the device.
func (r *Raspivid) Name() string {
return "Raspivid"
}
// Set will take a Config struct, check the validity of the relevant fields
// and then performs any configuration necessary. If fields are not valid,
// an error is added to the multiError and a default value is used.

View File

@ -71,6 +71,11 @@ func New(l config.Logger) *Webcam {
return &Webcam{log: l}
}
// Name returns the name of the device.
func (w *Webcam) Name() string {
return "Webcam"
}
// Set will validate the relevant fields of the given Config struct and assign
// the struct to the Webcam's Config. If fields are not valid, an error is
// added to the multiError and a default value is used.