mirror of https://bitbucket.org/ausocean/av.git
revid: move command creation and logging out of switch
This commit is contained in:
parent
8b07457f52
commit
c20ed48c40
|
@ -31,6 +31,7 @@ package revid
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -413,9 +414,14 @@ func (r *Revid) outputClips() {
|
|||
// a raspivid process and pipes it's data output.
|
||||
func (r *Revid) startRaspivid() error {
|
||||
r.config.Logger.Log(smartlogger.Info, pkg+"starting raspivid")
|
||||
|
||||
var args []string
|
||||
switch r.config.InputCodec {
|
||||
default:
|
||||
return fmt.Errorf("revid: invalid input codec: %v", r.config.InputCodec)
|
||||
|
||||
case H264:
|
||||
args := []string{
|
||||
args = []string{
|
||||
"-cd", "H264",
|
||||
"-o", "-",
|
||||
"-n",
|
||||
|
@ -427,7 +433,6 @@ func (r *Revid) startRaspivid() error {
|
|||
"-ih",
|
||||
"-g", r.config.IntraRefreshPeriod,
|
||||
}
|
||||
|
||||
if r.config.QuantizationMode == QuantizationOn {
|
||||
args = append(args, "-qp", r.config.Quantization)
|
||||
}
|
||||
|
@ -437,19 +442,19 @@ func (r *Revid) startRaspivid() error {
|
|||
if r.config.VerticalFlip == Yes {
|
||||
args = append(args, "-vf")
|
||||
}
|
||||
r.config.Logger.Log(smartlogger.Info, pkg+"raspivid args", "raspividArgs", strings.Join(args, " "))
|
||||
r.cmd = exec.Command("raspivid", args...)
|
||||
|
||||
case Mjpeg:
|
||||
// FIXME(saxon): do above in this case too
|
||||
r.cmd = exec.Command("raspivid",
|
||||
args = []string{
|
||||
"-cd", "MJPEG",
|
||||
"-o", "-",
|
||||
"-n",
|
||||
"-t", runContinuously,
|
||||
"-fps", r.config.FrameRate,
|
||||
)
|
||||
}
|
||||
}
|
||||
r.config.Logger.Log(smartlogger.Info, pkg+"raspivid args", "raspividArgs", strings.Join(args, " "))
|
||||
r.cmd = exec.Command("raspivid", args...)
|
||||
|
||||
d, err := strconv.Atoi(r.config.FrameRate)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue