vidioc-subdev-enum-frame-interval.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
  4. ***************************************
  5. ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
  6. ***************************************
  7. Name
  8. ====
  9. VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
  13. ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
  20. Description
  21. ===========
  22. This ioctl lets applications enumerate available frame intervals on a
  23. given sub-device pad. Frame intervals only makes sense for sub-devices
  24. that can control the frame period on their own. This includes, for
  25. instance, image sensors and TV tuners.
  26. For the common use case of image sensors, the frame intervals available
  27. on the sub-device output pad depend on the frame format and size on the
  28. same pad. Applications must thus specify the desired format and size
  29. when enumerating frame intervals.
  30. To enumerate frame intervals applications initialize the ``index``,
  31. ``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
  32. :c:type:`v4l2_subdev_frame_interval_enum`
  33. and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
  34. to this structure. Drivers fill the rest of the structure or return an
  35. EINVAL error code if one of the input fields is invalid. All frame
  36. intervals are enumerable by beginning at index zero and incrementing by
  37. one until ``EINVAL`` is returned.
  38. Available frame intervals may depend on the current 'try' formats at
  39. other pads of the sub-device, as well as on the current active links.
  40. See :ref:`VIDIOC_SUBDEV_G_FMT` for more
  41. information about the try formats.
  42. Sub-devices that support the frame interval enumeration ioctl should
  43. implemented it on a single pad only. Its behaviour when supported on
  44. multiple pads of the same sub-device is not defined.
  45. .. c:type:: v4l2_subdev_frame_interval_enum
  46. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  47. .. flat-table:: struct v4l2_subdev_frame_interval_enum
  48. :header-rows: 0
  49. :stub-columns: 0
  50. :widths: 1 1 2
  51. * - __u32
  52. - ``index``
  53. - Number of the format in the enumeration, set by the application.
  54. * - __u32
  55. - ``pad``
  56. - Pad number as reported by the media controller API.
  57. * - __u32
  58. - ``code``
  59. - The media bus format code, as defined in
  60. :ref:`v4l2-mbus-format`.
  61. * - __u32
  62. - ``width``
  63. - Frame width, in pixels.
  64. * - __u32
  65. - ``height``
  66. - Frame height, in pixels.
  67. * - struct :c:type:`v4l2_fract`
  68. - ``interval``
  69. - Period, in seconds, between consecutive video frames.
  70. * - __u32
  71. - ``which``
  72. - Frame intervals to be enumerated, from enum
  73. :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
  74. * - __u32
  75. - ``stream``
  76. - Stream identifier.
  77. * - __u32
  78. - ``reserved``\ [7]
  79. - Reserved for future extensions. Applications and drivers must set
  80. the array to zero.
  81. Return Value
  82. ============
  83. On success 0 is returned, on error -1 and the ``errno`` variable is set
  84. appropriately. The generic error codes are described at the
  85. :ref:`Generic Error Codes <gen-errors>` chapter.
  86. EINVAL
  87. The struct :c:type:`v4l2_subdev_frame_interval_enum` ``pad`` references a
  88. non-existing pad, the ``which`` field has an unsupported value, one of the
  89. ``code``, ``width`` or ``height`` fields are invalid for the given pad, or
  90. the ``index`` field is out of bounds.