18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_INPUT:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
88c2ecf20Sopenharmony_ci************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_INPUT
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_INPUT
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciArguments
278c2ecf20Sopenharmony_ci=========
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci``fd``
308c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci``argp``
338c2ecf20Sopenharmony_ci    Pointer an integer with input index.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciDescription
368c2ecf20Sopenharmony_ci===========
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciTo query the current video input applications call the
398c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
408c2ecf20Sopenharmony_cistores the number of the input, as in the struct
418c2ecf20Sopenharmony_ci:c:type:`v4l2_input` ``index`` field. This ioctl will fail
428c2ecf20Sopenharmony_cionly when there are no video inputs, returning ``EINVAL``.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciTo select a video input applications store the number of the desired
458c2ecf20Sopenharmony_ciinput in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
468c2ecf20Sopenharmony_cito this integer. Side effects are possible. For example inputs may
478c2ecf20Sopenharmony_cisupport different video standards, so the driver may implicitly switch
488c2ecf20Sopenharmony_cithe current standard. Because of these possible side effects
498c2ecf20Sopenharmony_ciapplications must select an input before querying or negotiating any
508c2ecf20Sopenharmony_ciother parameters.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciInformation about video inputs is available using the
538c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUMINPUT` ioctl.
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciReturn Value
568c2ecf20Sopenharmony_ci============
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
598c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
608c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciEINVAL
638c2ecf20Sopenharmony_ci    The number of the video input is out of bounds.
64