format

command
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 5 Imported by: 0

README

Device Format Example

The examples in this directory highlights the support for V4L2's device format API. It shows how to query format information and set video format for a selected device.


func main() {

    device, err := dev.Open(
		devName,
		dev.WithPixFormat(v4l2.PixFormat{Width: uint32(width), Height: uint32(height), PixelFormat: fmtEnc, Field: v4l2.FieldNone}),
		dev.WithFPS(15),
	)

    ...

    currFmt, err := device.GetPixFormat()
	if err != nil {
		log.Fatalf("unable to get format: %s", err)
	}
	log.Printf("Current format: %s", currFmt)

    ...

    // FPS
	fps, err := device.GetFrameRate()
	if err != nil {
		log.Fatalf("failed to get fps: %s", err)
	}
	log.Printf("current frame rate: %d fps", fps)
	// update fps
	if fps < 30 {
		if err := device.SetFrameRate(30); err != nil {
			log.Fatalf("failed to set frame rate: %s", err)
		}
	}

}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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