162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_ENUM_FRAMESIZES:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci****************************
762306a36Sopenharmony_ciioctl VIDIOC_ENUM_FRAMESIZES
862306a36Sopenharmony_ci****************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_ENUM_FRAMESIZES
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciArguments
2362306a36Sopenharmony_ci=========
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci``fd``
2662306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci``argp``
2962306a36Sopenharmony_ci    Pointer to struct :c:type:`v4l2_frmsizeenum`
3062306a36Sopenharmony_ci    that contains an index and pixel format and receives a frame width
3162306a36Sopenharmony_ci    and height.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciDescription
3462306a36Sopenharmony_ci===========
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciThis ioctl allows applications to enumerate all frame sizes (i. e. width
3762306a36Sopenharmony_ciand height in pixels) that the device supports for the given pixel
3862306a36Sopenharmony_ciformat.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciThe supported pixel formats can be obtained by using the
4162306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FMT` function.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciThe return value and the content of the ``v4l2_frmsizeenum.type`` field
4462306a36Sopenharmony_cidepend on the type of frame sizes the device supports. Here are the
4562306a36Sopenharmony_cisemantics of the function for the different cases:
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci-  **Discrete:** The function returns success if the given index value
4862306a36Sopenharmony_ci   (zero-based) is valid. The application should increase the index by
4962306a36Sopenharmony_ci   one for each call until ``EINVAL`` is returned. The
5062306a36Sopenharmony_ci   ``v4l2_frmsizeenum.type`` field is set to
5162306a36Sopenharmony_ci   ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
5262306a36Sopenharmony_ci   ``discrete`` member is valid.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci-  **Step-wise:** The function returns success if the given index value
5562306a36Sopenharmony_ci   is zero and ``EINVAL`` for any other index value. The
5662306a36Sopenharmony_ci   ``v4l2_frmsizeenum.type`` field is set to
5762306a36Sopenharmony_ci   ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
5862306a36Sopenharmony_ci   ``stepwise`` member is valid.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci-  **Continuous:** This is a special case of the step-wise type above.
6162306a36Sopenharmony_ci   The function returns success if the given index value is zero and
6262306a36Sopenharmony_ci   ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
6362306a36Sopenharmony_ci   field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
6462306a36Sopenharmony_ci   the union only the ``stepwise`` member is valid and the
6562306a36Sopenharmony_ci   ``step_width`` and ``step_height`` values are set to 1.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciWhen the application calls the function with index zero, it must check
6862306a36Sopenharmony_cithe ``type`` field to determine the type of frame size enumeration the
6962306a36Sopenharmony_cidevice supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
7062306a36Sopenharmony_ciit make sense to increase the index value to receive more frame sizes.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci.. note::
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci   The order in which the frame sizes are returned has no special
7562306a36Sopenharmony_ci   meaning. In particular does it not say anything about potential default
7662306a36Sopenharmony_ci   format sizes.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciApplications can assume that the enumeration data does not change
7962306a36Sopenharmony_ciwithout any interaction from the application itself. This means that the
8062306a36Sopenharmony_cienumeration data is consistent if the application does not perform any
8162306a36Sopenharmony_ciother ioctl calls while it runs the frame size enumeration.
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciStructs
8462306a36Sopenharmony_ci=======
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciIn the structs below, *IN* denotes a value that has to be filled in by
8762306a36Sopenharmony_cithe application, *OUT* denotes values that the driver fills in. The
8862306a36Sopenharmony_ciapplication should zero out all members except for the *IN* fields.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci.. c:type:: v4l2_frmsize_discrete
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci.. flat-table:: struct v4l2_frmsize_discrete
9362306a36Sopenharmony_ci    :header-rows:  0
9462306a36Sopenharmony_ci    :stub-columns: 0
9562306a36Sopenharmony_ci    :widths:       1 1 2
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci    * - __u32
9862306a36Sopenharmony_ci      - ``width``
9962306a36Sopenharmony_ci      - Width of the frame [pixel].
10062306a36Sopenharmony_ci    * - __u32
10162306a36Sopenharmony_ci      - ``height``
10262306a36Sopenharmony_ci      - Height of the frame [pixel].
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci.. c:type:: v4l2_frmsize_stepwise
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci.. flat-table:: struct v4l2_frmsize_stepwise
10862306a36Sopenharmony_ci    :header-rows:  0
10962306a36Sopenharmony_ci    :stub-columns: 0
11062306a36Sopenharmony_ci    :widths:       1 1 2
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci    * - __u32
11362306a36Sopenharmony_ci      - ``min_width``
11462306a36Sopenharmony_ci      - Minimum frame width [pixel].
11562306a36Sopenharmony_ci    * - __u32
11662306a36Sopenharmony_ci      - ``max_width``
11762306a36Sopenharmony_ci      - Maximum frame width [pixel].
11862306a36Sopenharmony_ci    * - __u32
11962306a36Sopenharmony_ci      - ``step_width``
12062306a36Sopenharmony_ci      - Frame width step size [pixel].
12162306a36Sopenharmony_ci    * - __u32
12262306a36Sopenharmony_ci      - ``min_height``
12362306a36Sopenharmony_ci      - Minimum frame height [pixel].
12462306a36Sopenharmony_ci    * - __u32
12562306a36Sopenharmony_ci      - ``max_height``
12662306a36Sopenharmony_ci      - Maximum frame height [pixel].
12762306a36Sopenharmony_ci    * - __u32
12862306a36Sopenharmony_ci      - ``step_height``
12962306a36Sopenharmony_ci      - Frame height step size [pixel].
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci.. c:type:: v4l2_frmsizeenum
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci.. tabularcolumns:: |p{6.4cm}|p{2.8cm}|p{8.1cm}|
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci.. flat-table:: struct v4l2_frmsizeenum
13762306a36Sopenharmony_ci    :header-rows:  0
13862306a36Sopenharmony_ci    :stub-columns: 0
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci    * - __u32
14162306a36Sopenharmony_ci      - ``index``
14262306a36Sopenharmony_ci      - IN: Index of the given frame size in the enumeration.
14362306a36Sopenharmony_ci    * - __u32
14462306a36Sopenharmony_ci      - ``pixel_format``
14562306a36Sopenharmony_ci      - IN: Pixel format for which the frame sizes are enumerated.
14662306a36Sopenharmony_ci    * - __u32
14762306a36Sopenharmony_ci      - ``type``
14862306a36Sopenharmony_ci      - OUT: Frame size type the device supports.
14962306a36Sopenharmony_ci    * - union {
15062306a36Sopenharmony_ci      - (anonymous)
15162306a36Sopenharmony_ci      - OUT: Frame size with the given index.
15262306a36Sopenharmony_ci    * - struct :c:type:`v4l2_frmsize_discrete`
15362306a36Sopenharmony_ci      - ``discrete``
15462306a36Sopenharmony_ci      -
15562306a36Sopenharmony_ci    * - struct :c:type:`v4l2_frmsize_stepwise`
15662306a36Sopenharmony_ci      - ``stepwise``
15762306a36Sopenharmony_ci      -
15862306a36Sopenharmony_ci    * - }
15962306a36Sopenharmony_ci      -
16062306a36Sopenharmony_ci      -
16162306a36Sopenharmony_ci    * - __u32
16262306a36Sopenharmony_ci      - ``reserved[2]``
16362306a36Sopenharmony_ci      - Reserved space for future use. Must be zeroed by drivers and
16462306a36Sopenharmony_ci	applications.
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ciEnums
16862306a36Sopenharmony_ci=====
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci.. c:type:: v4l2_frmsizetypes
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci.. flat-table:: enum v4l2_frmsizetypes
17562306a36Sopenharmony_ci    :header-rows:  0
17662306a36Sopenharmony_ci    :stub-columns: 0
17762306a36Sopenharmony_ci    :widths:       3 1 4
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci    * - ``V4L2_FRMSIZE_TYPE_DISCRETE``
18062306a36Sopenharmony_ci      - 1
18162306a36Sopenharmony_ci      - Discrete frame size.
18262306a36Sopenharmony_ci    * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
18362306a36Sopenharmony_ci      - 2
18462306a36Sopenharmony_ci      - Continuous frame size.
18562306a36Sopenharmony_ci    * - ``V4L2_FRMSIZE_TYPE_STEPWISE``
18662306a36Sopenharmony_ci      - 3
18762306a36Sopenharmony_ci      - Step-wise defined frame size.
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ciReturn Value
19062306a36Sopenharmony_ci============
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
19362306a36Sopenharmony_ciappropriately. The generic error codes are described at the
19462306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
195