mirror of https://bitbucket.org/ausocean/av.git
Merged in key-consts (pull request #442)
revid/config/variables.go: creating config map key consts and type consts Approved-by: Trek Hopton
This commit is contained in:
commit
052d3fcad8
|
@ -37,6 +37,69 @@ import (
|
|||
"bitbucket.org/ausocean/utils/logger"
|
||||
)
|
||||
|
||||
// Config map keys.
|
||||
const (
|
||||
keyAutoWhiteBalance = "AutoWhiteBalance"
|
||||
keyBitDepth = "BitDepth"
|
||||
keyBitrate = "Bitrate"
|
||||
keyBrightness = "Brightness"
|
||||
keyBurstPeriod = "BurstPeriod"
|
||||
keyCameraChan = "CameraChan"
|
||||
keyCameraIP = "CameraIP"
|
||||
keyCBR = "CBR"
|
||||
keyClipDuration = "ClipDuration"
|
||||
keyChannels = "Channels"
|
||||
keyExposure = "Exposure"
|
||||
keyFileFPS = "FileFPS"
|
||||
keyFilters = "Filters"
|
||||
keyFrameRate = "FrameRate"
|
||||
keyHeight = "Height"
|
||||
keyHorizontalFlip = "HorizontalFlip"
|
||||
keyHTTPAddress = "HTTPAddress"
|
||||
keyInput = "Input"
|
||||
keyInputCodec = "InputCodec"
|
||||
keyInputPath = "InputPath"
|
||||
keyLogging = "logging"
|
||||
keyLoop = "Loop"
|
||||
keyMinFPS = "MinFPS"
|
||||
keyMinFrames = "MinFrames"
|
||||
keyMode = "mode"
|
||||
keyMotionDownscaling = "MotionDownscaling"
|
||||
keyMotionHistory = "MotionHistory"
|
||||
keyMotionInterval = "MotionInterval"
|
||||
keyMotionKernel = "MotionKernel"
|
||||
keyMotionMinArea = "MotionMinArea"
|
||||
keyMotionPadding = "MotionPadding"
|
||||
keyMotionPixels = "MotionPixels"
|
||||
keyMotionThreshold = "MotionThreshold"
|
||||
keyOutput = "Output"
|
||||
keyOutputPath = "OutputPath"
|
||||
keyOutputs = "Outputs"
|
||||
keyPSITime = "PSITime"
|
||||
keyQuantization = "Quantization"
|
||||
keyRBCapacity = "RBCapacity"
|
||||
keyRBWriteTimeout = "RBWriteTimeout"
|
||||
keyRecPeriod = "RecPeriod"
|
||||
keyRotation = "Rotation"
|
||||
keyRTMPURL = "RTMPURL"
|
||||
keyRTPAddress = "RTPAddress"
|
||||
keySampleRate = "SampleRate"
|
||||
keySaturation = "Saturation"
|
||||
keySuppress = "Suppress"
|
||||
keyVBRBitrate = "VBRBitrate"
|
||||
keyVBRQuality = "VBRQuality"
|
||||
keyVerticalFlip = "VerticalFlip"
|
||||
keyWidth = "Width"
|
||||
)
|
||||
|
||||
// Config map parameter types.
|
||||
const (
|
||||
typeString = "string"
|
||||
typeUint = "uint"
|
||||
typeBool = "bool"
|
||||
typeFloat = "float"
|
||||
)
|
||||
|
||||
// Default variable values.
|
||||
const (
|
||||
// General revid defaults.
|
||||
|
@ -68,60 +131,60 @@ var Variables = []struct {
|
|||
Validate func(*Config)
|
||||
}{
|
||||
{
|
||||
Name: "AutoWhiteBalance",
|
||||
Name: keyAutoWhiteBalance,
|
||||
Type_: "enum:off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon",
|
||||
Update: func(c *Config, v string) { c.AutoWhiteBalance = v },
|
||||
},
|
||||
{
|
||||
Name: "BitDepth",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.BitDepth = parseUint("BitDepth", v, c) },
|
||||
Name: keyBitDepth,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.BitDepth = parseUint(keyBitDepth, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "Bitrate",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Bitrate = parseUint("Bitrate", v, c) },
|
||||
Name: keyBitrate,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Bitrate = parseUint(keyBitrate, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "Brightness",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Brightness = parseUint("Brightness", v, c) },
|
||||
Name: keyBrightness,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Brightness = parseUint(keyBrightness, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "BurstPeriod",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.BurstPeriod = parseUint("BurstPeriod", v, c) },
|
||||
Name: keyBurstPeriod,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.BurstPeriod = parseUint(keyBurstPeriod, v, c) },
|
||||
Validate: func(c *Config) {
|
||||
if c.BurstPeriod <= 0 {
|
||||
c.LogInvalidField("BurstPeriod", defaultBurstPeriod)
|
||||
c.LogInvalidField(keyBurstPeriod, defaultBurstPeriod)
|
||||
c.BurstPeriod = defaultBurstPeriod
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "CameraChan",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.CameraChan = uint8(parseUint("CameraChan", v, c)) },
|
||||
Name: keyCameraChan,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.CameraChan = uint8(parseUint(keyCameraChan, v, c)) },
|
||||
},
|
||||
{
|
||||
Name: "CameraIP",
|
||||
Type_: "string",
|
||||
Name: keyCameraIP,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.CameraIP = v },
|
||||
Validate: func(c *Config) {
|
||||
if c.CameraIP == "" {
|
||||
c.LogInvalidField("CameraIP", defaultCameraIP)
|
||||
c.LogInvalidField(keyCameraIP, defaultCameraIP)
|
||||
c.CameraIP = defaultCameraIP
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "CBR",
|
||||
Type_: "bool",
|
||||
Update: func(c *Config, v string) { c.CBR = parseBool("CBR", v, c) },
|
||||
Name: keyCBR,
|
||||
Type_: typeBool,
|
||||
Update: func(c *Config, v string) { c.CBR = parseBool(keyCBR, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "ClipDuration",
|
||||
Type_: "uint",
|
||||
Name: keyClipDuration,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) {
|
||||
_v, err := strconv.Atoi(v)
|
||||
if err != nil {
|
||||
|
@ -131,34 +194,34 @@ var Variables = []struct {
|
|||
},
|
||||
Validate: func(c *Config) {
|
||||
if c.ClipDuration <= 0 {
|
||||
c.LogInvalidField("ClipDuration", defaultClipDuration)
|
||||
c.LogInvalidField(keyClipDuration, defaultClipDuration)
|
||||
c.ClipDuration = defaultClipDuration
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Channels",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Channels = parseUint("Channels", v, c) },
|
||||
Name: keyChannels,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Channels = parseUint(keyChannels, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "Exposure",
|
||||
Name: keyExposure,
|
||||
Type_: "enum:auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks",
|
||||
Update: func(c *Config, v string) { c.Exposure = v },
|
||||
},
|
||||
{
|
||||
Name: "FileFPS",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.FileFPS = parseUint("FileFPS", v, c) },
|
||||
Name: keyFileFPS,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.FileFPS = parseUint(keyFileFPS, v, c) },
|
||||
Validate: func(c *Config) {
|
||||
if c.FileFPS <= 0 || (c.FileFPS > 0 && c.Input != InputFile) {
|
||||
c.LogInvalidField("FileFPS", defaultFileFPS)
|
||||
c.LogInvalidField(keyFileFPS, defaultFileFPS)
|
||||
c.FileFPS = defaultFileFPS
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Filters",
|
||||
Name: keyFilters,
|
||||
Type_: "enums:NoOp,MOG,VariableFPS,KNN,Difference,Basic",
|
||||
Update: func(c *Config, v string) {
|
||||
filters := strings.Split(v, ",")
|
||||
|
@ -174,37 +237,37 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "FrameRate",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.FrameRate = parseUint("FrameRate", v, c) },
|
||||
Name: keyFrameRate,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.FrameRate = parseUint(keyFrameRate, v, c) },
|
||||
Validate: func(c *Config) {
|
||||
if c.FrameRate <= 0 || c.FrameRate > 60 {
|
||||
c.LogInvalidField("FrameRate", defaultFrameRate)
|
||||
c.LogInvalidField(keyFrameRate, defaultFrameRate)
|
||||
c.FrameRate = defaultFrameRate
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Height",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Height = parseUint("Height", v, c) },
|
||||
Name: keyHeight,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Height = parseUint(keyHeight, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "HorizontalFlip",
|
||||
Type_: "bool",
|
||||
Update: func(c *Config, v string) { c.HorizontalFlip = parseBool("HorizontalFlip", v, c) },
|
||||
Name: keyHorizontalFlip,
|
||||
Type_: typeBool,
|
||||
Update: func(c *Config, v string) { c.HorizontalFlip = parseBool(keyHorizontalFlip, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "HTTPAddress",
|
||||
Type_: "string",
|
||||
Name: keyHTTPAddress,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.HTTPAddress = v },
|
||||
},
|
||||
{
|
||||
Name: "Input",
|
||||
Name: keyInput,
|
||||
Type_: "enum:raspivid,rtsp,v4l,file,audio",
|
||||
Update: func(c *Config, v string) {
|
||||
c.Input = parseEnum(
|
||||
"Input",
|
||||
keyInput,
|
||||
v,
|
||||
map[string]uint8{
|
||||
"raspivid": InputRaspivid,
|
||||
|
@ -220,17 +283,17 @@ var Variables = []struct {
|
|||
switch c.Input {
|
||||
case InputRaspivid, InputV4L, InputFile, InputAudio, InputRTSP:
|
||||
default:
|
||||
c.LogInvalidField("Input", defaultInput)
|
||||
c.LogInvalidField(keyInput, defaultInput)
|
||||
c.Input = defaultInput
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "InputCodec",
|
||||
Name: keyInputCodec,
|
||||
Type_: "enum:H264,H265,MJPEG,PCM,ADPCM",
|
||||
Update: func(c *Config, v string) {
|
||||
c.InputCodec = parseEnum(
|
||||
"InputCodec",
|
||||
keyInputCodec,
|
||||
v,
|
||||
map[string]uint8{
|
||||
"h264": codecutil.H264,
|
||||
|
@ -246,18 +309,18 @@ var Variables = []struct {
|
|||
switch c.InputCodec {
|
||||
case codecutil.H264, codecutil.MJPEG, codecutil.PCM, codecutil.ADPCM:
|
||||
default:
|
||||
c.LogInvalidField("InputCodec", defaultInputCodec)
|
||||
c.LogInvalidField(keyInputCodec, defaultInputCodec)
|
||||
c.InputCodec = defaultInputCodec
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "InputPath",
|
||||
Type_: "string",
|
||||
Name: keyInputPath,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.InputPath = v },
|
||||
},
|
||||
{
|
||||
Name: "logging",
|
||||
Name: keyLogging,
|
||||
Type_: "enum:Debug,Info,Warning,Error,Fatal",
|
||||
Update: func(c *Config, v string) {
|
||||
switch v {
|
||||
|
@ -285,61 +348,61 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "Loop",
|
||||
Type_: "bool",
|
||||
Update: func(c *Config, v string) { c.Loop = parseBool("Loop", v, c) },
|
||||
Name: keyLoop,
|
||||
Type_: typeBool,
|
||||
Update: func(c *Config, v string) { c.Loop = parseBool(keyLoop, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MinFPS",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MinFPS = parseUint("MinFPS", v, c) },
|
||||
Validate: func(c *Config) { c.MinFPS = lessThanOrEqual("MinFPS", c.MinFPS, 0, c, defaultMinFPS) },
|
||||
Name: keyMinFPS,
|
||||
Type_: typeUint,
|
||||
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) },
|
||||
},
|
||||
{
|
||||
Name: "MinFrames",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MinFrames = parseUint("MinFrames", v, c) },
|
||||
Name: keyMinFrames,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MinFrames = parseUint(keyMinFrames, v, c) },
|
||||
Validate: func(c *Config) {
|
||||
const maxMinFrames = 1000
|
||||
if c.MinFrames <= 0 || c.MinFrames > maxMinFrames {
|
||||
c.LogInvalidField("MinFrames", defaultMinFrames)
|
||||
c.LogInvalidField(keyMinFrames, defaultMinFrames)
|
||||
c.MinFrames = defaultMinFrames
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "mode",
|
||||
Name: keyMode,
|
||||
Type_: "enum:Normal,Paused,Burst,Loop",
|
||||
Update: func(c *Config, v string) {
|
||||
c.Loop = false
|
||||
if v == "Loop" {
|
||||
if v == keyLoop {
|
||||
c.Loop = true
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "MotionDownscaling",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionDownscaling = parseUint("MotionDownscaling", v, c) },
|
||||
Name: keyMotionDownscaling,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionDownscaling = parseUint(keyMotionDownscaling, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionHistory",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionHistory = parseUint("MotionHistory", v, c) },
|
||||
Name: keyMotionHistory,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionHistory = parseUint(keyMotionHistory, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionInterval",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionInterval = parseUint("MotionInterval", v, c) },
|
||||
Name: keyMotionInterval,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionInterval = parseUint(keyMotionInterval, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionKernel",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionKernel = parseUint("MotionKernel", v, c) },
|
||||
Name: keyMotionKernel,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionKernel = parseUint(keyMotionKernel, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionMinArea",
|
||||
Type_: "float",
|
||||
Name: keyMotionMinArea,
|
||||
Type_: typeFloat,
|
||||
Update: func(c *Config, v string) {
|
||||
f, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
|
@ -349,18 +412,18 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "MotionPadding",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionPadding = parseUint("MotionPadding", v, c) },
|
||||
Name: keyMotionPadding,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionPadding = parseUint(keyMotionPadding, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionPixels",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.MotionPixels = parseUint("MotionPixels", v, c) },
|
||||
Name: keyMotionPixels,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.MotionPixels = parseUint(keyMotionPixels, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "MotionThreshold",
|
||||
Type_: "float",
|
||||
Name: keyMotionThreshold,
|
||||
Type_: typeFloat,
|
||||
Update: func(c *Config, v string) {
|
||||
f, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
|
@ -370,7 +433,7 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "Output",
|
||||
Name: keyOutput,
|
||||
Type_: "enum:File,HTTP,RTMP,RTP",
|
||||
Update: func(c *Config, v string) {
|
||||
c.Outputs = make([]uint8, 1)
|
||||
|
@ -389,12 +452,12 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "OutputPath",
|
||||
Type_: "string",
|
||||
Name: keyOutputPath,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.OutputPath = v },
|
||||
},
|
||||
{
|
||||
Name: "Outputs",
|
||||
Name: keyOutputs,
|
||||
Type_: "enums:File,HTTP,RTMP,RTP",
|
||||
Update: func(c *Config, v string) {
|
||||
outputs := strings.Split(v, ",")
|
||||
|
@ -416,75 +479,75 @@ var Variables = []struct {
|
|||
},
|
||||
Validate: func(c *Config) {
|
||||
if c.Outputs == nil {
|
||||
c.LogInvalidField("Outputs", defaultOutput)
|
||||
c.LogInvalidField(keyOutputs, defaultOutput)
|
||||
c.Outputs = append(c.Outputs, defaultOutput)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "PSITime",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.PSITime = parseUint("PSITime", v, c) },
|
||||
Validate: func(c *Config) { c.PSITime = lessThanOrEqual("PSITime", c.PSITime, 0, c, defaultPSITime) },
|
||||
Name: keyPSITime,
|
||||
Type_: typeUint,
|
||||
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) },
|
||||
},
|
||||
{
|
||||
Name: "Quantization",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Quantization = parseUint("Quantization", v, c) },
|
||||
Name: keyQuantization,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Quantization = parseUint(keyQuantization, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "RBCapacity",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.RBCapacity = parseUint("RBCapacity", v, c) },
|
||||
Validate: func(c *Config) { c.RBCapacity = lessThanOrEqual("RBCapacity", c.RBCapacity, 0, c, defaultRBCapacity) },
|
||||
Name: keyRBCapacity,
|
||||
Type_: typeUint,
|
||||
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) },
|
||||
},
|
||||
{
|
||||
Name: "RBWriteTimeout",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.RBWriteTimeout = parseUint("RBWriteTimeout", v, c) },
|
||||
Name: keyRBWriteTimeout,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.RBWriteTimeout = parseUint(keyRBWriteTimeout, v, c) },
|
||||
Validate: func(c *Config) {
|
||||
c.RBWriteTimeout = lessThanOrEqual("RBWriteTimeout", c.RBWriteTimeout, 0, c, defaultRBWriteTimeout)
|
||||
c.RBWriteTimeout = lessThanOrEqual(keyRBWriteTimeout, c.RBWriteTimeout, 0, c, defaultRBWriteTimeout)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "RecPeriod",
|
||||
Type_: "float",
|
||||
Name: keyRecPeriod,
|
||||
Type_: typeFloat,
|
||||
Update: func(c *Config, v string) {
|
||||
_v, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
c.Logger.Log(logger.Warning, fmt.Sprintf("invalid %s param", "RecPeriod"), "value", v)
|
||||
c.Logger.Log(logger.Warning, fmt.Sprintf("invalid %s param", keyRecPeriod), "value", v)
|
||||
}
|
||||
c.RecPeriod = _v
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Rotation",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Rotation = parseUint("Rotation", v, c) },
|
||||
Name: keyRotation,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Rotation = parseUint(keyRotation, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "RTMPURL",
|
||||
Type_: "string",
|
||||
Name: keyRTMPURL,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.RTMPURL = v },
|
||||
},
|
||||
{
|
||||
Name: "RTPAddress",
|
||||
Type_: "string",
|
||||
Name: keyRTPAddress,
|
||||
Type_: typeString,
|
||||
Update: func(c *Config, v string) { c.RTPAddress = v },
|
||||
Validate: func(c *Config) {
|
||||
if c.RTPAddress == "" {
|
||||
c.LogInvalidField("RTPAddress", defaultRTPAddr)
|
||||
c.LogInvalidField(keyRTPAddress, defaultRTPAddr)
|
||||
c.RTPAddress = defaultRTPAddr
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "SampleRate",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.SampleRate = parseUint("SampleRate", v, c) },
|
||||
Name: keySampleRate,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.SampleRate = parseUint(keySampleRate, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "Saturation",
|
||||
Name: keySaturation,
|
||||
Type_: "int",
|
||||
Update: func(c *Config, v string) {
|
||||
_v, err := strconv.Atoi(v)
|
||||
|
@ -495,24 +558,24 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "Suppress",
|
||||
Type_: "bool",
|
||||
Name: keySuppress,
|
||||
Type_: typeBool,
|
||||
Update: func(c *Config, v string) {
|
||||
c.Suppress = parseBool("Suppress", v, c)
|
||||
c.Suppress = parseBool(keySuppress, v, c)
|
||||
c.Logger.(*logger.Logger).SetSuppress(c.Suppress)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "VBRBitrate",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.VBRBitrate = parseUint("VBRBitrate", v, c) },
|
||||
Name: keyVBRBitrate,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.VBRBitrate = parseUint(keyVBRBitrate, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "VBRQuality",
|
||||
Name: keyVBRQuality,
|
||||
Type_: "enum:standard,fair,good,great,excellent",
|
||||
Update: func(c *Config, v string) {
|
||||
c.VBRQuality = Quality(parseEnum(
|
||||
"VBRQuality",
|
||||
keyVBRQuality,
|
||||
v,
|
||||
map[string]uint8{
|
||||
"standard": uint8(QualityStandard),
|
||||
|
@ -526,14 +589,14 @@ var Variables = []struct {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "VerticalFlip",
|
||||
Type_: "bool",
|
||||
Update: func(c *Config, v string) { c.VerticalFlip = parseBool("VerticalFlip", v, c) },
|
||||
Name: keyVerticalFlip,
|
||||
Type_: typeBool,
|
||||
Update: func(c *Config, v string) { c.VerticalFlip = parseBool(keyVerticalFlip, v, c) },
|
||||
},
|
||||
{
|
||||
Name: "Width",
|
||||
Type_: "uint",
|
||||
Update: func(c *Config, v string) { c.Width = parseUint("Width", v, c) },
|
||||
Name: keyWidth,
|
||||
Type_: typeUint,
|
||||
Update: func(c *Config, v string) { c.Width = parseUint(keyWidth, v, c) },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue