revid: config fields that are exported and acronyms now capitalized.

This commit is contained in:
Saxon 2019-05-13 16:23:38 +09:30
parent 51fcb18505
commit 835f97203a
4 changed files with 18 additions and 18 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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)