From 001c8696aaeb26d02cce4930cadda762a6b9a5da Mon Sep 17 00:00:00 2001 From: Saxon Date: Mon, 13 May 2019 16:12:08 +0930 Subject: [PATCH] revid/config.go: started commenting config fields --- revid/config.go | 55 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/revid/config.go b/revid/config.go index d26a72d5..ff6f198e 100644 --- a/revid/config.go +++ b/revid/config.go @@ -111,27 +111,59 @@ const ( // Config provides parameters relevant to a revid instance. A new config must // be passed to the constructor. Default values for these fields are defined -// as consts at the beginning of this file. +// as consts above. type Config struct { + // LogLevel is the revid logging verbosity level. + // Valid values are defined by enums from the logger package: logger.Debug, + // logger.Info, logger.Warning logger.Error, logger.Fatal. LogLevel int8 - Input uint8 - InputCodec uint8 - Outputs []uint8 - RtmpMethod uint8 - Packetization uint8 + // Input defines the input data source. + // + // Valid values are defined by enums: + // Raspivid: + // Read data from a Raspberry Pi Camera. + // V4l: + // Read from webcam. + // File: + // Location must be specified in InputPath field. + Input uint8 - // Quantize specifies whether the input to - // revid will have constant or variable + // InputCodec defines the input codec we wish to use, and therefore define the + // lexer for use in the pipeline. In most cases this defaults according to a + // particular input. Both Raspivid and V4l use H264, but File input may use + // H264 or MJPEG. + InputCodec uint8 + + // Outputs define the outputs we wish to output data too. + // + // Valid outputs are defined by enums: + // File: + // Location must be defined by the OutputPath field. MPEG-TS packetization + // is used. + // Http: + // Destination is defined by the sh field located in /etc/netsender.conf. + // MPEGT-TS packetization is used. + // Rtmp: + // Destination URL must be defined in the RtmpUrl field. FLV packetization + // is used. + // Rtp: + // Destination is defined by RtpAddr field, otherwise it will default to + // localhost:6970. MPEGT-TS packetization is used. + Outputs []uint8 + + // Quantize specifies whether the input to revid will have constant or variable // bitrate. Quantize bool - // FlipHorizonatla and FlipVertical specify - // whether video frames should be flipped. + // FlipHorizonatla and FlipVertical specify whether video frames should be flipped. FlipHorizontal bool FlipVertical bool - FramesPerClip uint + FramesPerClip uint + + // RtmpUrl specifies the Rtmp output destination URL. This must be defined if + // RTMP is to be used as an output. RtmpUrl string Bitrate uint OutputPath string @@ -223,7 +255,6 @@ func (c *Config) Validate(r *Revid) error { case Http, Rtp: c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for http out", "framesPerClip", httpFramesPerClip) c.FramesPerClip = httpFramesPerClip - c.Packetization = Mpegts default: return errors.New("bad output type defined in config") }