18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: V4L 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _VIDIOC_ENUM_FRAMESIZES: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci**************************** 78c2ecf20Sopenharmony_ciioctl VIDIOC_ENUM_FRAMESIZES 88c2ecf20Sopenharmony_ci**************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciVIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_ENUM_FRAMESIZES 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`v4l2_frmsizeenum` 308c2ecf20Sopenharmony_ci that contains an index and pixel format and receives a frame width 318c2ecf20Sopenharmony_ci and height. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciDescription 348c2ecf20Sopenharmony_ci=========== 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciThis ioctl allows applications to enumerate all frame sizes (i. e. width 378c2ecf20Sopenharmony_ciand height in pixels) that the device supports for the given pixel 388c2ecf20Sopenharmony_ciformat. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciThe supported pixel formats can be obtained by using the 418c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUM_FMT` function. 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciThe return value and the content of the ``v4l2_frmsizeenum.type`` field 448c2ecf20Sopenharmony_cidepend on the type of frame sizes the device supports. Here are the 458c2ecf20Sopenharmony_cisemantics of the function for the different cases: 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci- **Discrete:** The function returns success if the given index value 488c2ecf20Sopenharmony_ci (zero-based) is valid. The application should increase the index by 498c2ecf20Sopenharmony_ci one for each call until ``EINVAL`` is returned. The 508c2ecf20Sopenharmony_ci ``v4l2_frmsizeenum.type`` field is set to 518c2ecf20Sopenharmony_ci ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the 528c2ecf20Sopenharmony_ci ``discrete`` member is valid. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci- **Step-wise:** The function returns success if the given index value 558c2ecf20Sopenharmony_ci is zero and ``EINVAL`` for any other index value. The 568c2ecf20Sopenharmony_ci ``v4l2_frmsizeenum.type`` field is set to 578c2ecf20Sopenharmony_ci ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the 588c2ecf20Sopenharmony_ci ``stepwise`` member is valid. 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci- **Continuous:** This is a special case of the step-wise type above. 618c2ecf20Sopenharmony_ci The function returns success if the given index value is zero and 628c2ecf20Sopenharmony_ci ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type`` 638c2ecf20Sopenharmony_ci field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of 648c2ecf20Sopenharmony_ci the union only the ``stepwise`` member is valid and the 658c2ecf20Sopenharmony_ci ``step_width`` and ``step_height`` values are set to 1. 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciWhen the application calls the function with index zero, it must check 688c2ecf20Sopenharmony_cithe ``type`` field to determine the type of frame size enumeration the 698c2ecf20Sopenharmony_cidevice supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does 708c2ecf20Sopenharmony_ciit make sense to increase the index value to receive more frame sizes. 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci.. note:: 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci The order in which the frame sizes are returned has no special 758c2ecf20Sopenharmony_ci meaning. In particular does it not say anything about potential default 768c2ecf20Sopenharmony_ci format sizes. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciApplications can assume that the enumeration data does not change 798c2ecf20Sopenharmony_ciwithout any interaction from the application itself. This means that the 808c2ecf20Sopenharmony_cienumeration data is consistent if the application does not perform any 818c2ecf20Sopenharmony_ciother ioctl calls while it runs the frame size enumeration. 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciStructs 848c2ecf20Sopenharmony_ci======= 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciIn the structs below, *IN* denotes a value that has to be filled in by 878c2ecf20Sopenharmony_cithe application, *OUT* denotes values that the driver fills in. The 888c2ecf20Sopenharmony_ciapplication should zero out all members except for the *IN* fields. 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci.. c:type:: v4l2_frmsize_discrete 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_frmsize_discrete 958c2ecf20Sopenharmony_ci :header-rows: 0 968c2ecf20Sopenharmony_ci :stub-columns: 0 978c2ecf20Sopenharmony_ci :widths: 1 1 2 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci * - __u32 1008c2ecf20Sopenharmony_ci - ``width`` 1018c2ecf20Sopenharmony_ci - Width of the frame [pixel]. 1028c2ecf20Sopenharmony_ci * - __u32 1038c2ecf20Sopenharmony_ci - ``height`` 1048c2ecf20Sopenharmony_ci - Height of the frame [pixel]. 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci.. c:type:: v4l2_frmsize_stepwise 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_frmsize_stepwise 1128c2ecf20Sopenharmony_ci :header-rows: 0 1138c2ecf20Sopenharmony_ci :stub-columns: 0 1148c2ecf20Sopenharmony_ci :widths: 1 1 2 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci * - __u32 1178c2ecf20Sopenharmony_ci - ``min_width`` 1188c2ecf20Sopenharmony_ci - Minimum frame width [pixel]. 1198c2ecf20Sopenharmony_ci * - __u32 1208c2ecf20Sopenharmony_ci - ``max_width`` 1218c2ecf20Sopenharmony_ci - Maximum frame width [pixel]. 1228c2ecf20Sopenharmony_ci * - __u32 1238c2ecf20Sopenharmony_ci - ``step_width`` 1248c2ecf20Sopenharmony_ci - Frame width step size [pixel]. 1258c2ecf20Sopenharmony_ci * - __u32 1268c2ecf20Sopenharmony_ci - ``min_height`` 1278c2ecf20Sopenharmony_ci - Minimum frame height [pixel]. 1288c2ecf20Sopenharmony_ci * - __u32 1298c2ecf20Sopenharmony_ci - ``max_height`` 1308c2ecf20Sopenharmony_ci - Maximum frame height [pixel]. 1318c2ecf20Sopenharmony_ci * - __u32 1328c2ecf20Sopenharmony_ci - ``step_height`` 1338c2ecf20Sopenharmony_ci - Frame height step size [pixel]. 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci.. c:type:: v4l2_frmsizeenum 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}| 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_frmsizeenum 1418c2ecf20Sopenharmony_ci :header-rows: 0 1428c2ecf20Sopenharmony_ci :stub-columns: 0 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci * - __u32 1458c2ecf20Sopenharmony_ci - ``index`` 1468c2ecf20Sopenharmony_ci - IN: Index of the given frame size in the enumeration. 1478c2ecf20Sopenharmony_ci * - __u32 1488c2ecf20Sopenharmony_ci - ``pixel_format`` 1498c2ecf20Sopenharmony_ci - IN: Pixel format for which the frame sizes are enumerated. 1508c2ecf20Sopenharmony_ci * - __u32 1518c2ecf20Sopenharmony_ci - ``type`` 1528c2ecf20Sopenharmony_ci - OUT: Frame size type the device supports. 1538c2ecf20Sopenharmony_ci * - union { 1548c2ecf20Sopenharmony_ci - (anonymous) 1558c2ecf20Sopenharmony_ci - OUT: Frame size with the given index. 1568c2ecf20Sopenharmony_ci * - struct :c:type:`v4l2_frmsize_discrete` 1578c2ecf20Sopenharmony_ci - ``discrete`` 1588c2ecf20Sopenharmony_ci - 1598c2ecf20Sopenharmony_ci * - struct :c:type:`v4l2_frmsize_stepwise` 1608c2ecf20Sopenharmony_ci - ``stepwise`` 1618c2ecf20Sopenharmony_ci - 1628c2ecf20Sopenharmony_ci * - } 1638c2ecf20Sopenharmony_ci - 1648c2ecf20Sopenharmony_ci - 1658c2ecf20Sopenharmony_ci * - __u32 1668c2ecf20Sopenharmony_ci - ``reserved[2]`` 1678c2ecf20Sopenharmony_ci - Reserved space for future use. Must be zeroed by drivers and 1688c2ecf20Sopenharmony_ci applications. 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ciEnums 1728c2ecf20Sopenharmony_ci===== 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci.. c:type:: v4l2_frmsizetypes 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci.. flat-table:: enum v4l2_frmsizetypes 1798c2ecf20Sopenharmony_ci :header-rows: 0 1808c2ecf20Sopenharmony_ci :stub-columns: 0 1818c2ecf20Sopenharmony_ci :widths: 3 1 4 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci * - ``V4L2_FRMSIZE_TYPE_DISCRETE`` 1848c2ecf20Sopenharmony_ci - 1 1858c2ecf20Sopenharmony_ci - Discrete frame size. 1868c2ecf20Sopenharmony_ci * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` 1878c2ecf20Sopenharmony_ci - 2 1888c2ecf20Sopenharmony_ci - Continuous frame size. 1898c2ecf20Sopenharmony_ci * - ``V4L2_FRMSIZE_TYPE_STEPWISE`` 1908c2ecf20Sopenharmony_ci - 3 1918c2ecf20Sopenharmony_ci - Step-wise defined frame size. 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ciReturn Value 1948c2ecf20Sopenharmony_ci============ 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 1978c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 1988c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 199