Merged in revid-output-var (pull request #312)

revid: Output var

Approved-by: Saxon Milton <saxon.milton@gmail.com>
This commit is contained in:
Scott Barnard 2019-12-31 03:56:13 +00:00 committed by Saxon Milton
commit edcb8090ff
2 changed files with 18 additions and 2 deletions

View File

@ -292,6 +292,7 @@ var TypeData = map[string]string{
"MTSRBSize": "int", "MTSRBSize": "int",
"MTSRBWriteTimeout": "int", "MTSRBWriteTimeout": "int",
"OutputPath": "string", "OutputPath": "string",
"Output": "enum:File,Http,Rtmp,Rtp",
"Outputs": "string", "Outputs": "string",
"Quantization": "uint", "Quantization": "uint",
"Rotation": "uint", "Rotation": "uint",

View File

@ -523,7 +523,7 @@ func (r *Revid) Update(vars map[string]string) error {
default: default:
r.cfg.Logger.Log(logger.Warning, pkg+"invalid InputCodec variable value", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid InputCodec variable value", "value", value)
} }
case "Output": case "Outputs":
outputs := strings.Split(value, ",") outputs := strings.Split(value, ",")
r.cfg.Outputs = make([]uint8, len(outputs)) r.cfg.Outputs = make([]uint8, len(outputs))
@ -538,10 +538,25 @@ func (r *Revid) Update(vars map[string]string) error {
case "Rtp": case "Rtp":
r.cfg.Outputs[i] = config.OutputRTP r.cfg.Outputs[i] = config.OutputRTP
default: default:
r.cfg.Logger.Log(logger.Warning, pkg+"invalid output param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid outputs param", "value", value)
continue continue
} }
} }
case "Output":
r.cfg.Outputs = make([]uint8, 1)
switch value {
case "File":
r.cfg.Outputs[0] = config.OutputFile
case "Http":
r.cfg.Outputs[0] = config.OutputHTTP
case "Rtmp":
r.cfg.Outputs[0] = config.OutputRTMP
case "Rtp":
r.cfg.Outputs[0] = config.OutputRTP
default:
r.cfg.Logger.Log(logger.Warning, pkg+"invalid output param", "value", value)
continue
}
case "RtmpUrl": case "RtmpUrl":
r.cfg.RTMPURL = value r.cfg.RTMPURL = value