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