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