From 835f97203a030acf153be501d8565f8f9a806342 Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 13 May 2019 16:23:38 +0930 Subject: [PATCH] revid: config fields that are exported and acronyms now capitalized. --- cmd/revid-cli/main.go | 6 +++--- revid/config.go | 18 +++++++++--------- revid/revid.go | 10 +++++----- revid/revid_test.go | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 51b3d31f..c4729b2a 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -217,17 +217,17 @@ func handleFlags() revid.Config { cfg.FlipHorizontal = *horizontalFlipPtr cfg.FlipVertical = *verticalFlipPtr cfg.FramesPerClip = *framesPerClipPtr - cfg.RtmpUrl = *rtmpUrlPtr + cfg.RTMPURL = *rtmpUrlPtr cfg.Bitrate = *bitratePtr cfg.OutputPath = *outputPathPtr cfg.InputPath = *inputFilePtr cfg.Height = *heightPtr cfg.Width = *widthPtr cfg.FrameRate = *frameRatePtr - cfg.HttpAddress = *httpAddressPtr + cfg.HTTPAddress = *httpAddressPtr cfg.Quantization = *quantizationPtr cfg.IntraRefreshPeriod = *intraRefreshPeriodPtr - cfg.RtpAddress = *rtpAddrPtr + cfg.RTPAddress = *rtpAddrPtr cfg.SendRetry = *sendRetryPtr cfg.Brightness = *brightnessPtr cfg.Saturation = *saturationPtr diff --git a/revid/config.go b/revid/config.go index b42059f4..b71256a1 100644 --- a/revid/config.go +++ b/revid/config.go @@ -141,13 +141,13 @@ type Config struct { // File: // Location must be defined by the OutputPath field. MPEG-TS packetization // is used. - // Http: + // HTTP: // Destination is defined by the sh field located in /etc/netsender.conf. // MPEGT-TS packetization is used. - // Rtmp: + // RTMP: // Destination URL must be defined in the RtmpUrl field. FLV packetization // is used. - // Rtp: + // RTP: // Destination is defined by RtpAddr field, otherwise it will default to // localhost:6970. MPEGT-TS packetization is used. Outputs []uint8 @@ -164,17 +164,17 @@ type Config struct { // RtmpUrl specifies the Rtmp output destination URL. This must be defined if // RTMP is to be used as an output. - RtmpUrl string + RTMPURL string Bitrate uint OutputPath string InputPath string Height uint Width uint FrameRate uint - HttpAddress string + HTTPAddress string Quantization uint IntraRefreshPeriod uint - RtpAddress string + RTPAddress string Logger Logger SendRetry bool BurstPeriod uint @@ -242,7 +242,7 @@ func (c *Config) Validate(r *Revid) error { switch o { case File: case RTMP: - if c.RtmpUrl == "" { + if c.RTMPURL == "" { c.Logger.Log(logger.Info, pkg+"no RTMP URL: falling back to HTTP") c.Outputs[i] = HTTP // FIXME(kortschak): Does this want the same line as below? @@ -308,8 +308,8 @@ func (c *Config) Validate(r *Revid) error { return errors.New("quantisation is over threshold") } - if c.RtpAddress == "" { - c.RtpAddress = defaultRtpAddr + if c.RTPAddress == "" { + c.RTPAddress = defaultRtpAddr } switch { diff --git a/revid/revid.go b/revid/revid.go index 92f8b35f..88657a2d 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -216,7 +216,7 @@ func (r *Revid) setupPipeline(mtsEnc, flvEnc func(dst io.WriteCloser, rate int) w = newMtsSender(newHttpSender(r.ns, r.config.Logger.Log), r.config.Logger.Log, rbSize, rbElementSize, 0) mtsSenders = append(mtsSenders, w) case RTP: - w, err := newRtpSender(r.config.RtpAddress, r.config.Logger.Log, r.config.FrameRate) + w, err := newRtpSender(r.config.RTPAddress, r.config.Logger.Log, r.config.FrameRate) if err != nil { r.config.Logger.Log(logger.Warning, pkg+"rtp connect error", "error", err.Error()) } @@ -228,7 +228,7 @@ func (r *Revid) setupPipeline(mtsEnc, flvEnc func(dst io.WriteCloser, rate int) } mtsSenders = append(mtsSenders, w) case RTMP: - w, err := newRtmpSender(r.config.RtmpUrl, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log) + w, err := newRtmpSender(r.config.RTMPURL, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log) if err != nil { r.config.Logger.Log(logger.Warning, pkg+"rtmp connect error", "error", err.Error()) } @@ -378,9 +378,9 @@ func (r *Revid) Update(vars map[string]string) error { } case "RtmpUrl": - r.config.RtmpUrl = value + r.config.RTMPURL = value case "RtpAddress": - r.config.RtpAddress = value + r.config.RTPAddress = value case "Bitrate": v, err := strconv.ParseUint(value, 10, 0) if err != nil { @@ -421,7 +421,7 @@ func (r *Revid) Update(vars map[string]string) error { } r.config.Rotation = uint(v) case "HttpAddress": - r.config.HttpAddress = value + r.config.HTTPAddress = value case "Quantization": q, err := strconv.ParseUint(value, 10, 0) if err != nil { diff --git a/revid/revid_test.go b/revid/revid_test.go index e17740df..36cc913d 100644 --- a/revid/revid_test.go +++ b/revid/revid_test.go @@ -224,7 +224,7 @@ func TestResetEncoderSenderSetup(t *testing.T) { for testNum, test := range tests { // Create a new config and reset revid with it. const dummyURL = "rtmp://dummy" - c := Config{Logger: &testLogger{}, Outputs: test.outputs, RtmpUrl: dummyURL} + c := Config{Logger: &testLogger{}, Outputs: test.outputs, RTMPURL: dummyURL} err := rv.setConfig(c) if err != nil { t.Fatalf("unexpected error: %v for test %v", err, testNum)