videodevice

package
v0.0.0-...-da18671 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Description: This package provides a video device struct to handle video devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VideoDevice

type VideoDevice struct {
	IsOpen bool // indicates if the video device is open
	FPS    int  // frames per second
	// contains filtered or unexported fields
}

VideoDevice is a struct describing a video device with its properties. It's created with NewVideoDevice() and opened with Open().

func NewVideoDevice

func NewVideoDevice(device string) *VideoDevice

Create new videodevice with the given device name. The device name is the path to the video device, e.g. "/dev/video0". The device is not opened yet, this is done with Open(). The device is started with Start() and stopped with Stop().

func (*VideoDevice) AddConsumer

func (vd *VideoDevice) AddConsumer(consumer chan types.VideoStream)

AddConsumer adds a new consumer to the list of consumers Consumers are channels that receive the video stream

func (*VideoDevice) Close

func (vd *VideoDevice) Close() error

Close the video device. This function must be called when the video device is not needed anymore. It closes the video device. The video device can't be used after this function is called. The video device must have been opened with Open() and stopped with Stop() before this function is called.

func (*VideoDevice) GetExposure

func (vd *VideoDevice) GetExposure() v4l2.CtrlValue

GetExposure returns the exposure of the camera.

func (*VideoDevice) GetFramerate

func (vd *VideoDevice) GetFramerate() (uint32, error)

GetFramerate returns the framerate of the camera.

func (*VideoDevice) GetGain

func (vd *VideoDevice) GetGain() v4l2.CtrlValue

GetGain returns the gain of the camera.

func (*VideoDevice) GetUserCtrlID

func (vd *VideoDevice) GetUserCtrlID(name string) (uint32, error)

GetUserCtrlID returns the control ID of the given control name.

func (*VideoDevice) ImageHeight

func (vd *VideoDevice) ImageHeight() int

ImageHeight returns the height of the image in pixels.

func (*VideoDevice) ImageWidth

func (vd *VideoDevice) ImageWidth() int

ImageWidth returns the width of the image in pixels.

func (*VideoDevice) LogDeviceInfo

func (vd *VideoDevice) LogDeviceInfo()

func (*VideoDevice) Open

func (vd *VideoDevice) Open() error

Open the video device. This function must be called before any other function. It opens the video device and gets the exposure and gain control IDs. It returns an error if the device can't be opened or the control IDs can't be retrieved.

func (*VideoDevice) RemoveConsumer

func (vd *VideoDevice) RemoveConsumer(consumer chan types.VideoStream)

RemoveConsumer removes a consumer from the list of consumers Consumers are channels that receive the video stream

func (*VideoDevice) ResetConsumers

func (vd *VideoDevice) ResetConsumers()

ResetConsumers removes all consumers from the list of consumers

func (*VideoDevice) SetExposure

func (vd *VideoDevice) SetExposure(value int) error

SetExposure sets the exposure of the camera.

func (*VideoDevice) SetFramerate

func (vd *VideoDevice) SetFramerate(framerate uint32) error

SetFramerate sets the framerate of the camera.

func (*VideoDevice) SetGain

func (vd *VideoDevice) SetGain(value int) error

SetGain sets the gain of the camera.

func (*VideoDevice) Start

func (vd *VideoDevice) Start() error

Start the video device. This function must be called after the video device has been opened with Open(). It starts the video device and the video stream. The video stream is sent to the consumers. The video stream is stopped with Stop(). The video stream is read in a go routine that runs in the background.

func (*VideoDevice) Stop

func (vd *VideoDevice) Stop() error

Stop the video device. This function must be called when the video device is not needed anymore. It stops the video device and the video stream. The video stream is stopped with Stop(). The video device can't be used after this function is called. The video device must have been opened with Open() and started with Start() before this function is called.

Jump to

Keyboard shortcuts

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