Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
af4a4d0d | 3 | .. _VIDIOC_G_AUDIO: |
5377d91f MH |
4 | |
5 | ************************************ | |
6 | ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO | |
7 | ************************************ | |
8 | ||
9 | *man VIDIOC_G_AUDIO(2)* | |
10 | ||
11 | VIDIOC_S_AUDIO | |
12 | Query or select the current audio input and its attributes | |
13 | ||
14 | ||
15 | Synopsis | |
16 | ======== | |
17 | ||
b7e67f6c | 18 | .. cpp:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) |
5377d91f | 19 | |
b7e67f6c | 20 | .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp ) |
5377d91f MH |
21 | |
22 | Arguments | |
23 | ========= | |
24 | ||
25 | ``fd`` | |
26 | File descriptor returned by :ref:`open() <func-open>`. | |
27 | ||
28 | ``request`` | |
29 | VIDIOC_G_AUDIO, VIDIOC_S_AUDIO | |
30 | ||
31 | ``argp`` | |
32 | ||
33 | ||
34 | Description | |
35 | =========== | |
36 | ||
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 | |
4e03cb76 | 39 | :ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill |
cdb4af0f | 40 | the rest of the structure or return an ``EINVAL`` error code when the device |
5377d91f MH |
41 | has no audio inputs, or none which combine with the current video input. |
42 | ||
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 | |
acf309a2 | 46 | :ref:`struct v4l2_audio <v4l2-audio>` structure and call the :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` |
5377d91f MH |
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. | |
50 | ||
51 | ||
52 | .. _v4l2-audio: | |
53 | ||
54 | .. flat-table:: struct v4l2_audio | |
55 | :header-rows: 0 | |
56 | :stub-columns: 0 | |
57 | :widths: 1 1 2 | |
58 | ||
59 | ||
60 | - .. row 1 | |
61 | ||
62 | - __u32 | |
63 | ||
64 | - ``index`` | |
65 | ||
66 | - Identifies the audio input, set by the driver or application. | |
67 | ||
68 | - .. row 2 | |
69 | ||
70 | - __u8 | |
71 | ||
72 | - ``name``\ [32] | |
73 | ||
74 | - Name of the audio input, a NUL-terminated ASCII string, for | |
0579e6e3 MCC |
75 | example: "Line In". This information is intended for the user, |
76 | preferably the connector label on the device itself. | |
5377d91f MH |
77 | |
78 | - .. row 3 | |
79 | ||
80 | - __u32 | |
81 | ||
82 | - ``capability`` | |
83 | ||
84 | - Audio capability flags, see :ref:`audio-capability`. | |
85 | ||
86 | - .. row 4 | |
87 | ||
88 | - __u32 | |
89 | ||
90 | - ``mode`` | |
91 | ||
92 | - Audio mode flags set by drivers and applications (on | |
0579e6e3 | 93 | :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`. |
5377d91f MH |
94 | |
95 | - .. row 5 | |
96 | ||
97 | - __u32 | |
98 | ||
99 | - ``reserved``\ [2] | |
100 | ||
101 | - Reserved for future extensions. Drivers and applications must set | |
0579e6e3 | 102 | the array to zero. |
5377d91f MH |
103 | |
104 | ||
105 | ||
106 | .. _audio-capability: | |
107 | ||
108 | .. flat-table:: Audio Capability Flags | |
109 | :header-rows: 0 | |
110 | :stub-columns: 0 | |
111 | :widths: 3 1 4 | |
112 | ||
113 | ||
114 | - .. row 1 | |
115 | ||
116 | - ``V4L2_AUDCAP_STEREO`` | |
117 | ||
118 | - 0x00001 | |
119 | ||
120 | - This is a stereo input. The flag is intended to automatically | |
0579e6e3 MCC |
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. | |
5377d91f MH |
124 | |
125 | - .. row 2 | |
126 | ||
127 | - ``V4L2_AUDCAP_AVL`` | |
128 | ||
129 | - 0x00002 | |
130 | ||
131 | - Automatic Volume Level mode is supported. | |
132 | ||
133 | ||
134 | ||
135 | .. _audio-mode: | |
136 | ||
137 | .. flat-table:: Audio Mode Flags | |
138 | :header-rows: 0 | |
139 | :stub-columns: 0 | |
140 | :widths: 3 1 4 | |
141 | ||
142 | ||
143 | - .. row 1 | |
144 | ||
145 | - ``V4L2_AUDMODE_AVL`` | |
146 | ||
147 | - 0x00001 | |
148 | ||
149 | - AVL mode is on. | |
150 | ||
151 | ||
152 | ||
153 | Return Value | |
154 | ============ | |
155 | ||
156 | On success 0 is returned, on error -1 and the ``errno`` variable is set | |
157 | appropriately. The generic error codes are described at the | |
158 | :ref:`Generic Error Codes <gen-errors>` chapter. | |
159 | ||
160 | EINVAL | |
161 | No audio inputs combine with the current video input, or the number | |
162 | of the selected audio input is out of bounds or it does not combine. |