mirror of https://bitbucket.org/ausocean/av.git
revid/raspivid.go: wrote Stop implementation for Raspivid AVDevice implementation
This commit is contained in:
parent
b2a9dbf17d
commit
82903681ee
|
@ -213,3 +213,14 @@ func (r *Raspivid) Start() error {
|
|||
func (r *Raspivid) Read(p []byte) (int, error) {
|
||||
return r.out.Read(p)
|
||||
}
|
||||
|
||||
func (r *Raspivid) Stop() error {
|
||||
if r.cmd == nil || r.cmd.Process == nil {
|
||||
return errors.New("raspivid process was never started")
|
||||
}
|
||||
err := r.cmd.Process.Kill()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not kill raspivid process: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue