From 315ba6bd767587f5f77ea66389f97c35f14d1570 Mon Sep 17 00:00:00 2001 From: saxon Date: Wed, 21 Nov 2018 18:14:36 +1030 Subject: [PATCH] revid: back to working state --- cmd/revid-cli/main.go | 9 +++++++-- revid/config.go | 13 ------------- revid/revid.go | 2 ++ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index e069956c..47dd0226 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -30,6 +30,7 @@ package main import ( "flag" + "fmt" "os" "runtime/pprof" "strconv" @@ -107,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, Udp"}, + {"Output", "The 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, Rtp, None"}, + {"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"}, {"FramesPerClip", "Number of frames per clip sent"}, @@ -213,6 +214,10 @@ func handleFlags() { config.Output = revid.FfmpegRtmp case "Udp": config.Output = revid.Udp + case "Rtp": + fmt.Println("rtp output") + config.Output = revid.Rtp + config.Packetization = revid.MpegtsRtp case "": default: logger.Log(smartlogger.Error, pkg+"bad output argument") diff --git a/revid/config.go b/revid/config.go index 241df8b4..eccbf29a 100644 --- a/revid/config.go +++ b/revid/config.go @@ -208,19 +208,6 @@ func (c *Config) Validate(r *Revid) error { return errors.New("bad output type defined in config") } - switch c.Packetization { - case None: - case Mpegts: - case Flv: - case Rtp: - case NothingDefined: - c.Logger.Log(smartlogger.Warning, pkg+"no packetization option defined, defaulting", - "packetization", defaultPacketization) - c.Packetization = defaultPacketization - default: - return errors.New("bad packetization option defined in config") - } - switch c.HorizontalFlip { case Yes: case No: diff --git a/revid/revid.go b/revid/revid.go index 15088494..4b1ed4f8 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -228,6 +228,7 @@ func (r *Revid) reset(config Config) error { case Http: r.destination = newHttpSender(r.ns, r.config.Logger.Log) case Rtp: + fmt.Println("here") s, err := newUdpSender(r.config.RtpAddress, r.config.Logger.Log) if err != nil { return err @@ -279,6 +280,7 @@ func (r *Revid) reset(config Config) error { return err } case MpegtsRtp: + fmt.Println("here") r.config.Logger.Log(smartlogger.Info, pkg+"using RTP packetisation") frameRate, _ := strconv.Atoi(r.config.FrameRate) r.encoder = rtp.NewEncoder(&r.packer, frameRate)