mirror of https://bitbucket.org/ausocean/av.git
implementing rotate
This commit is contained in:
parent
6803554434
commit
9b4681e29f
|
@ -63,13 +63,14 @@ const (
|
|||
quantizationPtr = 16
|
||||
timeoutPtr = 17
|
||||
intraRefreshPeriodPtr = 18
|
||||
rotatePtr = 19
|
||||
)
|
||||
|
||||
// Other misc consts
|
||||
const (
|
||||
sleepTime = 2 * 43200
|
||||
defaultRunDuration = 2 * 43200
|
||||
noOfConfigconfigFlags = 19
|
||||
noOfConfigconfigFlags = 20
|
||||
revidStopTime = 5
|
||||
prepTime = 20
|
||||
loggerVerbosity = 3
|
||||
|
@ -118,6 +119,7 @@ func main() {
|
|||
{"Quantization", "Desired quantization value"},
|
||||
{"Timeout", "Http timeout in seconds"},
|
||||
{"IntraRefreshPeriod", "The IntraRefreshPeriod i.e. how many keyframes we send"},
|
||||
{"Rotate", "Rotate video the specified number of degrees"},
|
||||
}
|
||||
|
||||
// Create the configFlags based on the flagNames array
|
||||
|
@ -221,6 +223,7 @@ func main() {
|
|||
config.Quantization = *configFlags[quantizationPtr]
|
||||
config.Timeout = *configFlags[timeoutPtr]
|
||||
config.IntraRefreshPeriod = *configFlags[intraRefreshPeriodPtr]
|
||||
config.Rotate = *configFlags[rotatePtr]
|
||||
|
||||
// Also give the config a logger object
|
||||
config.Logger = smartLogger.New(loggerVerbosity, smartLogger.White)
|
||||
|
|
|
@ -98,6 +98,7 @@ const (
|
|||
defaultBitrate = "500000"
|
||||
defaultQuantizationMode = QuantizationOff
|
||||
defaultFramesPerClip = "1"
|
||||
defaultRotate = "0"
|
||||
)
|
||||
|
||||
// Validate checks for any errors in the config fields and defaults settings
|
||||
|
@ -273,5 +274,14 @@ func (config *Config) Validate(r *revid) error {
|
|||
return errors.New("Bad quantization defined in config!")
|
||||
}
|
||||
}
|
||||
|
||||
if config.Rotate = "" {
|
||||
r.Log(Warning, fmt.Sprintf("No rotate defined defaulting to: %v", defaultRotate) )
|
||||
r.config.Rotate = defaultRotate
|
||||
} else {
|
||||
if integer, err := strconv.Atoi(config.Rotate); integer < 0 || integer > 270 || err != nil {
|
||||
return errors.New("Bad rotate defined in config!")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -543,6 +543,7 @@ func (r *revid) setupInputForRaspivid() error {
|
|||
"-fps", r.config.FrameRate,
|
||||
"-ih",
|
||||
"-g", r.config.IntraRefreshPeriod,
|
||||
"-ro", r.config.Rotate,
|
||||
)
|
||||
case QuantizationOff:
|
||||
r.cmd = exec.Command("raspivid",
|
||||
|
@ -556,6 +557,7 @@ func (r *revid) setupInputForRaspivid() error {
|
|||
"-fps", r.config.FrameRate,
|
||||
"-ih",
|
||||
"-g", r.config.IntraRefreshPeriod,
|
||||
"-ro", r.config.Rotate,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue