rtp: added udp output and rtp packetisation options to revid-cli

This commit is contained in:
saxon 2018-11-18 13:23:14 +10:30
parent 3515958a99
commit f82c26ee62
1 changed files with 10 additions and 2 deletions

View File

@ -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: <IP>:<port> (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