From f82c26ee628af8d51ec6b460893220ea8332f6d0 Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 18 Nov 2018 13:23:14 +1030 Subject: [PATCH] rtp: added udp output and rtp packetisation options to revid-cli --- cmd/revid-cli/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 3f11f042..0ade1a26 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -72,6 +72,7 @@ const ( verticalFlipPtr horizontalFlipPtr logPathPtr + udpAddrPtr noOfConfigFlags ) @@ -83,6 +84,7 @@ const ( revidStopTime = 5 * time.Second defaultLogPath = "/var/log/netsender/" pkg = "revid-cli:" + defaultUdpAddr = "localhost:6970" ) // canProfile is set to false with revid-cli is built with "-tags profile". @@ -106,10 +108,10 @@ 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"}, + {"Output", "The output type: Http, Rtmp, File, Udp"}, {"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"}, + {"Packetization", "The method of data packetisation: Flv, Mpegts, Rtp, None"}, {"QuantizationMode", "Whether quantization if on or off (variable bitrate): On, Off"}, {"Verbosity", "Verbosity: Info, Warning, Error, Fatal"}, {"FramesPerClip", "Number of frames per clip sent"}, @@ -127,6 +129,7 @@ var ( {"VerticalFlip", "Flip video vertically: Yes, No"}, {"HorizontalFlip", "Flip video horizontally: Yes, No"}, {"LogPath", "Path for logging files (default is /var/log/netsender/)"}, + {"UdpAddr", "UDP destination address: : (port is generally 6970-6999)"}, } ) @@ -209,6 +212,8 @@ func handleFlags() { config.Output = revid.Rtmp case "FfmpegRtmp": config.Output = revid.FfmpegRtmp + case "Udp": + config.Output = revid.Udp case "": default: logger.Log(smartlogger.Error, pkg+"bad output argument") @@ -231,6 +236,8 @@ func handleFlags() { config.Packetization = revid.Mpegts case "Flv": config.Packetization = revid.Flv + case "Rtp": + config.Packetization = revid.Rtp case "": default: logger.Log(smartlogger.Error, pkg+"bad packetization argument") @@ -293,6 +300,7 @@ func handleFlags() { config.Quantization = *configFlags[quantizationPtr] config.Timeout = *configFlags[timeoutPtr] config.IntraRefreshPeriod = *configFlags[intraRefreshPeriodPtr] + config.UdpAddress = *configFlags[udpAddrPtr] } // initialize then run the main NetSender client