mirror of https://bitbucket.org/ausocean/av.git
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:
commit
1c2329d3a5
|
@ -95,6 +95,11 @@ type OpenError error
|
||||||
// New initializes and returns an ALSA device which has its logger set as the given logger.
|
// 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} }
|
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
|
// Set will take a Config struct, check the validity of the relevant fields
|
||||||
// and then performs any configuration necessary. If fields are not valid,
|
// and then performs any configuration necessary. If fields are not valid,
|
||||||
// an error is added to the multiError and a default value is used.
|
// an error is added to the multiError and a default value is used.
|
||||||
|
|
|
@ -38,6 +38,9 @@ import (
|
||||||
type AVDevice interface {
|
type AVDevice interface {
|
||||||
io.Reader
|
io.Reader
|
||||||
|
|
||||||
|
// Name returns the name of the AVDevice.
|
||||||
|
Name() string
|
||||||
|
|
||||||
// Set allows for configuration of the AVDevice using a Config struct. All,
|
// 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
|
// 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
|
// by an implementation. An implementation should specify what fields are
|
||||||
|
|
|
@ -43,6 +43,11 @@ type AVFile struct {
|
||||||
// NewAVFile returns a new AVFile.
|
// NewAVFile returns a new AVFile.
|
||||||
func New() *AVFile { return &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.
|
// Set simply sets the AVFile's config to the passed config.
|
||||||
func (m *AVFile) Set(c config.Config) error {
|
func (m *AVFile) Set(c config.Config) error {
|
||||||
m.cfg = c
|
m.cfg = c
|
||||||
|
|
|
@ -97,6 +97,11 @@ type GeoVision struct {
|
||||||
// NewGeoVision returns a new GeoVision.
|
// NewGeoVision returns a new GeoVision.
|
||||||
func New(l avconfig.Logger) *GeoVision { return &GeoVision{log: l} }
|
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
|
// Set will take a Config struct, check the validity of the relevant fields
|
||||||
// and then performs any configuration necessary using config to control the
|
// 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
|
// GeoVision web interface. If fields are not valid, an error is added to the
|
||||||
|
|
|
@ -114,6 +114,11 @@ type Raspivid struct {
|
||||||
// New returns a new Raspivid.
|
// New returns a new Raspivid.
|
||||||
func New(l config.Logger) *Raspivid { return &Raspivid{log: l} }
|
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
|
// Set will take a Config struct, check the validity of the relevant fields
|
||||||
// and then performs any configuration necessary. If fields are not valid,
|
// and then performs any configuration necessary. If fields are not valid,
|
||||||
// an error is added to the multiError and a default value is used.
|
// an error is added to the multiError and a default value is used.
|
||||||
|
|
|
@ -71,6 +71,11 @@ func New(l config.Logger) *Webcam {
|
||||||
return &Webcam{log: l}
|
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
|
// 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
|
// 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.
|
// added to the multiError and a default value is used.
|
||||||
|
|
Loading…
Reference in New Issue