mirror of https://bitbucket.org/ausocean/av.git
Merged in fix-config-variables (pull request #467)
cmd/rv/main.go & revid/config/variables.go: rename Variables Type_ field to Type and comment Variables global. Approved-by: Trek Hopton Approved-by: kortschak
This commit is contained in:
commit
e3c5d01a97
|
@ -238,7 +238,7 @@ func run(rv *revid.Revid, ns *netsender.Sender, l *logger.Logger, nl *netlogger.
|
||||||
func createVarMap() map[string]string {
|
func createVarMap() map[string]string {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
for _, v := range config.Variables {
|
for _, v := range config.Variables {
|
||||||
m[v.Name] = v.Type_
|
m[v.Name] = v.Type
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,40 +135,43 @@ const (
|
||||||
defaultMinFPS = 1.0
|
defaultMinFPS = 1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Variables describes the variables that can be used for revid control.
|
||||||
|
// These structs provide the name and type of variable, a function for updating
|
||||||
|
// this variable in a Config, and a function for validating the value of the variable.
|
||||||
var Variables = []struct {
|
var Variables = []struct {
|
||||||
Name string
|
Name string
|
||||||
Type_ string
|
Type string
|
||||||
Update func(*Config, string)
|
Update func(*Config, string)
|
||||||
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: KeyAWBGains,
|
Name: KeyAWBGains,
|
||||||
Type_: typeString,
|
Type: typeString,
|
||||||
Update: func(c *Config, v string) { c.AWBGains = v },
|
Update: func(c *Config, v string) { c.AWBGains = 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 {
|
||||||
|
@ -179,12 +182,12 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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 == "" {
|
||||||
|
@ -195,12 +198,12 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -217,27 +220,27 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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: KeyContrast,
|
Name: KeyContrast,
|
||||||
Type_: typeInt,
|
Type: typeInt,
|
||||||
Update: func(c *Config, v string) { c.Contrast = parseInt(KeyContrast, v, c) },
|
Update: func(c *Config, v string) { c.Contrast = parseInt(KeyContrast, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyEV,
|
Name: KeyEV,
|
||||||
Type_: typeInt,
|
Type: typeInt,
|
||||||
Update: func(c *Config, v string) { c.EV = parseInt(KeyEV, v, c) },
|
Update: func(c *Config, v string) { c.EV = parseInt(KeyEV, 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) {
|
||||||
|
@ -248,7 +251,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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, ",")
|
||||||
m := map[string]uint{"NoOp": FilterNoOp, "MOG": FilterMOG, "VariableFPS": FilterVariableFPS, "KNN": FilterKNN, "Difference": FilterDiff, "Basic": FilterBasic}
|
m := map[string]uint{"NoOp": FilterNoOp, "MOG": FilterMOG, "VariableFPS": FilterVariableFPS, "KNN": FilterKNN, "Difference": FilterDiff, "Basic": FilterBasic}
|
||||||
|
@ -264,7 +267,7 @@ 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 {
|
||||||
|
@ -275,22 +278,22 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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,raspistill,rtsp,v4l,file,audio",
|
Type: "enum:raspivid,raspistill,rtsp,v4l,file,audio",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.Input = parseEnum(
|
c.Input = parseEnum(
|
||||||
KeyInput,
|
KeyInput,
|
||||||
|
@ -317,7 +320,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyInputCodec,
|
Name: KeyInputCodec,
|
||||||
Type_: "enum:h264,h265,mjpeg,jpeg,pcm,adpcm",
|
Type: "enum:h264,h265,mjpeg,jpeg,pcm,adpcm",
|
||||||
Update: func(c *Config, v string) {
|
Update: func(c *Config, v string) {
|
||||||
c.InputCodec = v
|
c.InputCodec = v
|
||||||
},
|
},
|
||||||
|
@ -330,17 +333,17 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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: KeyISO,
|
Name: KeyISO,
|
||||||
Type_: typeUint,
|
Type: typeUint,
|
||||||
Update: func(c *Config, v string) { c.ISO = parseUint(KeyISO, v, c) },
|
Update: func(c *Config, v string) { c.ISO = parseUint(KeyISO, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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 {
|
||||||
case "Debug":
|
case "Debug":
|
||||||
|
@ -368,18 +371,18 @@ 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
|
||||||
|
@ -391,7 +394,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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 {
|
||||||
|
@ -401,27 +404,27 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -432,17 +435,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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -453,7 +456,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)
|
||||||
switch strings.ToLower(v) {
|
switch strings.ToLower(v) {
|
||||||
|
@ -474,12 +477,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, ",")
|
||||||
c.Outputs = make([]uint8, len(outputs))
|
c.Outputs = make([]uint8, len(outputs))
|
||||||
|
@ -509,18 +512,18 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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: KeyPoolCapacity,
|
Name: KeyPoolCapacity,
|
||||||
Type_: typeUint,
|
Type: typeUint,
|
||||||
Update: func(c *Config, v string) { c.PoolCapacity = parseUint(KeyPoolCapacity, v, c) },
|
Update: func(c *Config, v string) { c.PoolCapacity = parseUint(KeyPoolCapacity, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
c.PoolCapacity = lessThanOrEqual(KeyPoolCapacity, c.PoolCapacity, 0, c, defaultPoolCapacity)
|
c.PoolCapacity = lessThanOrEqual(KeyPoolCapacity, c.PoolCapacity, 0, c, defaultPoolCapacity)
|
||||||
|
@ -528,7 +531,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyPoolStartElementSize,
|
Name: KeyPoolStartElementSize,
|
||||||
Type_: typeUint,
|
Type: typeUint,
|
||||||
Update: func(c *Config, v string) { c.PoolStartElementSize = parseUint("PoolStartElementSize", v, c) },
|
Update: func(c *Config, v string) { c.PoolStartElementSize = parseUint("PoolStartElementSize", v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
c.PoolStartElementSize = lessThanOrEqual("PoolStartElementSize", c.PoolStartElementSize, 0, c, defaultPoolStartElementSize)
|
c.PoolStartElementSize = lessThanOrEqual("PoolStartElementSize", c.PoolStartElementSize, 0, c, defaultPoolStartElementSize)
|
||||||
|
@ -536,7 +539,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyPoolWriteTimeout,
|
Name: KeyPoolWriteTimeout,
|
||||||
Type_: typeUint,
|
Type: typeUint,
|
||||||
Update: func(c *Config, v string) { c.PoolWriteTimeout = parseUint(KeyPoolWriteTimeout, v, c) },
|
Update: func(c *Config, v string) { c.PoolWriteTimeout = parseUint(KeyPoolWriteTimeout, v, c) },
|
||||||
Validate: func(c *Config) {
|
Validate: func(c *Config) {
|
||||||
c.PoolWriteTimeout = lessThanOrEqual(KeyPoolWriteTimeout, c.PoolWriteTimeout, 0, c, defaultPoolWriteTimeout)
|
c.PoolWriteTimeout = lessThanOrEqual(KeyPoolWriteTimeout, c.PoolWriteTimeout, 0, c, defaultPoolWriteTimeout)
|
||||||
|
@ -544,7 +547,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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 {
|
||||||
|
@ -555,17 +558,17 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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 == "" {
|
||||||
|
@ -576,22 +579,22 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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_: typeInt,
|
Type: typeInt,
|
||||||
Update: func(c *Config, v string) { c.Saturation = parseInt(KeySaturation, v, c) },
|
Update: func(c *Config, v string) { c.Saturation = parseInt(KeySaturation, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeySharpness,
|
Name: KeySharpness,
|
||||||
Type_: typeInt,
|
Type: typeInt,
|
||||||
Update: func(c *Config, v string) { c.Sharpness = parseInt(KeySharpness, v, c) },
|
Update: func(c *Config, v string) { c.Sharpness = parseInt(KeySharpness, v, c) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyJPEGQuality,
|
Name: KeyJPEGQuality,
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -602,7 +605,7 @@ 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)
|
||||||
|
@ -610,7 +613,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyTimelapseInterval,
|
Name: KeyTimelapseInterval,
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -621,7 +624,7 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: KeyTimelapseDuration,
|
Name: KeyTimelapseDuration,
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -632,12 +635,12 @@ var Variables = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
@ -655,12 +658,12 @@ 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