v4l2

package
v0.3.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 15 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const MinWidth = 640

MinWidth is the least width asked of a camera, so a small picture still gets one worth scaling.

Variables

This section is empty.

Functions

func CaptureCard

func CaptureCard(path string) (string, bool)

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

func Open(device string, frame image.Point, maxFPS int) (*Camera, error)

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.

func (*Camera) Close

func (c *Camera) Close()

Close stops the stream and releases the device.

func (*Camera) Err

func (c *Camera) Err() error

Err is why Frames closed.

func (*Camera) Format

func (c *Camera) Format() string

Format names the negotiated stream: size and pixel format.

func (*Camera) Frames

func (c *Camera) Frames() <-chan *image.RGBA

Frames delivers the newest pictures; it closes when the camera stops, Err then saying why.

func (*Camera) Recycle

func (c *Camera) Recycle(img *image.RGBA)

Recycle hands a picture from Frames back for the next frame.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL