From 218dcfb8b2376cc2a2e9501b64f6f9b8fd0b99cb Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 25 Nov 2018 23:24:03 +1030 Subject: [PATCH] revid-cli: removed concept of mpegtsrtp packetization as not needed anymore --- cmd/revid-cli/main.go | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 58c094f6..bfd8f35f 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -52,7 +52,8 @@ const ( const ( inputPtr = iota inputCodecPtr - outputPtr + output1Ptr + output2Ptr rtmpMethodPtr packetizationPtr quantizationModePtr @@ -107,9 +108,9 @@ var ( flagNames = [noOfConfigFlags]struct{ name, description string }{ {"Input", "The input type: Raspivid, File"}, {"InputCodec", "The codec of the input: H264, Mjpeg"}, - {"Output", "The output type: Http, Rtmp, File, Udp, Rtp"}, + {"Output1", "The first output type: Http, Rtmp, File, Udp, Rtp"}, + {"Output2", "The second output type: Http, Rtmp, File, Udp, Rtp"}, {"RtmpMethod", "The method used to send over rtmp: Ffmpeg, Librtmp"}, - // NOTE: we add rtp here when we have this functionality {"Packetization", "The method of data packetisation: Flv, Mpegts, None"}, {"QuantizationMode", "Whether quantization if on or off (variable bitrate): On, Off"}, {"Verbosity", "Verbosity: Info, Warning, Error, Fatal"}, @@ -202,23 +203,40 @@ func handleFlags() { logger.Log(smartlogger.Error, pkg+"bad input codec argument") } - switch *configFlags[outputPtr] { + switch *configFlags[output1Ptr] { case "File": - config.Output = revid.File + config.Output1 = revid.File case "Http": - config.Output = revid.Http + config.Output1 = revid.Http case "Rtmp": - config.Output = revid.Rtmp + config.Output1 = revid.Rtmp case "FfmpegRtmp": - config.Output = revid.FfmpegRtmp + config.Output1 = revid.FfmpegRtmp case "Udp": - config.Output = revid.Udp + config.Output1 = revid.Udp case "Rtp": - config.Output = revid.Rtp - config.Packetization = revid.MpegtsRtp + config.Output1 = revid.Rtp case "": default: - logger.Log(smartlogger.Error, pkg+"bad output argument") + logger.Log(smartlogger.Error, pkg+"bad output 1 argument") + } + + switch *configFlags[output2Ptr] { + case "File": + config.Output2 = revid.File + case "Http": + config.Output2 = revid.Http + case "Rtmp": + config.Output2 = revid.Rtmp + case "FfmpegRtmp": + config.Output2 = revid.FfmpegRtmp + case "Udp": + config.Output2 = revid.Udp + case "Rtp": + config.Output2 = revid.Rtp + case "": + default: + logger.Log(smartlogger.Error, pkg+"bad output 2 argument") } switch *configFlags[rtmpMethodPtr] { @@ -238,8 +256,6 @@ func handleFlags() { config.Packetization = revid.Mpegts case "Flv": config.Packetization = revid.Flv - case "MpegtsRtp": - config.Packetization = revid.MpegtsRtp case "": default: logger.Log(smartlogger.Error, pkg+"bad packetization argument") @@ -418,15 +434,15 @@ func updateRevid(ns *netsender.Sender, vars map[string]string, stop bool) error case "Output": switch value { case "File": - config.Output = revid.File + config.Output1 = revid.File case "Http": - config.Output = revid.Http + config.Output1 = revid.Http case "Rtmp": - config.Output = revid.Rtmp + config.Output1 = revid.Rtmp case "FfmpegRtmp": - config.Output = revid.FfmpegRtmp + config.Output1 = revid.FfmpegRtmp default: - logger.Log(smartlogger.Warning, pkg+"invalid Output param", "value", value) + logger.Log(smartlogger.Warning, pkg+"invalid Output1 param", "value", value) continue } case "FramesPerClip":