125 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_G_AUDIO:5 6************************************7ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO8************************************9 10Name11====12 13VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its attributes14 15Synopsis16========17 18.. c:macro:: VIDIOC_G_AUDIO19 20``int ioctl(int fd, VIDIOC_G_AUDIO, struct v4l2_audio *argp)``21 22.. c:macro:: VIDIOC_S_AUDIO23 24``int ioctl(int fd, VIDIOC_S_AUDIO, const struct v4l2_audio *argp)``25 26Arguments27=========28 29``fd``30 File descriptor returned by :c:func:`open()`.31 32``argp``33 Pointer to struct :c:type:`v4l2_audio`.34 35Description36===========37 38To query the current audio input applications zero out the ``reserved``39array of a struct :c:type:`v4l2_audio` and call the40:ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill41the rest of the structure or return an ``EINVAL`` error code when the device42has no audio inputs, or none which combine with the current video input.43 44Audio inputs have one writable property, the audio mode. To select the45current audio input *and* change the audio mode, applications initialize46the ``index`` and ``mode`` fields, and the ``reserved`` array of a47struct :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 request49cannot be satisfied. However, this is a write-only ioctl, it does not50return the actual new audio mode.51 52.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|53 54.. c:type:: v4l2_audio55 56.. flat-table:: struct v4l2_audio57 :header-rows: 058 :stub-columns: 059 :widths: 1 1 260 61 * - __u3262 - ``index``63 - Identifies the audio input, set by the driver or application.64 * - __u865 - ``name``\ [32]66 - Name of the audio input, a NUL-terminated ASCII string, for67 example: "Line In". This information is intended for the user,68 preferably the connector label on the device itself.69 * - __u3270 - ``capability``71 - Audio capability flags, see :ref:`audio-capability`.72 * - __u3273 - ``mode``74 - Audio mode flags set by drivers and applications (on75 :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`.76 * - __u3277 - ``reserved``\ [2]78 - Reserved for future extensions. Drivers and applications must set79 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 Flags87 :header-rows: 088 :stub-columns: 089 :widths: 3 1 490 91 * - ``V4L2_AUDCAP_STEREO``92 - 0x0000193 - This is a stereo input. The flag is intended to automatically94 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 - 0x0000299 - 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 Flags107 :header-rows: 0108 :stub-columns: 0109 :widths: 3 1 4110 111 * - ``V4L2_AUDMODE_AVL``112 - 0x00001113 - AVL mode is on.114 115Return Value116============117 118On success 0 is returned, on error -1 and the ``errno`` variable is set119appropriately. The generic error codes are described at the120:ref:`Generic Error Codes <gen-errors>` chapter.121 122EINVAL123 No audio inputs combine with the current video input, or the number124 of the selected audio input is out of bounds or it does not combine.125