mirror of https://bitbucket.org/ausocean/av.git
revid/geovision.go: created file geovision.go to hold geovision implementation of AVDevice and wrote Set function
This commit is contained in:
parent
82903681ee
commit
d5aa968a27
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
DESCRIPTION
|
||||
geovision.go
|
||||
|
||||
AUTHORS
|
||||
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
||||
|
||||
LICENSE
|
||||
Copyright (C) 2017-2019 the Australian Ocean Lab (AusOcean)
|
||||
|
||||
It is free software: you can redistribute it and/or modify them
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||
*/
|
||||
|
||||
package revid
|
||||
|
||||
import ()
|
||||
|
||||
type GeoVision struct {}
|
||||
|
||||
func (g *GeoVision) Set(c Config) error {
|
||||
err := gvctrl.Set(
|
||||
r.config.CameraIP,
|
||||
gvctrl.Channel(r.config.CameraChan),
|
||||
gvctrl.CodecOut(
|
||||
map[uint8]gvctrl.Codec{
|
||||
codecutil.H264: gvctrl.CodecH264,
|
||||
codecutil.H265: gvctrl.CodecH265,
|
||||
codecutil.MJPEG: gvctrl.CodecMJPEG,
|
||||
}[r.config.InputCodec],
|
||||
),
|
||||
gvctrl.Height(int(r.config.Height)),
|
||||
gvctrl.FrameRate(int(r.config.FrameRate)),
|
||||
gvctrl.VariableBitrate(r.config.VBR),
|
||||
gvctrl.VBRQuality(
|
||||
map[quality]gvctrl.Quality{
|
||||
qualityStandard: gvctrl.QualityStandard,
|
||||
qualityFair: gvctrl.QualityFair,
|
||||
qualityGood: gvctrl.QualityGood,
|
||||
qualityGreat: gvctrl.QualityGreat,
|
||||
qualityExcellent: gvctrl.QualityExcellent,
|
||||
}[r.config.VBRQuality],
|
||||
),
|
||||
gvctrl.VBRBitrate(r.config.VBRBitrate),
|
||||
gvctrl.CBRBitrate(int(r.config.Bitrate)),
|
||||
gvctrl.Refresh(float64(r.config.MinFrames)/float64(r.config.FrameRate)),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not set IPCamera settings: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue