mirror of https://bitbucket.org/ausocean/av.git
cmd/revid-cli & revid: added back vertical and horizontal flip options
This commit is contained in:
parent
0767f41d4a
commit
3a9e90dcf8
|
@ -119,6 +119,8 @@ func handleFlags() revid.Config {
|
|||
httpAddressPtr = flag.String("HttpAddress", "", "Destination address of http posts")
|
||||
quantizePtr = flag.Bool("Quantize", false, "Quantize input (non-variable bitrate)")
|
||||
sendRetryPtr = flag.Bool("retry", false, "Specify whether a failed send should be retried.")
|
||||
verticalFlipPtr = flag.Bool("VerticalFlip", false, "Flip video vertically: Yes, No")
|
||||
horizontalFlipPtr = flag.Bool("HorizontalFlip", false, "Flip video horizontally: Yes, No")
|
||||
framesPerClipPtr = flag.Uint("FramesPerClip", 0, "Number of frames per clip sent")
|
||||
bitratePtr = flag.Uint("Bitrate", 0, "Bitrate of recorded video")
|
||||
heightPtr = flag.Uint("Height", 0, "Height in pixels")
|
||||
|
@ -239,6 +241,8 @@ func handleFlags() revid.Config {
|
|||
|
||||
cfg.Quantize = *quantizePtr
|
||||
cfg.Rotation = *rotationPtr
|
||||
cfg.FlipHorizontal = *horizontalFlipPtr
|
||||
cfg.FlipVertical = *verticalFlipPtr
|
||||
cfg.FramesPerClip = *framesPerClipPtr
|
||||
cfg.RtmpUrl = *rtmpUrlPtr
|
||||
cfg.Bitrate = *bitratePtr
|
||||
|
|
|
@ -49,6 +49,11 @@ type Config struct {
|
|||
// bitrate.
|
||||
Quantize bool
|
||||
|
||||
// FlipHorizonatla and FlipVertical specify
|
||||
// whether video frames should be flipped.
|
||||
FlipHorizontal bool
|
||||
FlipVertical bool
|
||||
|
||||
FramesPerClip uint
|
||||
RtmpUrl string
|
||||
Bitrate uint
|
||||
|
|
|
@ -480,6 +480,25 @@ func (r *Revid) Update(vars map[string]string) error {
|
|||
break
|
||||
}
|
||||
r.config.IntraRefreshPeriod = uint(p)
|
||||
|
||||
case "HorizontalFlip":
|
||||
switch strings.ToLower(value) {
|
||||
case "true":
|
||||
r.config.FlipHorizontal = true
|
||||
case "false":
|
||||
r.config.FlipHorizontal = false
|
||||
default:
|
||||
r.config.Logger.Log(logger.Warning, pkg+"invalid HorizontalFlip param", "value", value)
|
||||
}
|
||||
case "VerticalFlip":
|
||||
switch strings.ToLower(value) {
|
||||
case "true":
|
||||
r.config.FlipVertical = true
|
||||
case "false":
|
||||
r.config.FlipVertical = false
|
||||
default:
|
||||
r.config.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
|
||||
}
|
||||
case "BurstPeriod":
|
||||
v, err := strconv.ParseUint(value, 10, 0)
|
||||
if err != nil {
|
||||
|
@ -601,6 +620,15 @@ func (r *Revid) startRaspivid() error {
|
|||
"--rotation", fmt.Sprint(r.config.Rotation),
|
||||
}
|
||||
|
||||
switch {
|
||||
case r.config.FlipHorizontal && r.config.FlipVertical:
|
||||
args = append(args, "-vf", "hflip,vflip")
|
||||
case r.config.FlipHorizontal:
|
||||
args = append(args, "-vf", "hflip")
|
||||
case r.config.FlipVertical:
|
||||
args = append(args, "-vf", "vflip")
|
||||
}
|
||||
|
||||
switch r.config.InputCodec {
|
||||
default:
|
||||
return fmt.Errorf("revid: invalid input codec: %v", r.config.InputCodec)
|
||||
|
|
Loading…
Reference in New Issue