vidioc-enum-framesizes.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_ENUM_FRAMESIZES:
  4. ****************************
  5. ioctl VIDIOC_ENUM_FRAMESIZES
  6. ****************************
  7. Name
  8. ====
  9. VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_ENUM_FRAMESIZES
  13. ``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`v4l2_frmsizeenum`
  20. that contains an index and pixel format and receives a frame width
  21. and height.
  22. Description
  23. ===========
  24. This ioctl allows applications to enumerate all frame sizes (i. e. width
  25. and height in pixels) that the device supports for the given pixel
  26. format.
  27. The supported pixel formats can be obtained by using the
  28. :ref:`VIDIOC_ENUM_FMT` function.
  29. The return value and the content of the ``v4l2_frmsizeenum.type`` field
  30. depend on the type of frame sizes the device supports. Here are the
  31. semantics of the function for the different cases:
  32. - **Discrete:** The function returns success if the given index value
  33. (zero-based) is valid. The application should increase the index by
  34. one for each call until ``EINVAL`` is returned. The
  35. ``v4l2_frmsizeenum.type`` field is set to
  36. ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
  37. ``discrete`` member is valid.
  38. - **Step-wise:** The function returns success if the given index value
  39. is zero and ``EINVAL`` for any other index value. The
  40. ``v4l2_frmsizeenum.type`` field is set to
  41. ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
  42. ``stepwise`` member is valid.
  43. - **Continuous:** This is a special case of the step-wise type above.
  44. The function returns success if the given index value is zero and
  45. ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
  46. field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
  47. the union only the ``stepwise`` member is valid and the
  48. ``step_width`` and ``step_height`` values are set to 1.
  49. When the application calls the function with index zero, it must check
  50. the ``type`` field to determine the type of frame size enumeration the
  51. device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
  52. it make sense to increase the index value to receive more frame sizes.
  53. .. note::
  54. The order in which the frame sizes are returned has no special
  55. meaning. In particular does it not say anything about potential default
  56. format sizes.
  57. Applications can assume that the enumeration data does not change
  58. without any interaction from the application itself. This means that the
  59. enumeration data is consistent if the application does not perform any
  60. other ioctl calls while it runs the frame size enumeration.
  61. Structs
  62. =======
  63. In the structs below, *IN* denotes a value that has to be filled in by
  64. the application, *OUT* denotes values that the driver fills in. The
  65. application should zero out all members except for the *IN* fields.
  66. .. c:type:: v4l2_frmsize_discrete
  67. .. flat-table:: struct v4l2_frmsize_discrete
  68. :header-rows: 0
  69. :stub-columns: 0
  70. :widths: 1 1 2
  71. * - __u32
  72. - ``width``
  73. - Width of the frame [pixel].
  74. * - __u32
  75. - ``height``
  76. - Height of the frame [pixel].
  77. .. c:type:: v4l2_frmsize_stepwise
  78. .. flat-table:: struct v4l2_frmsize_stepwise
  79. :header-rows: 0
  80. :stub-columns: 0
  81. :widths: 1 1 2
  82. * - __u32
  83. - ``min_width``
  84. - Minimum frame width [pixel].
  85. * - __u32
  86. - ``max_width``
  87. - Maximum frame width [pixel].
  88. * - __u32
  89. - ``step_width``
  90. - Frame width step size [pixel].
  91. * - __u32
  92. - ``min_height``
  93. - Minimum frame height [pixel].
  94. * - __u32
  95. - ``max_height``
  96. - Maximum frame height [pixel].
  97. * - __u32
  98. - ``step_height``
  99. - Frame height step size [pixel].
  100. .. c:type:: v4l2_frmsizeenum
  101. .. tabularcolumns:: |p{6.4cm}|p{2.8cm}|p{8.1cm}|
  102. .. flat-table:: struct v4l2_frmsizeenum
  103. :header-rows: 0
  104. :stub-columns: 0
  105. * - __u32
  106. - ``index``
  107. - IN: Index of the given frame size in the enumeration.
  108. * - __u32
  109. - ``pixel_format``
  110. - IN: Pixel format for which the frame sizes are enumerated.
  111. * - __u32
  112. - ``type``
  113. - OUT: Frame size type the device supports.
  114. * - union {
  115. - (anonymous)
  116. - OUT: Frame size with the given index.
  117. * - struct :c:type:`v4l2_frmsize_discrete`
  118. - ``discrete``
  119. -
  120. * - struct :c:type:`v4l2_frmsize_stepwise`
  121. - ``stepwise``
  122. -
  123. * - }
  124. -
  125. -
  126. * - __u32
  127. - ``reserved[2]``
  128. - Reserved space for future use. Must be zeroed by drivers and
  129. applications.
  130. Enums
  131. =====
  132. .. c:type:: v4l2_frmsizetypes
  133. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
  134. .. flat-table:: enum v4l2_frmsizetypes
  135. :header-rows: 0
  136. :stub-columns: 0
  137. :widths: 3 1 4
  138. * - ``V4L2_FRMSIZE_TYPE_DISCRETE``
  139. - 1
  140. - Discrete frame size.
  141. * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
  142. - 2
  143. - Continuous frame size.
  144. * - ``V4L2_FRMSIZE_TYPE_STEPWISE``
  145. - 3
  146. - Step-wise defined frame size.
  147. Return Value
  148. ============
  149. On success 0 is returned, on error -1 and the ``errno`` variable is set
  150. appropriately. The generic error codes are described at the
  151. :ref:`Generic Error Codes <gen-errors>` chapter.