making cli more robust

This commit is contained in:
Saxon1 2018-04-19 19:07:25 +09:30
parent bb4c80ccef
commit e0c1667fcc
1 changed files with 21 additions and 0 deletions

View File

@ -137,11 +137,17 @@ func main() {
config.Input = revid.Rtp
case "File":
config.Input = revid.File
case "":
default:
fmt.Println("Bad input argument!")
}
switch *configFlags[inputCodecPtr] {
case "H264Codec":
config.InputCodec = revid.H264Codec
case "":
default:
fmt.Println("Bad input codec argument!")
}
switch *configFlags[outputPtr] {
@ -151,6 +157,9 @@ func main() {
config.Output = revid.Http
case "Rtmp":
config.Output = revid.Rtmp
case "":
default:
fmt.Println("Bad output argument!")
}
switch *configFlags[rtmpMethodPtr] {
@ -158,6 +167,9 @@ func main() {
config.RtmpMethod = revid.Ffmpeg
case "LibRtmp":
config.RtmpMethod = revid.LibRtmp
case "":
default:
fmt.Println("Bad rtmp method argument!")
}
switch *configFlags[packetizationPtr] {
@ -167,6 +179,9 @@ func main() {
config.Packetization = revid.Rtp
case "Flv":
config.Packetization = revid.Flv
case "":
default:
fmt.Println("Bad packetization argument!")
}
switch *configFlags[quantizationModePtr] {
@ -174,6 +189,9 @@ func main() {
config.QuantizationMode = revid.QuantizationOn
case "QuantizationOff":
config.QuantizationMode = revid.QuantizationOff
case "":
default:
fmt.Println("Bad quantization mode argument!")
}
switch *configFlags[verbosityPtr] {
@ -181,6 +199,9 @@ func main() {
config.Verbosity = revid.No
case "Yes":
config.Verbosity = revid.Yes
case "":
default:
fmt.Println("Bad verbosity argument!")
}
config.FramesPerClip = *configFlags[framesPerClipPtr]