From 446dbd73e7a6c4f261198686d158a3d825800034 Mon Sep 17 00:00:00 2001 From: Saxon1 Date: Thu, 19 Apr 2018 17:41:18 +0930 Subject: [PATCH] Fixing syntax errors again --- RevidCLI.go | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/RevidCLI.go b/RevidCLI.go index 6fbc1afc..5d9b1f8e 100644 --- a/RevidCLI.go +++ b/RevidCLI.go @@ -35,7 +35,7 @@ import ( "bitbucket.org/ausocean/IoT/pi/netsender" ) -// Indexes for flags +// Indexes for configFlags const ( inputPtr = 0 inputCodecPtr = 1 @@ -62,7 +62,7 @@ const ( const ( sleepTime = 2 * 43200 defaultRunDuration = 2 * 43200 - noOfConfigFlags = 20 + noOfConfigconfigFlags = 20 revidStopTime = 5 ) @@ -71,7 +71,7 @@ var ( configReceived bool = true varSum int = 0 vars = make(map[string]string) - revid revid.Revid + revidInst revid.Revid config revid.Config ) @@ -98,10 +98,10 @@ func main() { {"IntraRefreshPeriod", "The IntraRefreshPeriod i.e. how many keyframes we send"}, } - // Create the flags based on the flagNames array - var configFlags [noOfConfigFlags](*string) + // Create the configFlags based on the flagNames array + var configFlags [noOfConfigconfigFlags](*string) for i := 0; i < 20; i++ { - flags[i] = flag.String(flagNames[i][0], "", flagNames[i][1]) + configFlags[i] = flag.String(flagNames[i][0], "", flagNames[i][1]) } // Do we want a netsender session @@ -111,7 +111,7 @@ func main() { flag.Parse() - switch flags[inputPtr] { + switch configFlags[inputPtr] { case "Raspivid": config.Input = Raspivid case "Rtp": @@ -120,12 +120,12 @@ func main() { config.Input = File } - switch flags[inputCodecPtr] { + switch configFlags[inputCodecPtr] { case "H264Codec": config.InputCodec = H264Codec } - switch flags[outputPtr] { + switch configFlags[outputPtr] { case "File": config.Output = File case "Http": @@ -134,14 +134,14 @@ func main() { config.Output = Rtmp } - switch flags[rtmpMethodPtr] { + switch configFlags[rtmpMethodPtr] { case "Ffmpeg": config.RtmpMethod = Ffmpeg case "LibRtmp": config.RtmpMethod = LibRtmp } - switch flags[packetisationPtr] { + switch configFlags[packetisationPtr] { case "None": config.Packetisation = None case "Rtp": @@ -150,35 +150,35 @@ func main() { config.Packetisation = Flv } - switch flags[quantisationModePtr] { + switch configFlags[quantisationModePtr] { case "QuantizationOn": config.Quantization = QuantizationOn case "QuantizationOff": config.Quantization = QuantizationOff } - switch flags[verbosityPtr] { + switch configFlags[verbosityPtr] { case "No": config.Verbosity = No case "Yes": config.Verbosity = Yes } - config.FramesPerClip = flags[framesPerClipPtr] - config.RtmpUrl = flags[rtmpUrlPtr] - config.Bitrate = flags[bitratePtr] - config.OutputFileName = flags[outputFileNamePtr] - config.InputFileName = flags[inputFileNamePtr] - config.Height = flags[heightPtr] - config.Width = flags[widthPtr] - config.FrameRate = flags[frameRatePtr] - config.HttpAddress = flags[httpAddressPtr] - config.Quantization = flags[quantisationPtr] - config.Timeout = flags[timeoutPtr] - config.IntraRefreshPeriod = flags[intraRefreshPeriodPtr] + config.FramesPerClip = configFlags[framesPerClipPtr] + config.RtmpUrl = configFlags[rtmpUrlPtr] + config.Bitrate = configFlags[bitratePtr] + config.OutputFileName = configFlags[outputFileNamePtr] + config.InputFileName = configFlags[inputFileNamePtr] + config.Height = configFlags[heightPtr] + config.Width = configFlags[widthPtr] + config.FrameRate = configFlags[frameRatePtr] + config.HttpAddress = configFlags[httpAddressPtr] + config.Quantization = configFlags[quantisationPtr] + config.Timeout = configFlags[timeoutPtr] + config.IntraRefreshPeriod = configFlags[intraRefreshPeriodPtr] createRevidInstance() - revid.Start() + revidInst.Start() // Is the netsender flag been used ? if so run this loop for *netSenderFlagPtr { @@ -235,7 +235,7 @@ func periodicNetsenderReport(){ } func updateRevid() { - revid.Stop() + revidInst.Stop() time.Sleep( time.Duration(revidStopTime) * time.Second ) for key, value := range vars { switch key { @@ -291,7 +291,7 @@ func updateRevid() { } createRevidInstance() - revid.Start() + revidInst.Start() } func revidReportActions(pin int) (int, error) { @@ -385,7 +385,7 @@ func revidReportActions(pin int) (int, error) { func createRevidInstance(){ // Try to create the revid instance with the given config - for revid, err := revid.NewRevid(config); err != nil; { + for revidInst, err := revid.NewRevid(config); err != nil; { // If the config does have a logger, use it to output error, otherwise // just output to std output if config.Logger != nil {