timing.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package v4l2
  2. // #include <linux/videodev2.h>
  3. import "C"
  4. // TimecodeType
  5. // https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/buffer.html?highlight=v4l2_timecode#timecode-type
  6. // https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/videodev2.h#L886
  7. type TimecodeType = uint32
  8. const (
  9. TimecodeType24FPS TimecodeType = C.V4L2_TC_TYPE_24FPS
  10. TimecodeType25FPS TimecodeType = C.V4L2_TC_TYPE_25FPS
  11. TimecodeType30FPS TimecodeType = C.V4L2_TC_TYPE_30FPS
  12. TimecodeType50FPS TimecodeType = C.V4L2_TC_TYPE_50FPS
  13. TimecodeType60FPS TimecodeType = C.V4L2_TC_TYPE_60FPS
  14. )
  15. // TimecodeFlag
  16. // https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/buffer.html?highlight=v4l2_timecode#timecode-flags
  17. // https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/videodev2.h#L892
  18. type TimecodeFlag = uint32
  19. const (
  20. TimecodeFlagDropFrame TimecodeFlag = C.V4L2_TC_FLAG_DROPFRAME
  21. TimecodeFlagColorFrame TimecodeFlag = C.V4L2_TC_FLAG_COLORFRAME
  22. )
  23. // Timecode (v4l2_timecode)
  24. // https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/buffer.html?highlight=v4l2_timecode#c.V4L.v4l2_timecode
  25. // https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/videodev2.h#L875
  26. type Timecode struct {
  27. Type TimecodeType
  28. Flags TimecodeFlag
  29. Frames uint8
  30. Seconds uint8
  31. Minutes uint8
  32. Hours uint8
  33. _ [4]uint8 // userbits
  34. }