162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_G_INPUT:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci************************************
762306a36Sopenharmony_ciioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
862306a36Sopenharmony_ci************************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_G_INPUT
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_S_INPUT
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciArguments
2762306a36Sopenharmony_ci=========
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci``fd``
3062306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci``argp``
3362306a36Sopenharmony_ci    Pointer an integer with input index.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciDescription
3662306a36Sopenharmony_ci===========
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciTo query the current video input applications call the
3962306a36Sopenharmony_ci:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
4062306a36Sopenharmony_cistores the number of the input, as in the struct
4162306a36Sopenharmony_ci:c:type:`v4l2_input` ``index`` field. This ioctl will fail
4262306a36Sopenharmony_cionly when there are no video inputs, returning ``EINVAL``.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciTo select a video input applications store the number of the desired
4562306a36Sopenharmony_ciinput in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
4662306a36Sopenharmony_cito this integer. Side effects are possible. For example inputs may
4762306a36Sopenharmony_cisupport different video standards, so the driver may implicitly switch
4862306a36Sopenharmony_cithe current standard. Because of these possible side effects
4962306a36Sopenharmony_ciapplications must select an input before querying or negotiating any
5062306a36Sopenharmony_ciother parameters.
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciInformation about video inputs is available using the
5362306a36Sopenharmony_ci:ref:`VIDIOC_ENUMINPUT` ioctl.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciReturn Value
5662306a36Sopenharmony_ci============
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
5962306a36Sopenharmony_ciappropriately. The generic error codes are described at the
6062306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciEINVAL
6362306a36Sopenharmony_ci    The number of the video input is out of bounds.
64