typedef.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package usbcapture
  2. import (
  3. "context"
  4. "github.com/vladimirvivien/go4vl/device"
  5. "github.com/vladimirvivien/go4vl/v4l2"
  6. )
  7. // The capture resolution to open video device
  8. type CaptureResolution struct {
  9. Width int
  10. Height int
  11. FPS int
  12. }
  13. type AudioConfig struct {
  14. SampleRate int
  15. Channels int
  16. FrameSize int
  17. BytesPerSample int
  18. }
  19. type Config struct {
  20. DeviceName string // The video device name, e.g., /dev/video0
  21. AudioDeviceName string // The audio device name, e.g., /dev/snd
  22. AudioEnabled bool // Exists support for audio capture
  23. AudioConfig *AudioConfig // The audio configuration
  24. }
  25. type Instance struct {
  26. /* Runtime configuration */
  27. Config *Config
  28. SupportedResolutions []FormatInfo //The supported resolutions of the video device
  29. Capturing bool
  30. /* Internals */
  31. /* Video capture device */
  32. camera *device.Device
  33. cameraStartContext context.CancelFunc
  34. frames_buff <-chan []byte
  35. pixfmt v4l2.FourCCType
  36. width int
  37. height int
  38. streamInfo string
  39. /* audio capture device */
  40. audiostopchan chan bool // Channel to stop audio capture
  41. }