1 .. -*- coding: utf-8; mode: rst -*-
5 ************************************
6 ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO
7 ************************************
12 VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its attributes
17 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_audio *argp )
19 .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp )
26 File descriptor returned by :ref:`open() <func-open>`.
29 VIDIOC_G_AUDIO, VIDIOC_S_AUDIO
37 To query the current audio input applications zero out the ``reserved``
38 array of a struct :ref:`v4l2_audio <v4l2-audio>` and call the
39 :ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill
40 the rest of the structure or return an ``EINVAL`` error code when the device
41 has no audio inputs, or none which combine with the current video input.
43 Audio inputs have one writable property, the audio mode. To select the
44 current audio input *and* change the audio mode, applications initialize
45 the ``index`` and ``mode`` fields, and the ``reserved`` array of a
46 :ref:`struct v4l2_audio <v4l2-audio>` structure and call the :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>`
47 ioctl. Drivers may switch to a different audio mode if the request
48 cannot be satisfied. However, this is a write-only ioctl, it does not
49 return the actual new audio mode.
54 .. flat-table:: struct v4l2_audio
66 - Identifies the audio input, set by the driver or application.
74 - Name of the audio input, a NUL-terminated ASCII string, for
75 example: "Line In". This information is intended for the user,
76 preferably the connector label on the device itself.
84 - Audio capability flags, see :ref:`audio-capability`.
92 - Audio mode flags set by drivers and applications (on
93 :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`.
101 - Reserved for future extensions. Drivers and applications must set
106 .. _audio-capability:
108 .. flat-table:: Audio Capability Flags
116 - ``V4L2_AUDCAP_STEREO``
120 - This is a stereo input. The flag is intended to automatically
121 disable stereo recording etc. when the signal is always monaural.
122 The API provides no means to detect if stereo is *received*,
123 unless the audio input belongs to a tuner.
127 - ``V4L2_AUDCAP_AVL``
131 - Automatic Volume Level mode is supported.
137 .. flat-table:: Audio Mode Flags
145 - ``V4L2_AUDMODE_AVL``
155 On success 0 is returned, on error -1 and the ``errno`` variable is set
156 appropriately. The generic error codes are described at the
157 :ref:`Generic Error Codes <gen-errors>` chapter.
160 No audio inputs combine with the current video input, or the number
161 of the selected audio input is out of bounds or it does not combine.