1.. -*- coding: utf-8; mode: rst -*- 2 3.. _VIDIOC_G_AUDIO: 4 5************************************ 6ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO 7************************************ 8 9Name 10==== 11 12VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its attributes 13 14 15Synopsis 16======== 17 18.. c:function:: int ioctl( int fd, VIDIOC_G_AUDIO, struct v4l2_audio *argp ) 19 :name: VIDIOC_G_AUDIO 20 21.. c:function:: int ioctl( int fd, VIDIOC_S_AUDIO, const struct v4l2_audio *argp ) 22 :name: VIDIOC_S_AUDIO 23 24 25Arguments 26========= 27 28``fd`` 29 File descriptor returned by :ref:`open() <func-open>`. 30 31``argp`` 32 Pointer to struct :c:type:`v4l2_audio`. 33 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 53.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 54 55.. c:type:: v4l2_audio 56 57.. flat-table:: struct v4l2_audio 58 :header-rows: 0 59 :stub-columns: 0 60 :widths: 1 1 2 61 62 * - __u32 63 - ``index`` 64 - Identifies the audio input, set by the driver or application. 65 * - __u8 66 - ``name``\ [32] 67 - Name of the audio input, a NUL-terminated ASCII string, for 68 example: "Line In". This information is intended for the user, 69 preferably the connector label on the device itself. 70 * - __u32 71 - ``capability`` 72 - Audio capability flags, see :ref:`audio-capability`. 73 * - __u32 74 - ``mode`` 75 - Audio mode flags set by drivers and applications (on 76 :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`. 77 * - __u32 78 - ``reserved``\ [2] 79 - Reserved for future extensions. Drivers and applications must set 80 the array to zero. 81 82 83 84.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 85 86.. _audio-capability: 87 88.. flat-table:: Audio Capability Flags 89 :header-rows: 0 90 :stub-columns: 0 91 :widths: 3 1 4 92 93 * - ``V4L2_AUDCAP_STEREO`` 94 - 0x00001 95 - This is a stereo input. The flag is intended to automatically 96 disable stereo recording etc. when the signal is always monaural. 97 The API provides no means to detect if stereo is *received*, 98 unless the audio input belongs to a tuner. 99 * - ``V4L2_AUDCAP_AVL`` 100 - 0x00002 101 - Automatic Volume Level mode is supported. 102 103 104 105.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 106 107.. _audio-mode: 108 109.. flat-table:: Audio Mode Flags 110 :header-rows: 0 111 :stub-columns: 0 112 :widths: 3 1 4 113 114 * - ``V4L2_AUDMODE_AVL`` 115 - 0x00001 116 - AVL mode is on. 117 118 119Return Value 120============ 121 122On success 0 is returned, on error -1 and the ``errno`` variable is set 123appropriately. The generic error codes are described at the 124:ref:`Generic Error Codes <gen-errors>` chapter. 125 126EINVAL 127 No audio inputs combine with the current video input, or the number 128 of the selected audio input is out of bounds or it does not combine. 129