revid: reverting changes made to config.go

This commit is contained in:
Saxon 2019-03-09 22:44:12 +10:30
parent 93e856792d
commit b96b52ace5
1 changed files with 17 additions and 2 deletions

View File

@ -42,7 +42,7 @@ type Config struct {
InputCodec uint8
Outputs []uint8
RtmpMethod uint8
Packetization uint
Packetization uint8
// Quantize specifies whether the input to
// revid will have constant or variable
@ -92,6 +92,8 @@ const (
Yes
No
Rtmp
FfmpegRtmp
Udp
MpegtsRtp
Rtp
)
@ -112,6 +114,7 @@ const (
defaultFramesPerClip = 1
httpFramesPerClip = 560
defaultInputCodec = H264
defaultVerbosity = No // FIXME(kortschak): This makes no sense whatsoever. No is currently 15.
defaultRtpAddr = "localhost:6970"
defaultBurstPeriod = 10 // Seconds
defaultRotation = 0 // Degrees
@ -120,6 +123,17 @@ const (
// Validate checks for any errors in the config fields and defaults settings
// if particular parameters have not been defined.
func (c *Config) Validate(r *Revid) error {
switch c.LogLevel {
case Yes:
case No:
case NothingDefined:
c.LogLevel = defaultVerbosity
c.Logger.Log(logger.Info, pkg+"no LogLevel mode defined, defaulting",
"LogLevel", defaultVerbosity)
default:
return errors.New("bad LogLevel defined in config")
}
switch c.Input {
case Raspivid, V4L, File:
case NothingDefined:
@ -162,7 +176,8 @@ func (c *Config) Validate(r *Revid) error {
for i, o := range c.Outputs {
switch o {
case File:
case Rtmp:
case Udp:
case Rtmp, FfmpegRtmp:
if c.RtmpUrl == "" {
c.Logger.Log(logger.Info, pkg+"no RTMP URL: falling back to HTTP")
c.Outputs[i] = Http