Merged in path-flag-fix (pull request #143)

revid: got rid of OutputFileName and InputFileName
This commit is contained in:
Saxon Milton 2019-02-28 03:04:05 +00:00
commit b6a3e062b5
3 changed files with 15 additions and 15 deletions

View File

@ -124,8 +124,8 @@ func handleFlags() revid.Config {
framesPerClipPtr = flag.Uint("FramesPerClip", 0, "Number of frames per clip sent")
rtmpUrlPtr = flag.String("RtmpUrl", "", "Url of rtmp endpoint")
bitratePtr = flag.Uint("Bitrate", 0, "Bitrate of recorded video")
outputFileNamePtr = flag.String("OutputFileName", "", "The directory of the output file")
inputFileNamePtr = flag.String("InputFileName", "", "The directory of the input file")
outputPathPtr = flag.String("OutputPath", "", "The directory of the output file")
inputFilePtr = flag.String("InputPath", "", "The directory of the input file")
heightPtr = flag.Uint("Height", 0, "Height in pixels")
widthPtr = flag.Uint("Width", 0, "Width in pixels")
frameRatePtr = flag.Uint("FrameRate", 0, "Frame rate of captured video")
@ -256,8 +256,8 @@ func handleFlags() revid.Config {
cfg.FramesPerClip = *framesPerClipPtr
cfg.RtmpUrl = *rtmpUrlPtr
cfg.Bitrate = *bitratePtr
cfg.OutputFileName = *outputFileNamePtr
cfg.InputFileName = *inputFileNamePtr
cfg.OutputPath = *outputPathPtr
cfg.InputPath = *inputFilePtr
cfg.Height = *heightPtr
cfg.Width = *widthPtr
cfg.FrameRate = *frameRatePtr

View File

@ -57,8 +57,8 @@ type Config struct {
FramesPerClip uint
RtmpUrl string
Bitrate uint
OutputFileName string
InputFileName string
OutputPath string
InputPath string
Height uint
Width uint
FrameRate uint

View File

@ -235,7 +235,7 @@ func (r *Revid) reset(config Config) error {
for _, typ := range r.config.Outputs {
switch typ {
case File:
s, err := newFileSender(config.OutputFileName)
s, err := newFileSender(config.OutputPath)
if err != nil {
return err
}
@ -429,10 +429,10 @@ func (r *Revid) Update(vars map[string]string) error {
break
}
r.config.Bitrate = uint(v)
case "OutputFileName":
r.config.OutputFileName = value
case "InputFileName":
r.config.InputFileName = value
case "OutputPath":
r.config.OutputPath = value
case "InputPath":
r.config.InputPath = value
case "Height":
h, err := strconv.ParseUint(value, 10, 0)
if err != nil {
@ -652,13 +652,13 @@ func (r *Revid) startV4L() error {
const defaultVideo = "/dev/video0"
r.config.Logger.Log(logger.Info, pkg+"starting webcam")
if r.config.InputFileName == "" {
if r.config.InputPath == "" {
r.config.Logger.Log(logger.Info, pkg+"using default video device", "device", defaultVideo)
r.config.InputFileName = defaultVideo
r.config.InputPath = defaultVideo
}
args := []string{
"-i", r.config.InputFileName,
"-i", r.config.InputPath,
"-f", "h264",
"-r", fmt.Sprint(r.config.FrameRate),
}
@ -699,7 +699,7 @@ func (r *Revid) startV4L() error {
// setupInputForFile sets things up for getting input from a file
func (r *Revid) setupInputForFile() error {
f, err := os.Open(r.config.InputFileName)
f, err := os.Open(r.config.InputPath)
if err != nil {
r.config.Logger.Log(logger.Error, err.Error())
r.Stop()