revid: created CameraChan config field to allow selection of GeoVision camera channel

This commit is contained in:
Saxon 2019-10-25 12:12:30 +10:30
parent f74e3a3d7c
commit f1c0fc1dbf
3 changed files with 17 additions and 0 deletions

View File

@ -118,6 +118,7 @@ const (
defaultVBRQuality = qualityStandard defaultVBRQuality = qualityStandard
defaultBurstPeriod = 10 // Seconds defaultBurstPeriod = 10 // Seconds
defaultVBRBitrate = 500 // kbps defaultVBRBitrate = 500 // kbps
defaultCameraChan = 2
// Raspivid video defaults. // Raspivid video defaults.
defaultBrightness = 50 defaultBrightness = 50
@ -241,6 +242,9 @@ type Config struct {
// variable bitrate. // variable bitrate.
VBRBitrate int VBRBitrate int
// This is the channel we're using for the GeoVision camera.
CameraChan int
// MinFrames defines the frequency of key NAL units SPS, PPS and IDR in // MinFrames defines the frequency of key NAL units SPS, PPS and IDR in
// number of NAL units. This will also determine the frequency of PSI if the // number of NAL units. This will also determine the frequency of PSI if the
// output container is MPEG-TS. If ClipDuration is less than MinFrames, // output container is MPEG-TS. If ClipDuration is less than MinFrames,
@ -525,6 +529,11 @@ func (c *Config) Validate() error {
c.VBRBitrate = defaultVBRBitrate c.VBRBitrate = defaultVBRBitrate
} }
if c.CameraChan != 1 && c.CameraChan != 2 {
c.Logger.Log(logger.Info, pkg+"CamChan bad or unset, defaulting", "CamChan", defaultCameraChan)
c.CameraChan = defaultCameraChan
}
return nil return nil
} }

View File

@ -188,6 +188,7 @@ func (r *Revid) startRTSPCamera() (func() error, error) {
err := gvctrl.Set( err := gvctrl.Set(
r.config.CameraIP, r.config.CameraIP,
gvctrl.Channel(r.config.CameraChan),
gvctrl.CodecOut( gvctrl.CodecOut(
map[uint8]gvctrl.Codec{ map[uint8]gvctrl.Codec{
codecutil.H264: gvctrl.CodecH264, codecutil.H264: gvctrl.CodecH264,

View File

@ -645,6 +645,13 @@ func (r *Revid) Update(vars map[string]string) error {
break break
} }
r.config.VBRBitrate = v r.config.VBRBitrate = v
case "CameraChan":
v, err := strconv.Atoi(value)
if err != nil || (v != 1 && v != 2) {
r.config.Logger.Log(logger.Warning, pkg+"invalid CameraChan var", "value", value)
break
}
r.config.CameraChan = v
} }
} }
r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config)) r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config))