Documentation ¶
Overview ¶
Package device provides a device abstraction that supports video streaming.
Index ¶
- func GetAllDevicePaths() ([]string, error)
- func IsDevice(devpath string) (bool, error)
- type Device
- func (d *Device) BufferCount() v4l2.BufType
- func (d *Device) BufferType() v4l2.BufType
- func (d *Device) Buffers() [][]byte
- func (d *Device) Capability() v4l2.Capability
- func (d *Device) Close() error
- func (d *Device) Fd() uintptr
- func (d *Device) GetCropCapability() (v4l2.CropCapability, error)
- func (d *Device) GetFormatDescription(idx uint32) (v4l2.FormatDescription, error)
- func (d *Device) GetFormatDescriptions() ([]v4l2.FormatDescription, error)
- func (d *Device) GetFrameRate() (uint32, error)
- func (d *Device) GetMediaInfo() (v4l2.MediaDeviceInfo, error)
- func (d *Device) GetOutput() <-chan []byte
- func (d *Device) GetPixFormat() (v4l2.PixFormat, error)
- func (d *Device) GetStreamParam() (v4l2.StreamParam, error)
- func (d *Device) GetVideoInputIndex() (int32, error)
- func (d *Device) GetVideoInputInfo(index uint32) (v4l2.InputInfo, error)
- func (d *Device) MemIOType() v4l2.IOType
- func (d *Device) Name() string
- func (d *Device) SetCropRect(r v4l2.Rect) error
- func (d *Device) SetFrameRate(fps uint32) error
- func (d *Device) SetInput(in <-chan []byte)
- func (d *Device) SetPixFormat(pixFmt v4l2.PixFormat) error
- func (d *Device) SetStreamParam(param v4l2.StreamParam) error
- func (d *Device) Start(ctx context.Context) error
- func (d *Device) Stop() error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllDevicePaths ¶
GetAllDevicePaths return a slice of all mounted v4l2 devices
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func Open ¶
Open creates opens the underlying device at specified path for streaming. It returns a *Device or an error if unable to open device.
func (*Device) BufferCount ¶
BufferCount returns configured number of buffers to be used during streaming. If called after streaming start, this value could be updated by the driver.
func (*Device) BufferType ¶
BufferType this is a convenience method that returns the device mode (i.e. Capture, Output, etc) Use method Capability for detail about the device.
func (*Device) Buffers ¶
Buffers returns the internal mapped buffers. This method should be called after streaming has been started otherwise it may return nil.
func (*Device) Capability ¶
func (d *Device) Capability() v4l2.Capability
Capability returns device capability info.
func (*Device) GetCropCapability ¶
func (d *Device) GetCropCapability() (v4l2.CropCapability, error)
GetCropCapability returns cropping info for device
func (*Device) GetFormatDescription ¶
func (d *Device) GetFormatDescription(idx uint32) (v4l2.FormatDescription, error)
GetFormatDescription returns a format description for the device at specified format index
func (*Device) GetFormatDescriptions ¶
func (d *Device) GetFormatDescriptions() ([]v4l2.FormatDescription, error)
GetFormatDescriptions returns all possible format descriptions for device
func (*Device) GetFrameRate ¶
GetFrameRate returns the FPS value for the device
func (*Device) GetMediaInfo ¶
func (d *Device) GetMediaInfo() (v4l2.MediaDeviceInfo, error)
GetMediaInfo returns info for a device that supports the Media API
func (*Device) GetOutput ¶
GetOutput returns the channel that outputs streamed data that is captured from the underlying device driver.
func (*Device) GetPixFormat ¶
GetPixFormat retrieves pixel format info for device
func (*Device) GetStreamParam ¶
func (d *Device) GetStreamParam() (v4l2.StreamParam, error)
GetStreamParam returns streaming parameter information for device
func (*Device) GetVideoInputIndex ¶
GetVideoInputIndex returns current video input index for device
func (*Device) GetVideoInputInfo ¶
GetVideoInputInfo returns video input info for device
func (*Device) MemIOType ¶
MemIOType returns the device memory input/output type (i.e. Memory mapped, DMA, user pointer, etc)
func (*Device) SetCropRect ¶
SetCropRect crops the video dimension for the device
func (*Device) SetFrameRate ¶
SetFrameRate sets the FPS rate value of the device
func (*Device) SetInput ¶
SetInput sets up an input channel for data this sent for output to the underlying device driver.
func (*Device) SetPixFormat ¶
SetPixFormat sets the pixel format for the associated device.
func (*Device) SetStreamParam ¶
func (d *Device) SetStreamParam(param v4l2.StreamParam) error
SetStreamParam saves stream parameters for device
type Option ¶
type Option func(*config)
func WithBufferSize ¶
func WithIOType ¶
func WithPixFormat ¶
func WithVideoCaptureEnabled ¶
func WithVideoCaptureEnabled() Option
func WithVideoOutputEnabled ¶
func WithVideoOutputEnabled() Option