Skip to content

Commit

Permalink
Add support for setting automatic white balance (Closes #11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Senkovych committed Jun 28, 2017
1 parent d72e01d commit 0573b4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions v4l2.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (

const (
V4L2_CID_BASE uint32 = 0x00980900
V4L2_CID_AUTO_WHITE_BALANCE uint32 = V4L2_CID_BASE + 12
V4L2_CID_PRIVATE_BASE uint32 = 0x08000000
)

Expand Down
9 changes: 9 additions & 0 deletions webcam.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ func (w *Webcam) Close() error {
return err
}

// Sets automatic white balance correction
func (w *Webcam) SetAutoWhiteBalance(val bool) error {
v := int32(0)
if val {
v = 1
}
return setControl(w.fd, V4L2_CID_AUTO_WHITE_BALANCE, v)
}

func gobytes(p unsafe.Pointer, n int) []byte {

h := reflect.SliceHeader{uintptr(p), n, n}
Expand Down

0 comments on commit 0573b4d

Please sign in to comment.