Merged in csv-output-var (pull request #160)

revid: handling csv output var in revid's update function

Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Saxon Milton 2019-03-05 06:44:27 +00:00
commit 768ea3a007
1 changed files with 21 additions and 17 deletions

View File

@ -371,23 +371,25 @@ func (r *Revid) Update(vars map[string]string) error {
for key, value := range vars { for key, value := range vars {
switch key { switch key {
case "Output": case "Output":
r.config.Outputs = make([]uint8, 1) outputs := strings.Split(value, ",")
// FIXME(kortschak): There can be only one! r.config.Outputs = make([]uint8, len(outputs))
// How do we specify outputs after the first?
// for i, output := range outputs {
// Maybe we shouldn't be doing this! switch output {
switch value { case "File":
case "File": r.config.Outputs[i] = File
r.config.Outputs[0] = File case "Http":
case "Http": r.config.Outputs[i] = Http
r.config.Outputs[0] = Http case "Rtmp":
case "Rtmp": r.config.Outputs[i] = Rtmp
r.config.Outputs[0] = Rtmp case "FfmpegRtmp":
case "FfmpegRtmp": r.config.Outputs[i] = FfmpegRtmp
r.config.Outputs[0] = FfmpegRtmp case "Rtp":
default: r.config.Outputs[i] = Rtp
r.config.Logger.Log(logger.Warning, pkg+"invalid Output1 param", "value", value) default:
continue r.config.Logger.Log(logger.Warning, pkg+"invalid output param", "value", value)
continue
}
} }
case "Packetization": case "Packetization":
@ -409,6 +411,8 @@ func (r *Revid) Update(vars map[string]string) error {
r.config.FramesPerClip = uint(f) r.config.FramesPerClip = uint(f)
case "RtmpUrl": case "RtmpUrl":
r.config.RtmpUrl = value r.config.RtmpUrl = value
case "RtpAddr":
r.config.RtpAddress = value
case "Bitrate": case "Bitrate":
v, err := strconv.ParseUint(value, 10, 0) v, err := strconv.ParseUint(value, 10, 0)
if err != nil { if err != nil {