diff --git a/cmd/rvcl/main.go b/cmd/rvcl/main.go new file mode 100644 index 00000000..123edc41 --- /dev/null +++ b/cmd/rvcl/main.go @@ -0,0 +1,208 @@ +/* +██████╗ ██╗ ██╗ ██████╗██╗ +██╔══██╗██║ ██║██╔════╝██║ +██████╔╝██║ ██║██║ ██║ +██╔══██╗╚██╗ ██╔╝██║ ██║ +██║ ██║ ╚████╔╝ ╚██████╗███████╗ +╚═╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝ + +DESCRIPTION + rvcl is command line interface for revid. The user can provide configuration + by passing a JSON string directly, or by specifying a file containing the JSON. + +AUTHORS + Saxon A. Nelson-Milton + Dan Kortschak + Scott Barnard + +LICENSE + Copyright (C) 2020 the Australian Ocean Lab (AusOcean) + + It is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with revid in gpl.txt. If not, see http://www.gnu.org/licenses. + +USAGE + User may providied path to a config JSON file using the 'config-file' flag. + For example, to stream a H.264 file to youtube we will need to create a file + containing configuration JSON: + { + "Input":"file", + "InputPath":"", + "Output":"rtmp", + "RtmpUrl":"", + "FileFPS":"25" + } + + Then, using rvcl we can stream: + + ./rvcl -config-file="config.json" + + We can also use the 'config' flag to directly pass JSON as a string. + NB: Quotations must have backslashes, '\', proceeding them for rvcl to consider + the string valid JSON. For example, to play a file to youtube using the JSON + config described above, we would do the following: + + ./rvcl -config="{\"Input\":\"file\",\"InputPath\":\"\", + \"Output\":\"rtmp\",\"RtmpUrl\":\"\",\"FileFPS\":\"25\"}" + + rvcl passes given variables to revid i.e. all variables defined by revid are + valid. See revid config package i.e. bitbucket.org/ausocean/av/revid/config for + revid specific variables, and see AVDevice implementations i.e. + bitbucket.org/ausocean/av/device for input device specific variables. +*/ + +// rvcl is a command line interface for revid. +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io" + "os" + "runtime/pprof" + + "gopkg.in/natefinch/lumberjack.v2" + + "bitbucket.org/ausocean/av/container/mts" + "bitbucket.org/ausocean/av/container/mts/meta" + "bitbucket.org/ausocean/av/revid" + "bitbucket.org/ausocean/av/revid/config" + "bitbucket.org/ausocean/iot/pi/netsender" + "bitbucket.org/ausocean/utils/logger" +) + +// Copyright information prefixed to all metadata. +const ( + metaPreambleKey = "copyright" + metaPreambleData = "ausocean.org/license/content2019" +) + +// Logging configuration. +const ( + logMaxSize = 500 // MB + logMaxBackups = 10 + logMaxAge = 28 // days + logLevel = logger.Debug + logPath = "/var/log/netsender/netsender.log" + logSuppress = false +) + +// Misc consts. +const ( + pkg = "rvcl: " + profilePath = "rvcl.prof" +) + +// canProfile is set to false with revid-cli is built with "-tags profile". +var canProfile = false + +// The logger that will be used throughout. +var log *logger.Logger + +func main() { + mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}}) + + // If built with profile tag, we will start CPU profiling. + if canProfile { + profile() + defer pprof.StopCPUProfile() + } + + // User can provide config through single JSON string flag, or through JSON file. + var ( + configPtr = flag.String("config", "", "Provide configuration JSON to revid (see readme for further information).") + configFilePtr = flag.String("config-file", "", "Location of revid configuration file (see readme for further information).") + ) + flag.Parse() + + // Create config map according to flags or file, and panic if both are defined. + var ( + cfg map[string]string + err error + ) + switch { + case *configPtr != "" && *configFilePtr != "": // This doesn't make sense so panic. + panic("cannot define both command-line config and file config") + case *configPtr != "": // Decode JSON file to map. + err = json.Unmarshal([]byte(*configPtr), &cfg) + if err != nil { + panic(fmt.Sprintf("could not decode JSON config: %w", err)) + } + case *configFilePtr != "": // Decode JSON string to map from command line flag. + f, err := os.Open(*configFilePtr) + if err != nil { + panic(fmt.Sprintf("could not open config file: %w", err)) + } + err = json.NewDecoder(f).Decode(&cfg) + if err != nil { + panic(fmt.Sprintf("could not decode JSON config: %w", err)) + } + default: // No config information has been provided; give empty map to force defaults. + cfg = map[string]string{} + } + + // Create logger that methods will be called on by the netsender client and + // revid to log messages. Logs will go the lumberjack logger to handle file + // writing of messages. + log = logger.New( + logLevel, + io.MultiWriter( + &lumberjack.Logger{ + Filename: logPath, + MaxSize: logMaxSize, // MB + MaxBackups: logMaxBackups, + MaxAge: logMaxAge, // days + }, + ), + logSuppress, + ) + + // Create a netsender client. This is used only for HTTP sending of media + // in this binary. + ns, err := netsender.New(log, nil, nil, nil, nil) + if err != nil { + log.Log(logger.Fatal, pkg+"could not initialise netsender client: "+err.Error()) + } + + rv, err := revid.New(config.Config{Logger: log}, ns) + if err != nil { + panic(fmt.Sprintf("could not create revid: %w", err)) + } + + // Configure revid with configuration map obtained through flags or file. + // If config is empty, defaults will be adopted by revid. + err = rv.Update(cfg) + if err != nil { + panic(fmt.Sprintf("could not update revid config: %w", err)) + } + + err = rv.Start() + if err != nil { + panic(fmt.Sprintf("could not start revid: %w", err)) + } + + // Run indefinitely. + select {} +} + +// profile creates a file to hold CPU profile metrics and begins CPU profiling. +func profile() { + f, err := os.Create(profilePath) + if err != nil { + log.Log(logger.Fatal, pkg+"could not create CPU profile", "error", err.Error()) + } + if err := pprof.StartCPUProfile(f); err != nil { + log.Log(logger.Fatal, pkg+"could not start CPU profile", "error", err.Error()) + } +} diff --git a/cmd/rvcl/profile.go b/cmd/rvcl/profile.go new file mode 100644 index 00000000..22a8c8b1 --- /dev/null +++ b/cmd/rvcl/profile.go @@ -0,0 +1,34 @@ +// +build profile + +/* +DESCRIPTION + profile.go provides an init function for setting canProfile flag to true to + allow for CPU profiling. + +AUTHORS + Dan Kortschak + +LICENSE + Copyright (C) 2020 the Australian Ocean Lab (AusOcean) + + It is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with revid in gpl.txt. If not, see http://www.gnu.org/licenses. +*/ + +package main + +import _ "net/http/pprof" + +func init() { + canProfile = true +} diff --git a/cmd/rvcl/run.sh b/cmd/rvcl/run.sh new file mode 100644 index 00000000..0110c77f --- /dev/null +++ b/cmd/rvcl/run.sh @@ -0,0 +1,4 @@ +#!/bin/sh +REVIDPATH=$HOME/go/src/bitbucket.org/ausocean/av/cmd/rvcl +cd $REVIDPATH +sudo "PATH=$PATH:$REVIDPATH" ./rvcl -NetSender & diff --git a/cmd/rvcl/upgrade.sh b/cmd/rvcl/upgrade.sh new file mode 100644 index 00000000..46cfac2a --- /dev/null +++ b/cmd/rvcl/upgrade.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# All-purpose upgrade script. +# Upgrades source(s) to given Git tag, runs make in each directory, +# and write tags to tags.conf upon success, exiting 0. +# NB: Customize SrcDirs as needed to reflect dependencies. +Usage="Usage: upgrade.sh [-d] tag" +BaseDir=$GOPATH/src/bitbucket.org/ausocean +VarDir=/var/netsender +LogFile=/var/log/netsender/stream.log +SrcDirs=($BaseDir/utils $BaseDir/iot $BaseDir/av) +if [ "$1" == "-d" ]; then + set -x + GitFlags="" + NewTag="$2" +else + # capture stdout and stderr + exec 2> $LogFile + exec 1>&2 + GitFlags="--quiet" + NewTag="$1" +fi +if [ -z "$GOPATH" ]; then + echo "Error: GOPATH not defined" + exit 1 +fi +if [ -z "$NewTag" ]; then + echo "$Usage" + exit 1 +fi +for dir in ${SrcDirs[@]}; do + pushd $dir + if [ ! "$?" == 0 ]; then + exit 1 + fi + git fetch $GitFlags --depth=1 origin refs/tags/$NewTag:refs/tags/$NewTag + if [ ! "$?" == 0 ]; then + exit 1 + fi + git checkout $GitFlags --force tags/$NewTag + if [ ! "$?" == 0 ]; then + exit 1 + fi + if [ -e Makefile ]; then + make + if [ ! "$?" == 0 ]; then + exit 1 + fi + fi + popd +done +if [ ! -d "$VarDir" ]; then + echo "Error: $VarDir does not exit." + exit 1 +fi +git tag > "$VarDir/tags.conf" +exit $? diff --git a/go.mod b/go.mod index dfa6f093..75b0091e 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/Comcast/gots v0.0.0-20190305015453-8d56e473f0f7 github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480 github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884 + github.com/go-delve/delve v1.3.2 github.com/mewkiz/flac v1.0.5 github.com/pkg/errors v0.8.1 github.com/yobert/alsa v0.0.0-20180630182551-d38d89fa843e diff --git a/go.sum b/go.sum index d74fe617..c63ee621 100644 --- a/go.sum +++ b/go.sum @@ -23,16 +23,24 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/adrianmo/go-nmea v1.1.1-0.20190109062325-c448653979f7/go.mod h1:HHPxPAm2kmev+61qmkZh7xgZF/7qHtSpsWppip2Ipv8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ= +github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-audio/aiff v0.0.0-20180403003018-6c3a8a6aff12/go.mod h1:AMSAp6W1zd0koOdX6QDgGIuBDTUvLa2SLQtm7d9eM3c= github.com/go-audio/audio v0.0.0-20180206231410-b697a35b5608/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480 h1:4sGU+UABMMsRJyD+Y2yzMYxq0GJFUsRRESI0P1gZ2ig= github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884 h1:2TaXIaVA4ff/MHHezOj83tCypALTFAcXOImcFWNa3jw= github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884/go.mod h1:UiqzUyfX0zs3pJ/DPyvS5v8sN6s5bXPUDDIVA5v8dks= +github.com/go-delve/delve v1.3.2 h1:K8VjV+Q2YnBYlPq0ctjrvc9h7h03wXszlszzfGW5Tog= +github.com/go-delve/delve v1.3.2/go.mod h1:LLw6qJfIsRK9WcwV2IRRqsdlgrqzOeuGrQOCOIhDpt8= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jacobsa/go-serial v0.0.0-20180131005756-15cf729a72d4/go.mod h1:2RvX5ZjVtsznNZPEt4xwJXNJrM3VTZoQf7V6gk0ysvs= github.com/kidoman/embd v0.0.0-20170508013040-d3d8c0c5c68d/go.mod h1:ACKj9jnzOzj1lw2ETilpFGK7L9dtJhAzT7T1OhAGtRQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -42,14 +50,25 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattetti/audio v0.0.0-20180912171649-01576cde1f21 h1:Hc1iKlyxNHp3CV59G2E/qabUkHvEwOIJxDK0CJ7CRjA= github.com/mattetti/audio v0.0.0-20180912171649-01576cde1f21/go.mod h1:LlQmBGkOuV/SKzEDXBPKauvN2UqCgzXO2XjecTGj40s= +github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mewkiz/flac v1.0.5 h1:dHGW/2kf+/KZ2GGqSVayNEhL9pluKn/rr/h/QqD9Ogc= github.com/mewkiz/flac v1.0.5/go.mod h1:EHZNU32dMF6alpurYyKHDLYpW1lYpBZ5WrXi/VuNIGs= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v0.0.0-20170413231811-06b906832ed0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday v0.0.0-20180428102519-11635eb403ff/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sirupsen/logrus v0.0.0-20180523074243-ea8897e79973/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -57,6 +76,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/yobert/alsa v0.0.0-20180630182551-d38d89fa843e h1:3NIzz7weXhh3NToPgbtlQtKiVgerEaG4/nY2skGoGG0= github.com/yobert/alsa v0.0.0-20180630182551-d38d89fa843e/go.mod h1:CaowXBWOiSGWEpBBV8LoVnQTVPV4ycyviC9IBLj8dRw= github.com/yryz/ds18b20 v0.0.0-20180211073435-3cf383a40624/go.mod h1:MqFju5qeLDFh+S9PqxYT7TEla8xeW7bgGr/69q3oki0= +go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg= go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= @@ -66,12 +86,25 @@ go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= gocv.io/x/gocv v0.21.0 h1:dVjagrupZrfCRY0qPEaYWgoNMRpBel6GYDH4mvQOK8Y= gocv.io/x/gocv v0.21.0/go.mod h1:Rar2PS6DV+T4FL+PM535EImD/h13hGVaHhnCu1xarBs= +golang.org/x/arch v0.0.0-20171004143515-077ac972c2e4/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= +golang.org/x/crypto v0.0.0-20180614174826-fd5f17ee7299/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20181120060634-fc4f04983f62/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/revid/revid.go b/revid/revid.go index 65f0a295..4d0866d2 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -567,14 +567,14 @@ func (r *Revid) Update(vars map[string]string) error { } case "Output": r.cfg.Outputs = make([]uint8, 1) - switch value { - case "File": + switch strings.ToLower(value) { + case "file": r.cfg.Outputs[0] = config.OutputFile - case "Http": + case "http": r.cfg.Outputs[0] = config.OutputHTTP - case "Rtmp": + case "rtmp": r.cfg.Outputs[0] = config.OutputRTMP - case "Rtp": + case "rtp": r.cfg.Outputs[0] = config.OutputRTP default: r.cfg.Logger.Log(logger.Warning, pkg+"invalid output param", "value", value)