Documentation/userspace-api/media/v4l/vidioc-enum-framesizes.rst

Source file repositories/reference/linux-study-clean/Documentation/userspace-api/media/v4l/vidioc-enum-framesizes.rst

File Facts

System
Linux kernel
Corpus path
Documentation/userspace-api/media/v4l/vidioc-enum-framesizes.rst
Extension
.rst
Size
5424 bytes
Lines
195
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L

.. _VIDIOC_ENUM_FRAMESIZES:

****************************
ioctl VIDIOC_ENUM_FRAMESIZES
****************************

Name
====

VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes

Synopsis
========

.. c:macro:: VIDIOC_ENUM_FRAMESIZES

``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`v4l2_frmsizeenum`
    that contains an index and pixel format and receives a frame width
    and height.

Description
===========

This ioctl allows applications to enumerate all frame sizes (i. e. width
and height in pixels) that the device supports for the given pixel
format.

The supported pixel formats can be obtained by using the
:ref:`VIDIOC_ENUM_FMT` function.

The return value and the content of the ``v4l2_frmsizeenum.type`` field
depend on the type of frame sizes the device supports. Here are the
semantics of the function for the different cases:

-  **Discrete:** The function returns success if the given index value
   (zero-based) is valid. The application should increase the index by
   one for each call until ``EINVAL`` is returned. The
   ``v4l2_frmsizeenum.type`` field is set to
   ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
   ``discrete`` member is valid.

-  **Step-wise:** The function returns success if the given index value
   is zero and ``EINVAL`` for any other index value. The
   ``v4l2_frmsizeenum.type`` field is set to
   ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
   ``stepwise`` member is valid.

-  **Continuous:** This is a special case of the step-wise type above.
   The function returns success if the given index value is zero and
   ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
   field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
   the union only the ``stepwise`` member is valid and the
   ``step_width`` and ``step_height`` values are set to 1.

When the application calls the function with index zero, it must check
the ``type`` field to determine the type of frame size enumeration the
device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
it make sense to increase the index value to receive more frame sizes.

Annotation

Implementation Notes