From d5aa968a27075e3d1a324be260e02f4acdf1e9af Mon Sep 17 00:00:00 2001 From: Saxon Date: Sat, 2 Nov 2019 10:54:50 +1030 Subject: [PATCH] revid/geovision.go: created file geovision.go to hold geovision implementation of AVDevice and wrote Set function --- revid/geovision.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 revid/geovision.go diff --git a/revid/geovision.go b/revid/geovision.go new file mode 100644 index 00000000..bc24c478 --- /dev/null +++ b/revid/geovision.go @@ -0,0 +1,62 @@ +/* +DESCRIPTION + geovision.go + +AUTHORS + Saxon A. Nelson-Milton + +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 +}