Documentation
¶
Overview ¶
Package v4l2 streams a V4L2 capture node in pure Go (mmap buffers over golang.org/x/sys/unix ioctls), delivering each frame as an RGBA picture letterboxed to a requested aspect, and names the capture nodes a system has.
Index ¶
- Constants
- Variables
- func CaptureCard(path string) (string, bool)
- type Camera
- type ControlID
- type ControlRange
- type Meter
- func (m *Meter) Close() error
- func (m *Meter) Control(id ControlID) (int32, error)
- func (m *Meter) Format() string
- func (m *Meter) MeanLuma(timeout time.Duration) (float64, error)
- func (m *Meter) QueryControl(id ControlID) (ControlRange, error)
- func (m *Meter) SetControl(id ControlID, value int32) error
- func (m *Meter) Start() error
Constants ¶
const ExposureManual int32 = 1
ExposureManual is the ControlExposureAuto menu entry that hands the exposure to ControlExposureAbsolute (V4L2_EXPOSURE_MANUAL).
const MinWidth = 640
MinWidth is the least width asked of a camera, so a small picture still gets one worth scaling.
Variables ¶
var ErrNoControl = errors.New("v4l2: no such control")
ErrNoControl is a control the device does not have, or has disabled.
Functions ¶
func CaptureCard ¶
CaptureCard is the card name of a node that captures video, else false.
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera streams a V4L2 capture node, letterboxing each frame on its own goroutine.
func Open ¶
Open starts streaming device (YUYV, else MJPEG, about frame's width, at least MinWidth), its pictures letterboxed to frame's aspect, converting at most maxFPS of them a second.
type ControlID ¶
type ControlID uint32
ControlID names a V4L2 control.
type ControlRange ¶
type ControlRange struct {
Min, Max, Step, Default int32
}
ControlRange is what a control accepts and starts at.
func (ControlRange) Clamp ¶
func (r ControlRange) Clamp(v int32) int32
Clamp is v limited to the range.
type Meter ¶
type Meter struct {
// contains filtered or unexported fields
}
Meter reads the brightness of a capture node's frames at the lowest resolution it offers, and its controls. Nothing it captures outlives the call that measured it.
func OpenMeter ¶
OpenMeter opens device without streaming, so its controls can be read with the camera off.
func (*Meter) MeanLuma ¶
MeanLuma waits up to timeout for the next frame and returns its mean luma, 0-255.
func (*Meter) QueryControl ¶
func (m *Meter) QueryControl(id ControlID) (ControlRange, error)
QueryControl reads the range of control id; a control the device lacks is ErrNoControl.
func (*Meter) SetControl ¶
SetControl sets control id to value.