vidioc-subdev-enum-frame-size.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_SUBDEV_ENUM_FRAME_SIZE:
  4. ***********************************
  5. ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE
  6. ***********************************
  7. Name
  8. ====
  9. VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_SIZE
  13. ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, struct v4l2_subdev_frame_size_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_size_enum`.
  20. Description
  21. ===========
  22. This ioctl allows applications to access the enumeration of frame sizes
  23. supported by a sub-device on the specified pad
  24. for the specified media bus format.
  25. Supported formats can be retrieved with the
  26. :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE`
  27. ioctl.
  28. The enumerations are defined by the driver, and indexed using the ``index`` field
  29. of the struct :c:type:`v4l2_subdev_frame_size_enum`.
  30. Each pair of ``pad`` and ``code`` correspond to a separate enumeration.
  31. Each enumeration starts with the ``index`` of 0, and
  32. the lowest invalid index marks the end of the enumeration.
  33. Therefore, to enumerate frame sizes allowed on the specified pad
  34. and using the specified mbus format, initialize the
  35. ``pad``, ``which``, and ``code`` fields to desired values,
  36. and set ``index`` to 0.
  37. Then call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_SIZE` ioctl with a pointer to the
  38. structure.
  39. A successful call will return with minimum and maximum frame sizes filled in.
  40. Repeat with increasing ``index`` until ``EINVAL`` is received.
  41. ``EINVAL`` means that either no more entries are available in the enumeration,
  42. or that an input parameter was invalid.
  43. Sub-devices that only support discrete frame sizes (such as most
  44. sensors) will return one or more frame sizes with identical minimum and
  45. maximum values.
  46. Not all possible sizes in given [minimum, maximum] ranges need to be
  47. supported. For instance, a scaler that uses a fixed-point scaling ratio
  48. might not be able to produce every frame size between the minimum and
  49. maximum values. Applications must use the
  50. :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>` ioctl to try the
  51. sub-device for an exact supported frame size.
  52. Available frame sizes may depend on the current 'try' formats at other
  53. pads of the sub-device, as well as on the current active links and the
  54. current values of V4L2 controls. See
  55. :ref:`VIDIOC_SUBDEV_G_FMT` for more
  56. information about try formats.
  57. .. c:type:: v4l2_subdev_frame_size_enum
  58. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  59. .. flat-table:: struct v4l2_subdev_frame_size_enum
  60. :header-rows: 0
  61. :stub-columns: 0
  62. :widths: 1 1 2
  63. * - __u32
  64. - ``index``
  65. - Index of the frame size in the enumeration belonging to the given pad
  66. and format. Filled in by the application.
  67. * - __u32
  68. - ``pad``
  69. - Pad number as reported by the media controller API.
  70. Filled in by the application.
  71. * - __u32
  72. - ``code``
  73. - The media bus format code, as defined in
  74. :ref:`v4l2-mbus-format`. Filled in by the application.
  75. * - __u32
  76. - ``min_width``
  77. - Minimum frame width, in pixels. Filled in by the driver.
  78. * - __u32
  79. - ``max_width``
  80. - Maximum frame width, in pixels. Filled in by the driver.
  81. * - __u32
  82. - ``min_height``
  83. - Minimum frame height, in pixels. Filled in by the driver.
  84. * - __u32
  85. - ``max_height``
  86. - Maximum frame height, in pixels. Filled in by the driver.
  87. * - __u32
  88. - ``which``
  89. - Frame sizes to be enumerated, from enum
  90. :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
  91. * - __u32
  92. - ``stream``
  93. - Stream identifier.
  94. * - __u32
  95. - ``reserved``\ [7]
  96. - Reserved for future extensions. Applications and drivers must set
  97. the array to zero.
  98. Return Value
  99. ============
  100. On success 0 is returned, on error -1 and the ``errno`` variable is set
  101. appropriately. The generic error codes are described at the
  102. :ref:`Generic Error Codes <gen-errors>` chapter.
  103. EINVAL
  104. The struct :c:type:`v4l2_subdev_frame_size_enum` ``pad`` references a
  105. non-existing pad, the ``which`` field has an unsupported value, the ``code``
  106. is invalid for the given pad, or the ``index`` field is out of bounds.