diff --git a/device/alsa/alsa.go b/device/alsa/alsa.go index 57e1c88d..5f83d016 100644 --- a/device/alsa/alsa.go +++ b/device/alsa/alsa.go @@ -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. diff --git a/device/device.go b/device/device.go index 08739416..a75ccb0a 100644 --- a/device/device.go +++ b/device/device.go @@ -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 diff --git a/device/file/file.go b/device/file/file.go index 14a25b3b..3d990b93 100644 --- a/device/file/file.go +++ b/device/file/file.go @@ -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 diff --git a/device/geovision/geovision.go b/device/geovision/geovision.go index 492a05fb..10a82813 100644 --- a/device/geovision/geovision.go +++ b/device/geovision/geovision.go @@ -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 diff --git a/device/raspivid/raspivid.go b/device/raspivid/raspivid.go index 9502de4b..3c5ba7bc 100644 --- a/device/raspivid/raspivid.go +++ b/device/raspivid/raspivid.go @@ -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. diff --git a/device/webcam/webcam.go b/device/webcam/webcam.go index 163e6c11..256a3900 100644 --- a/device/webcam/webcam.go +++ b/device/webcam/webcam.go @@ -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.