mirror of https://bitbucket.org/ausocean/av.git
revid/config/variables.go: exported config map key constants
This commit is contained in:
parent
13ea99b63b
commit
80bf76f703
revid/config
|
@ -39,57 +39,57 @@ import (
|
||||||
|
|
||||||
// Config map keys.
|
// Config map keys.
|
||||||
const (
|
const (
|
||||||
keyAutoWhiteBalance = "AutoWhiteBalance"
|
KeyAutoWhiteBalance = "AutoWhiteBalance"
|
||||||
keyBitDepth = "BitDepth"
|
KeyBitDepth = "BitDepth"
|
||||||
keyBitrate = "Bitrate"
|
KeyBitrate = "Bitrate"
|
||||||
keyBrightness = "Brightness"
|
KeyBrightness = "Brightness"
|
||||||
keyBurstPeriod = "BurstPeriod"
|
KeyBurstPeriod = "BurstPeriod"
|
||||||
keyCameraChan = "CameraChan"
|
KeyCameraChan = "CameraChan"
|
||||||
keyCameraIP = "CameraIP"
|
KeyCameraIP = "CameraIP"
|
||||||
keyCBR = "CBR"
|
KeyCBR = "CBR"
|
||||||
keyClipDuration = "ClipDuration"
|
KeyClipDuration = "ClipDuration"
|
||||||
keyChannels = "Channels"
|
KeyChannels = "Channels"
|
||||||
keyExposure = "Exposure"
|
KeyExposure = "Exposure"
|
||||||
keyFileFPS = "FileFPS"
|
KeyFileFPS = "FileFPS"
|
||||||
keyFilters = "Filters"
|
KeyFilters = "Filters"
|
||||||
keyFrameRate = "FrameRate"
|
KeyFrameRate = "FrameRate"
|
||||||
keyHeight = "Height"
|
KeyHeight = "Height"
|
||||||
keyHorizontalFlip = "HorizontalFlip"
|
KeyHorizontalFlip = "HorizontalFlip"
|
||||||
keyHTTPAddress = "HTTPAddress"
|
KeyHTTPAddress = "HTTPAddress"
|
||||||
keyInput = "Input"
|
KeyInput = "Input"
|
||||||
keyInputCodec = "InputCodec"
|
KeyInputCodec = "InputCodec"
|
||||||
keyInputPath = "InputPath"
|
KeyInputPath = "InputPath"
|
||||||
keyLogging = "logging"
|
KeyLogging = "logging"
|
||||||
keyLoop = "Loop"
|
KeyLoop = "Loop"
|
||||||
keyMinFPS = "MinFPS"
|
KeyMinFPS = "MinFPS"
|
||||||
keyMinFrames = "MinFrames"
|
KeyMinFrames = "MinFrames"
|
||||||
keyMode = "mode"
|
KeyMode = "mode"
|
||||||
keyMotionDownscaling = "MotionDownscaling"
|
KeyMotionDownscaling = "MotionDownscaling"
|
||||||
keyMotionHistory = "MotionHistory"
|
KeyMotionHistory = "MotionHistory"
|
||||||
keyMotionInterval = "MotionInterval"
|
KeyMotionInterval = "MotionInterval"
|
||||||
keyMotionKernel = "MotionKernel"
|
KeyMotionKernel = "MotionKernel"
|
||||||
keyMotionMinArea = "MotionMinArea"
|
KeyMotionMinArea = "MotionMinArea"
|
||||||
keyMotionPadding = "MotionPadding"
|
KeyMotionPadding = "MotionPadding"
|
||||||
keyMotionPixels = "MotionPixels"
|
KeyMotionPixels = "MotionPixels"
|
||||||
keyMotionThreshold = "MotionThreshold"
|
KeyMotionThreshold = "MotionThreshold"
|
||||||
keyOutput = "Output"
|
KeyOutput = "Output"
|
||||||
keyOutputPath = "OutputPath"
|
KeyOutputPath = "OutputPath"
|
||||||
keyOutputs = "Outputs"
|
KeyOutputs = "Outputs"
|
||||||
keyPSITime = "PSITime"
|
KeyPSITime = "PSITime"
|
||||||
keyQuantization = "Quantization"
|
KeyQuantization = "Quantization"
|
||||||
keyRBCapacity = "RBCapacity"
|
KeyRBCapacity = "RBCapacity"
|
||||||
keyRBWriteTimeout = "RBWriteTimeout"
|
KeyRBWriteTimeout = "RBWriteTimeout"
|
||||||
keyRecPeriod = "RecPeriod"
|
KeyRecPeriod = "RecPeriod"
|
||||||
keyRotation = "Rotation"
|
KeyRotation = "Rotation"
|
||||||
keyRTMPURL = "RTMPURL"
|
KeyRTMPURL = "RTMPURL"
|
||||||
keyRTPAddress = "RTPAddress"
|
KeyRTPAddress = "RTPAddress"
|
||||||
keySampleRate = "SampleRate"
|
KeySampleRate = "SampleRate"
|
||||||
keySaturation = "Saturation"
|
KeySaturation = "Saturation"
|
||||||
keySuppress = "Suppress"
|
KeySuppress = "Suppress"
|
||||||
keyVBRBitrate = "VBRBitrate"
|
KeyVBRBitrate = "VBRBitrate"
|
||||||
keyVBRQuality = "VBRQuality"
|
KeyVBRQuality = "VBRQuality"
|
||||||
keyVerticalFlip = "VerticalFlip"
|
KeyVerticalFlip = "VerticalFlip"
|
||||||
keyWidth = "Width"
|
KeyWidth = "Width"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config map parameter types.
|
// Config map parameter types.
|
||||||
|
@ -131,59 +131,59 @@ var Variables = []struct {
|
||||||
Validate func(*Config)
|
Validate func(*Config)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Name: keyAutoWhiteBalance,
|
Name: KeyAutoWhiteBalance,
|
||||||
Type_: "enum:off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon",
|
Type_: "enum:off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon",
|
||||||
Update: func(c *Config, v string) { c.AutoWhiteBalance = v },
|
Update: func(c *Config, v string) { c.AutoWhiteBalance = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyBitDepth,
|
Name: KeyBitDepth,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.BitDepth = parseUint(keyBitDepth, v, c) },
|
Update: func(c *Config, v string) { c.BitDepth = parseUint(KeyBitDepth, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyBitrate,
|
Name: KeyBitrate,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Bitrate = parseUint(keyBitrate, v, c) },
|
Update: func(c *Config, v string) { c.Bitrate = parseUint(KeyBitrate, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyBrightness,
|
Name: KeyBrightness,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Brightness = parseUint(keyBrightness, v, c) },
|
Update: func(c *Config, v string) { c.Brightness = parseUint(KeyBrightness, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyBurstPeriod,
|
Name: KeyBurstPeriod,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.BurstPeriod = parseUint(keyBurstPeriod, v, c) },
|
Update: func(c *Config, v string) { c.BurstPeriod = parseUint(KeyBurstPeriod, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.BurstPeriod <= 0 {
|
if c.BurstPeriod <= 0 {
|
||||||
c.LogInvalidField(keyBurstPeriod, defaultBurstPeriod)
|
c.LogInvalidField(KeyBurstPeriod, defaultBurstPeriod)
|
||||||
c.BurstPeriod = defaultBurstPeriod
|
c.BurstPeriod = defaultBurstPeriod
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyCameraChan,
|
Name: KeyCameraChan,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.CameraChan = uint8(parseUint(keyCameraChan, v, c)) },
|
Update: func(c *Config, v string) { c.CameraChan = uint8(parseUint(KeyCameraChan, v, c)) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyCameraIP,
|
Name: KeyCameraIP,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.CameraIP = v },
|
Update: func(c *Config, v string) { c.CameraIP = v },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.CameraIP == "" {
|
if c.CameraIP == "" {
|
||||||
c.LogInvalidField(keyCameraIP, defaultCameraIP)
|
c.LogInvalidField(KeyCameraIP, defaultCameraIP)
|
||||||
c.CameraIP = defaultCameraIP
|
c.CameraIP = defaultCameraIP
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyCBR,
|
Name: KeyCBR,
|
||||||
Type_: typeBool,
|
Type_: typeBool,
|
||||||
Update: func(c *Config, v string) { c.CBR = parseBool(keyCBR, v, c) },
|
Update: func(c *Config, v string) { c.CBR = parseBool(KeyCBR, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyClipDuration,
|
Name: KeyClipDuration,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
_v, err := strconv.Atoi(v)
|
_v, err := strconv.Atoi(v)
|
||||||
|
@ -194,34 +194,34 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.ClipDuration <= 0 {
|
if c.ClipDuration <= 0 {
|
||||||
c.LogInvalidField(keyClipDuration, defaultClipDuration)
|
c.LogInvalidField(KeyClipDuration, defaultClipDuration)
|
||||||
c.ClipDuration = defaultClipDuration
|
c.ClipDuration = defaultClipDuration
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyChannels,
|
Name: KeyChannels,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Channels = parseUint(keyChannels, v, c) },
|
Update: func(c *Config, v string) { c.Channels = parseUint(KeyChannels, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyExposure,
|
Name: KeyExposure,
|
||||||
Type_: "enum:auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks",
|
Type_: "enum:auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks",
|
||||||
Update: func(c *Config, v string) { c.Exposure = v },
|
Update: func(c *Config, v string) { c.Exposure = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyFileFPS,
|
Name: KeyFileFPS,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.FileFPS = parseUint(keyFileFPS, v, c) },
|
Update: func(c *Config, v string) { c.FileFPS = parseUint(KeyFileFPS, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.FileFPS <= 0 || (c.FileFPS > 0 && c.Input != InputFile) {
|
if c.FileFPS <= 0 || (c.FileFPS > 0 && c.Input != InputFile) {
|
||||||
c.LogInvalidField(keyFileFPS, defaultFileFPS)
|
c.LogInvalidField(KeyFileFPS, defaultFileFPS)
|
||||||
c.FileFPS = defaultFileFPS
|
c.FileFPS = defaultFileFPS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyFilters,
|
Name: KeyFilters,
|
||||||
Type_: "enums:NoOp,MOG,VariableFPS,KNN,Difference,Basic",
|
Type_: "enums:NoOp,MOG,VariableFPS,KNN,Difference,Basic",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
filters := strings.Split(v, ",")
|
filters := strings.Split(v, ",")
|
||||||
|
@ -237,37 +237,37 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyFrameRate,
|
Name: KeyFrameRate,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.FrameRate = parseUint(keyFrameRate, v, c) },
|
Update: func(c *Config, v string) { c.FrameRate = parseUint(KeyFrameRate, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.FrameRate <= 0 || c.FrameRate > 60 {
|
if c.FrameRate <= 0 || c.FrameRate > 60 {
|
||||||
c.LogInvalidField(keyFrameRate, defaultFrameRate)
|
c.LogInvalidField(KeyFrameRate, defaultFrameRate)
|
||||||
c.FrameRate = defaultFrameRate
|
c.FrameRate = defaultFrameRate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyHeight,
|
Name: KeyHeight,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Height = parseUint(keyHeight, v, c) },
|
Update: func(c *Config, v string) { c.Height = parseUint(KeyHeight, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyHorizontalFlip,
|
Name: KeyHorizontalFlip,
|
||||||
Type_: typeBool,
|
Type_: typeBool,
|
||||||
Update: func(c *Config, v string) { c.HorizontalFlip = parseBool(keyHorizontalFlip, v, c) },
|
Update: func(c *Config, v string) { c.HorizontalFlip = parseBool(KeyHorizontalFlip, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyHTTPAddress,
|
Name: KeyHTTPAddress,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.HTTPAddress = v },
|
Update: func(c *Config, v string) { c.HTTPAddress = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyInput,
|
Name: KeyInput,
|
||||||
Type_: "enum:raspivid,rtsp,v4l,file,audio",
|
Type_: "enum:raspivid,rtsp,v4l,file,audio",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.Input = parseEnum(
|
c.Input = parseEnum(
|
||||||
keyInput,
|
KeyInput,
|
||||||
v,
|
v,
|
||||||
map[string]uint8{
|
map[string]uint8{
|
||||||
"raspivid": InputRaspivid,
|
"raspivid": InputRaspivid,
|
||||||
|
@ -283,17 +283,17 @@ var Variables = []struct {
|
||||||
switch c.Input {
|
switch c.Input {
|
||||||
case InputRaspivid, InputV4L, InputFile, InputAudio, InputRTSP:
|
case InputRaspivid, InputV4L, InputFile, InputAudio, InputRTSP:
|
||||||
default:
|
default:
|
||||||
c.LogInvalidField(keyInput, defaultInput)
|
c.LogInvalidField(KeyInput, defaultInput)
|
||||||
c.Input = defaultInput
|
c.Input = defaultInput
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyInputCodec,
|
Name: KeyInputCodec,
|
||||||
Type_: "enum:H264,H265,MJPEG,PCM,ADPCM",
|
Type_: "enum:H264,H265,MJPEG,PCM,ADPCM",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.InputCodec = parseEnum(
|
c.InputCodec = parseEnum(
|
||||||
keyInputCodec,
|
KeyInputCodec,
|
||||||
v,
|
v,
|
||||||
map[string]uint8{
|
map[string]uint8{
|
||||||
"h264": codecutil.H264,
|
"h264": codecutil.H264,
|
||||||
|
@ -309,18 +309,18 @@ var Variables = []struct {
|
||||||
switch c.InputCodec {
|
switch c.InputCodec {
|
||||||
case codecutil.H264, codecutil.MJPEG, codecutil.PCM, codecutil.ADPCM:
|
case codecutil.H264, codecutil.MJPEG, codecutil.PCM, codecutil.ADPCM:
|
||||||
default:
|
default:
|
||||||
c.LogInvalidField(keyInputCodec, defaultInputCodec)
|
c.LogInvalidField(KeyInputCodec, defaultInputCodec)
|
||||||
c.InputCodec = defaultInputCodec
|
c.InputCodec = defaultInputCodec
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyInputPath,
|
Name: KeyInputPath,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.InputPath = v },
|
Update: func(c *Config, v string) { c.InputPath = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyLogging,
|
Name: KeyLogging,
|
||||||
Type_: "enum:Debug,Info,Warning,Error,Fatal",
|
Type_: "enum:Debug,Info,Warning,Error,Fatal",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
switch v {
|
switch v {
|
||||||
|
@ -348,60 +348,60 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyLoop,
|
Name: KeyLoop,
|
||||||
Type_: typeBool,
|
Type_: typeBool,
|
||||||
Update: func(c *Config, v string) { c.Loop = parseBool(keyLoop, v, c) },
|
Update: func(c *Config, v string) { c.Loop = parseBool(KeyLoop, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMinFPS,
|
Name: KeyMinFPS,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MinFPS = parseUint(keyMinFPS, v, c) },
|
Update: func(c *Config, v string) { c.MinFPS = parseUint(KeyMinFPS, v, c) },
|
||||||
Validate: func(c *Config) { c.MinFPS = lessThanOrEqual(keyMinFPS, c.MinFPS, 0, c, defaultMinFPS) },
|
Validate: func(c *Config) { c.MinFPS = lessThanOrEqual(KeyMinFPS, c.MinFPS, 0, c, defaultMinFPS) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMinFrames,
|
Name: KeyMinFrames,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MinFrames = parseUint(keyMinFrames, v, c) },
|
Update: func(c *Config, v string) { c.MinFrames = parseUint(KeyMinFrames, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
const maxMinFrames = 1000
|
const maxMinFrames = 1000
|
||||||
if c.MinFrames <= 0 || c.MinFrames > maxMinFrames {
|
if c.MinFrames <= 0 || c.MinFrames > maxMinFrames {
|
||||||
c.LogInvalidField(keyMinFrames, defaultMinFrames)
|
c.LogInvalidField(KeyMinFrames, defaultMinFrames)
|
||||||
c.MinFrames = defaultMinFrames
|
c.MinFrames = defaultMinFrames
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMode,
|
Name: KeyMode,
|
||||||
Type_: "enum:Normal,Paused,Burst,Loop",
|
Type_: "enum:Normal,Paused,Burst,Loop",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.Loop = false
|
c.Loop = false
|
||||||
if v == keyLoop {
|
if v == KeyLoop {
|
||||||
c.Loop = true
|
c.Loop = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionDownscaling,
|
Name: KeyMotionDownscaling,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionDownscaling = parseUint(keyMotionDownscaling, v, c) },
|
Update: func(c *Config, v string) { c.MotionDownscaling = parseUint(KeyMotionDownscaling, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionHistory,
|
Name: KeyMotionHistory,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionHistory = parseUint(keyMotionHistory, v, c) },
|
Update: func(c *Config, v string) { c.MotionHistory = parseUint(KeyMotionHistory, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionInterval,
|
Name: KeyMotionInterval,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionInterval = parseUint(keyMotionInterval, v, c) },
|
Update: func(c *Config, v string) { c.MotionInterval = parseUint(KeyMotionInterval, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionKernel,
|
Name: KeyMotionKernel,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionKernel = parseUint(keyMotionKernel, v, c) },
|
Update: func(c *Config, v string) { c.MotionKernel = parseUint(KeyMotionKernel, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionMinArea,
|
Name: KeyMotionMinArea,
|
||||||
Type_: typeFloat,
|
Type_: typeFloat,
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
f, err := strconv.ParseFloat(v, 64)
|
f, err := strconv.ParseFloat(v, 64)
|
||||||
|
@ -412,17 +412,17 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionPadding,
|
Name: KeyMotionPadding,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionPadding = parseUint(keyMotionPadding, v, c) },
|
Update: func(c *Config, v string) { c.MotionPadding = parseUint(KeyMotionPadding, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionPixels,
|
Name: KeyMotionPixels,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.MotionPixels = parseUint(keyMotionPixels, v, c) },
|
Update: func(c *Config, v string) { c.MotionPixels = parseUint(KeyMotionPixels, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyMotionThreshold,
|
Name: KeyMotionThreshold,
|
||||||
Type_: typeFloat,
|
Type_: typeFloat,
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
f, err := strconv.ParseFloat(v, 64)
|
f, err := strconv.ParseFloat(v, 64)
|
||||||
|
@ -433,7 +433,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyOutput,
|
Name: KeyOutput,
|
||||||
Type_: "enum:File,HTTP,RTMP,RTP",
|
Type_: "enum:File,HTTP,RTMP,RTP",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.Outputs = make([]uint8, 1)
|
c.Outputs = make([]uint8, 1)
|
||||||
|
@ -452,12 +452,12 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyOutputPath,
|
Name: KeyOutputPath,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.OutputPath = v },
|
Update: func(c *Config, v string) { c.OutputPath = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyOutputs,
|
Name: KeyOutputs,
|
||||||
Type_: "enums:File,HTTP,RTMP,RTP",
|
Type_: "enums:File,HTTP,RTMP,RTP",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
outputs := strings.Split(v, ",")
|
outputs := strings.Split(v, ",")
|
||||||
|
@ -479,75 +479,75 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.Outputs == nil {
|
if c.Outputs == nil {
|
||||||
c.LogInvalidField(keyOutputs, defaultOutput)
|
c.LogInvalidField(KeyOutputs, defaultOutput)
|
||||||
c.Outputs = append(c.Outputs, defaultOutput)
|
c.Outputs = append(c.Outputs, defaultOutput)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyPSITime,
|
Name: KeyPSITime,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.PSITime = parseUint(keyPSITime, v, c) },
|
Update: func(c *Config, v string) { c.PSITime = parseUint(KeyPSITime, v, c) },
|
||||||
Validate: func(c *Config) { c.PSITime = lessThanOrEqual(keyPSITime, c.PSITime, 0, c, defaultPSITime) },
|
Validate: func(c *Config) { c.PSITime = lessThanOrEqual(KeyPSITime, c.PSITime, 0, c, defaultPSITime) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyQuantization,
|
Name: KeyQuantization,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Quantization = parseUint(keyQuantization, v, c) },
|
Update: func(c *Config, v string) { c.Quantization = parseUint(KeyQuantization, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRBCapacity,
|
Name: KeyRBCapacity,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.RBCapacity = parseUint(keyRBCapacity, v, c) },
|
Update: func(c *Config, v string) { c.RBCapacity = parseUint(KeyRBCapacity, v, c) },
|
||||||
Validate: func(c *Config) { c.RBCapacity = lessThanOrEqual(keyRBCapacity, c.RBCapacity, 0, c, defaultRBCapacity) },
|
Validate: func(c *Config) { c.RBCapacity = lessThanOrEqual(KeyRBCapacity, c.RBCapacity, 0, c, defaultRBCapacity) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRBWriteTimeout,
|
Name: KeyRBWriteTimeout,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.RBWriteTimeout = parseUint(keyRBWriteTimeout, v, c) },
|
Update: func(c *Config, v string) { c.RBWriteTimeout = parseUint(KeyRBWriteTimeout, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
c.RBWriteTimeout = lessThanOrEqual(keyRBWriteTimeout, c.RBWriteTimeout, 0, c, defaultRBWriteTimeout)
|
c.RBWriteTimeout = lessThanOrEqual(KeyRBWriteTimeout, c.RBWriteTimeout, 0, c, defaultRBWriteTimeout)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRecPeriod,
|
Name: KeyRecPeriod,
|
||||||
Type_: typeFloat,
|
Type_: typeFloat,
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
_v, err := strconv.ParseFloat(v, 64)
|
_v, err := strconv.ParseFloat(v, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger.Log(logger.Warning, fmt.Sprintf("invalid %s param", keyRecPeriod), "value", v)
|
c.Logger.Log(logger.Warning, fmt.Sprintf("invalid %s param", KeyRecPeriod), "value", v)
|
||||||
}
|
}
|
||||||
c.RecPeriod = _v
|
c.RecPeriod = _v
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRotation,
|
Name: KeyRotation,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Rotation = parseUint(keyRotation, v, c) },
|
Update: func(c *Config, v string) { c.Rotation = parseUint(KeyRotation, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRTMPURL,
|
Name: KeyRTMPURL,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.RTMPURL = v },
|
Update: func(c *Config, v string) { c.RTMPURL = v },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyRTPAddress,
|
Name: KeyRTPAddress,
|
||||||
Type_: typeString,
|
Type_: typeString,
|
||||||
Update: func(c *Config, v string) { c.RTPAddress = v },
|
Update: func(c *Config, v string) { c.RTPAddress = v },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
if c.RTPAddress == "" {
|
if c.RTPAddress == "" {
|
||||||
c.LogInvalidField(keyRTPAddress, defaultRTPAddr)
|
c.LogInvalidField(KeyRTPAddress, defaultRTPAddr)
|
||||||
c.RTPAddress = defaultRTPAddr
|
c.RTPAddress = defaultRTPAddr
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keySampleRate,
|
Name: KeySampleRate,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.SampleRate = parseUint(keySampleRate, v, c) },
|
Update: func(c *Config, v string) { c.SampleRate = parseUint(KeySampleRate, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keySaturation,
|
Name: KeySaturation,
|
||||||
Type_: "int",
|
Type_: "int",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
_v, err := strconv.Atoi(v)
|
_v, err := strconv.Atoi(v)
|
||||||
|
@ -558,24 +558,24 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keySuppress,
|
Name: KeySuppress,
|
||||||
Type_: typeBool,
|
Type_: typeBool,
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.Suppress = parseBool(keySuppress, v, c)
|
c.Suppress = parseBool(KeySuppress, v, c)
|
||||||
c.Logger.(*logger.Logger).SetSuppress(c.Suppress)
|
c.Logger.(*logger.Logger).SetSuppress(c.Suppress)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyVBRBitrate,
|
Name: KeyVBRBitrate,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.VBRBitrate = parseUint(keyVBRBitrate, v, c) },
|
Update: func(c *Config, v string) { c.VBRBitrate = parseUint(KeyVBRBitrate, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyVBRQuality,
|
Name: KeyVBRQuality,
|
||||||
Type_: "enum:standard,fair,good,great,excellent",
|
Type_: "enum:standard,fair,good,great,excellent",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.VBRQuality = Quality(parseEnum(
|
c.VBRQuality = Quality(parseEnum(
|
||||||
keyVBRQuality,
|
KeyVBRQuality,
|
||||||
v,
|
v,
|
||||||
map[string]uint8{
|
map[string]uint8{
|
||||||
"standard": uint8(QualityStandard),
|
"standard": uint8(QualityStandard),
|
||||||
|
@ -589,14 +589,14 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyVerticalFlip,
|
Name: KeyVerticalFlip,
|
||||||
Type_: typeBool,
|
Type_: typeBool,
|
||||||
Update: func(c *Config, v string) { c.VerticalFlip = parseBool(keyVerticalFlip, v, c) },
|
Update: func(c *Config, v string) { c.VerticalFlip = parseBool(KeyVerticalFlip, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: keyWidth,
|
Name: KeyWidth,
|
||||||
Type_: typeUint,
|
Type_: typeUint,
|
||||||
Update: func(c *Config, v string) { c.Width = parseUint(keyWidth, v, c) },
|
Update: func(c *Config, v string) { c.Width = parseUint(KeyWidth, v, c) },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue