mirror of https://bitbucket.org/ausocean/av.git
Improved logging
This commit is contained in:
parent
19579930e8
commit
03335f3949
|
@ -179,14 +179,14 @@ func (r *revidInst)IsRunning() bool {
|
||||||
|
|
||||||
func (r *revidInst) Start() {
|
func (r *revidInst) Start() {
|
||||||
if r.isRunning {
|
if r.isRunning {
|
||||||
r.Log(Warning,"Start() has been called but revid already running!")
|
r.Log(Warning,"revidInst.Start() called but revid already running!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r.Log(Debug,"Starting Revid!")
|
r.Log(Info,"Starting Revid!")
|
||||||
var h264Data []byte
|
var h264Data []byte
|
||||||
switch r.config.Input {
|
switch r.config.Input {
|
||||||
case Raspivid:
|
case Raspivid:
|
||||||
r.Log(Debug,"Starting raspivid!")
|
r.Log(Info,"Starting raspivid!")
|
||||||
cmd = exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b",
|
cmd = exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b",
|
||||||
r.config.Bitrate,"-qp", r.config.Quantization, "-w", r.config.Width, "-h", r.config.Height, "-fps", r.config.FrameRate, "-ih", "-g", "100")
|
r.config.Bitrate,"-qp", r.config.Quantization, "-w", r.config.Width, "-h", r.config.Height, "-fps", r.config.FrameRate, "-ih", "-g", "100")
|
||||||
stdout, _ := cmd.StdoutPipe()
|
stdout, _ := cmd.StdoutPipe()
|
||||||
|
@ -198,7 +198,7 @@ func (r *revidInst) Start() {
|
||||||
}
|
}
|
||||||
r.isRunning = true
|
r.isRunning = true
|
||||||
go func() {
|
go func() {
|
||||||
r.Log(Debug, "Reading camera data!")
|
r.Log(Info, "Reading camera data!")
|
||||||
for r.isRunning {
|
for r.isRunning {
|
||||||
h264Data = make([]byte, 1)
|
h264Data = make([]byte, 1)
|
||||||
_, err := io.ReadFull(inputReader, h264Data)
|
_, err := io.ReadFull(inputReader, h264Data)
|
||||||
|
@ -214,7 +214,7 @@ func (r *revidInst) Start() {
|
||||||
r.h264Parser.InputByteChan <- h264Data[0]
|
r.h264Parser.InputByteChan <- h264Data[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.Log(Debug, "Out of reading routine!")
|
r.Log(Info, "Out of reading routine!")
|
||||||
}()
|
}()
|
||||||
case File:
|
case File:
|
||||||
stats, err := r.inputFile.Stat()
|
stats, err := r.inputFile.Stat()
|
||||||
|
@ -236,11 +236,11 @@ func (r *revidInst) Start() {
|
||||||
|
|
||||||
func (r *revidInst) Stop() {
|
func (r *revidInst) Stop() {
|
||||||
if r.isRunning {
|
if r.isRunning {
|
||||||
r.Log(Debug,"Stopping revid!")
|
r.Log(Info,"Stopping revid!")
|
||||||
r.isRunning = false
|
r.isRunning = false
|
||||||
cmd.Process.Kill()
|
cmd.Process.Kill()
|
||||||
} else {
|
} else {
|
||||||
r.Log(Warning,"Tried to stop revid, but not even running!")
|
r.Log(Warning,"revidInst.Stop() called but revid not running!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue