mirror of https://bitbucket.org/ausocean/av.git
Fixing syntax errors again
This commit is contained in:
parent
01b99b3c14
commit
446dbd73e7
58
RevidCLI.go
58
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 {
|
||||
|
|
Loading…
Reference in New Issue