^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _VIDIOC_G_AUDIO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. c:macro:: VIDIOC_G_AUDIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``int ioctl(int fd, VIDIOC_G_AUDIO, struct v4l2_audio *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .. c:macro:: VIDIOC_S_AUDIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ``int ioctl(int fd, VIDIOC_S_AUDIO, const struct v4l2_audio *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Pointer to struct :c:type:`v4l2_audio`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) To query the current audio input applications zero out the ``reserved``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) array of a struct :c:type:`v4l2_audio` and call the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) :ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) the rest of the structure or return an ``EINVAL`` error code when the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) has no audio inputs, or none which combine with the current video input.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) Audio inputs have one writable property, the audio mode. To select the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) current audio input *and* change the audio mode, applications initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) the ``index`` and ``mode`` fields, and the ``reserved`` array of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct :c:type:`v4l2_audio` structure and call the :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ioctl. Drivers may switch to a different audio mode if the request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) cannot be satisfied. However, this is a write-only ioctl, it does not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return the actual new audio mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .. c:type:: v4l2_audio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .. flat-table:: struct v4l2_audio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) :widths: 1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) - ``index``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) - Identifies the audio input, set by the driver or application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * - __u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) - ``name``\ [32]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) - Name of the audio input, a NUL-terminated ASCII string, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) example: "Line In". This information is intended for the user,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) preferably the connector label on the device itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) - ``capability``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) - Audio capability flags, see :ref:`audio-capability`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) - ``mode``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) - Audio mode flags set by drivers and applications (on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) - ``reserved``\ [2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) - Reserved for future extensions. Drivers and applications must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) the array to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .. _audio-capability:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .. flat-table:: Audio Capability Flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) :widths: 3 1 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * - ``V4L2_AUDCAP_STEREO``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) - 0x00001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) - This is a stereo input. The flag is intended to automatically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) disable stereo recording etc. when the signal is always monaural.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) The API provides no means to detect if stereo is *received*,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unless the audio input belongs to a tuner.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * - ``V4L2_AUDCAP_AVL``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) - 0x00002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) - Automatic Volume Level mode is supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) .. _audio-mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) .. flat-table:: Audio Mode Flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) :widths: 3 1 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * - ``V4L2_AUDMODE_AVL``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) - 0x00001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - AVL mode is on.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) No audio inputs combine with the current video input, or the number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) of the selected audio input is out of bounds or it does not combine.