diff --git a/revid/config/config.go b/revid/config/config.go index 07eb79c9..52a1264c 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -90,10 +90,54 @@ const ( // be passed to the constructor. Default values for these fields are defined // 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 + // AutoWhiteBalance defines the auto white balance mode used by Raspivid input. + // Valid modes are defined in the exported []string AutoWhiteBalanceModes + // defined at the start of the file. + AutoWhiteBalance string + + BitDepth uint // Sample bit depth. + Bitrate uint // Bitrate specifies the bitrate for constant bitrate in kbps. + Brightness uint + BurstPeriod uint // BurstPeriod defines the revid burst period in seconds. + CameraChan uint8 // This is the channel we're using for the GeoVision camera. + + // CameraIP is the IP address of the camera in the case of the input camera + // being an IP camera. + CameraIP string + + // CBR indicates whether we wish to use constant or variable bitrate. If CBR + // is true then we will use constant bitrate, and variable bitrate otherwise. + // In the case of the Pi camera, variable bitrate quality is controlled by + // the Quantization parameter below. In the case of the GeoVision camera, + // variable bitrate quality is controlled by firstly the VBRQuality parameter + // and second the VBRBitrate parameter. + CBR bool + + Channels uint // Number of audio channels, 1 for mono, 2 for stereo. + + // ClipDuration is the duration of MTS data that is sent using HTTP or RTP + // output. This defaults to 0, therefore MinFrames will determine the length of + // clips by default. + ClipDuration time.Duration + + // Exposure defines the exposure mode used by the Raspivid input. Valid modes + // are defined in the exported []string ExposureModes defined at the start + // of the file. + Exposure string + + FileFPS uint // Defines the rate at which frames from a file source are processed. + Filters []uint // Defines the methods of filtering to be used in between lexing and encoding. + + // FrameRate defines the input frame rate if configurable by the chosen input. + // Raspivid input supports custom framerate. + FrameRate uint + + Height uint // Height defines the input video height Raspivid input. + HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input. + + // HTTPAddress defines a custom HTTP destination if we do not wish to use that + // defined in /etc/netsender.conf. + HTTPAddress string // Input defines the input data source. // @@ -117,6 +161,41 @@ type Config struct { // valid option if we expect this from the input. InputCodec uint8 + // InputPath defines the input file location for File Input. This must be + // defined if File input is to be used. + InputPath string + + // Logger holds an implementation of the Logger interface as defined in revid.go. + // This must be set for revid to work correctly. + Logger Logger + + // 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 + + Loop bool // If true will restart reading of input after an io.EOF. + MinFPS uint // The reduced framerate of the video when there is no motion. + + // MinFrames defines the frequency of key NAL units SPS, PPS and IDR in + // number of NAL units. This will also determine the frequency of PSI if the + // output container is MPEG-TS. If ClipDuration is less than MinFrames, + // ClipDuration will default to MinFrames. + MinFrames uint + + MotionDownscaling uint // Downscaling factor of frames used for motion detection. + MotionHistory uint // Length of filter's history (KNN & MOG only). + MotionInterval uint // Sets the number of frames that are held before the filter is used (on the nth frame). + MotionKernel uint // Size of kernel used for filling holes and removing noise (KNN only). + MotionMinArea float64 // Used to ignore small areas of motion detection (KNN & MOG only). + MotionPadding uint // Number of frames to keep before and after motion detected. + MotionPixels uint // Number of pixels with motion that is needed for a whole frame to be considered as moving (Basic only). + MotionThreshold float64 // Intensity value that is considered motion. + + // OutputPath defines the output destination for File output. This must be + // defined if File output is to be used. + OutputPath string + // Outputs define the outputs we wish to output data too. // // Valid outputs are defined by enums: @@ -134,130 +213,27 @@ type Config struct { // localhost:6970. MPEGT-TS packetization is used. Outputs []uint8 - // RTMPURL specifies the Rtmp output destination URL. This must be defined if - // RTMP is to be used as an output. - RTMPURL string - - // CameraIP is the IP address of the camera in the case of the input camera - // being an IP camera. - CameraIP string - - // OutputPath defines the output destination for File output. This must be - // defined if File output is to be used. - OutputPath string - - // InputPath defines the input file location for File Input. This must be - // defined if File input is to be used. - InputPath string - - // FrameRate defines the input frame rate if configurable by the chosen input. - // Raspivid input supports custom framerate. - FrameRate uint - - // WriteRate is how many times a second revid encoders will be written to. - WriteRate float64 - - // HTTPAddress defines a custom HTTP destination if we do not wish to use that - // defined in /etc/netsender.conf. - HTTPAddress string - - // CBR indicates whether we wish to use constant or variable bitrate. If CBR - // is true then we will use constant bitrate, and variable bitrate otherwise. - // In the case of the Pi camera, variable bitrate quality is controlled by - // the Quantization parameter below. In the case of the GeoVision camera, - // variable bitrate quality is controlled by firstly the VBRQuality parameter - // and second the VBRBitrate parameter. - CBR bool - - // Quantization defines the quantization level, which will determine variable - // bitrate quality in the case of input from the Pi Camera. - Quantization uint + PSITime uint // Sets the time between a packet being sent. + Quantization uint // Quantization defines the quantization level, which will determine variable bitrate quality in the case of input from the Pi Camera. + RBCapacity uint // The number of bytes the ring buffer will occupy. + RBWriteTimeout uint // The ringbuffer write timeout in seconds. + RecPeriod float64 // How many seconds to record at a time. + Rotation uint // Rotation defines the video rotation angle in degrees Raspivid input. + RTMPURL string // RTMPURL specifies the Rtmp output destination URL. This must be defined if RTMP is to be used as an output. + RTPAddress string // RTPAddress defines the RTP output destination. + SampleRate uint // Samples a second (Hz). + Saturation int + Suppress bool // Holds logger suppression state. + VBRBitrate uint // VBRBitrate describes maximal variable bitrate. // VBRQuality describes the general quality of video from the GeoVision camera // under variable bitrate. VBRQuality can be one 5 consts defined: // qualityStandard, qualityFair, qualityGood, qualityGreat and qualityExcellent. VBRQuality Quality - // VBRBitrate describes maximal bitrate for the GeoVision camera when under - // variable bitrate. - VBRBitrate uint - - // This is the channel we're using for the GeoVision camera. - CameraChan uint8 - - // MinFrames defines the frequency of key NAL units SPS, PPS and IDR in - // number of NAL units. This will also determine the frequency of PSI if the - // output container is MPEG-TS. If ClipDuration is less than MinFrames, - // ClipDuration will default to MinFrames. - MinFrames uint - - // ClipDuration is the duration of MTS data that is sent using HTTP or RTP - // output. This defaults to 0, therefore MinFrames will determine the length of - // clips by default. - ClipDuration time.Duration - - // Logger holds an implementation of the Logger interface as defined in revid.go. - // This must be set for revid to work correctly. - Logger Logger - - // Brightness and saturation define the brightness and saturation levels for - // Raspivid input. - Brightness uint - Saturation int - - // Exposure defines the exposure mode used by the Raspivid input. Valid modes - // are defined in the exported []string ExposureModes defined at the start - // of the file. - Exposure string - - // AutoWhiteBalance defines the auto white balance mode used by Raspivid input. - // Valid modes are defined in the exported []string AutoWhiteBalanceModes - // defined at the start of the file. - AutoWhiteBalance string - - // Audio - SampleRate uint // Samples a second (Hz). - RecPeriod float64 // How many seconds to record at a time. - Channels uint // Number of audio channels, 1 for mono, 2 for stereo. - BitDepth uint // Sample bit depth. - - RTPAddress string // RTPAddress defines the RTP output destination. - BurstPeriod uint // BurstPeriod defines the revid burst period in seconds. - Rotation uint // Rotation defines the video rotation angle in degrees Raspivid input. - Height uint // Height defines the input video height Raspivid input. - Width uint // Width defines the input video width Raspivid input. - Bitrate uint // Bitrate specifies the bitrate for constant bitrate in kbps. - - HorizontalFlip bool // HorizontalFlip flips video horizontally for Raspivid input. - VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input. - Filters []uint // Defines the methods of filtering to be used in between lexing and encoding. - PSITime uint // Sets the time between a packet being sent. - - // Ring buffer parameters. - RBCapacity uint // The number of bytes the ring buffer will occupy. - RBWriteTimeout uint // The ringbuffer write timeout in seconds. - - // Motion filter parameters. - // Some parameters can be used with any filter, while others can only be used by a few. - MinFPS uint // The reduced framerate of the video when there is no motion. - MotionInterval uint // Sets the number of frames that are held before the filter is used (on the nth frame). - MotionDownscaling uint // Downscaling factor of frames used for motion detection. - - MotionMinArea float64 // Used to ignore small areas of motion detection (KNN & MOG only). - MotionThreshold float64 // Intensity value that is considered motion. - MotionHistory uint // Length of filter's history (KNN & MOG only). - MotionKernel uint // Size of kernel used for filling holes and removing noise (KNN only). - MotionPixels uint // Number of pixels with motion that is needed for a whole frame to be considered as moving (Basic only). - MotionPadding uint // Number of frames to keep before and after motion detected. - - // If true will restart reading of input after an io.EOF. - Loop bool - - // Defines the rate at which frames from a file source are processed. - FileFPS uint - - // Holds logger suppression state. - Suppress bool + VerticalFlip bool // VerticalFlip flips video vertically for Raspivid input. + Width uint // Width defines the input video width Raspivid input. + WriteRate float64 // WriteRate is how many times a second revid encoders will be written to. } // Validate checks for any errors in the config fields and defaults settings