Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | .. _control: | |
4 | ||
5 | ************* | |
6 | User Controls | |
7 | ************* | |
8 | ||
9 | Devices typically have a number of user-settable controls such as | |
10 | brightness, saturation and so on, which would be presented to the user | |
11 | on a graphical user interface. But, different devices will have | |
12 | different controls available, and furthermore, the range of possible | |
13 | values, and the default value will vary from device to device. The | |
14 | control ioctls provide the information and a mechanism to create a nice | |
15 | user interface for these controls that will work correctly with any | |
16 | device. | |
17 | ||
18 | All controls are accessed using an ID value. V4L2 defines several IDs | |
19 | for specific purposes. Drivers can also implement their own custom | |
20 | controls using ``V4L2_CID_PRIVATE_BASE`` [1]_ and higher values. The | |
21 | pre-defined control IDs have the prefix ``V4L2_CID_``, and are listed in | |
22 | :ref:`control-id`. The ID is used when querying the attributes of a | |
23 | control, and when getting or setting the current value. | |
24 | ||
25 | Generally applications should present controls to the user without | |
26 | assumptions about their purpose. Each control comes with a name string | |
27 | the user is supposed to understand. When the purpose is non-intuitive | |
28 | the driver writer should provide a user manual, a user interface plug-in | |
29 | or a driver specific panel application. Predefined IDs were introduced | |
30 | to change a few controls programmatically, for example to mute a device | |
31 | during a channel switch. | |
32 | ||
33 | Drivers may enumerate different controls after switching the current | |
34 | video input or output, tuner or modulator, or audio input or output. | |
35 | Different in the sense of other bounds, another default and current | |
36 | value, step size or other menu items. A control with a certain *custom* | |
37 | ID can also change name and type. | |
38 | ||
39 | If a control is not applicable to the current configuration of the | |
40 | device (for example, it doesn't apply to the current video input) | |
41 | drivers set the ``V4L2_CTRL_FLAG_INACTIVE`` flag. | |
42 | ||
43 | Control values are stored globally, they do not change when switching | |
44 | except to stay within the reported bounds. They also do not change e. g. | |
45 | when the device is opened or closed, when the tuner radio frequency is | |
46 | changed or generally never without application request. | |
47 | ||
48 | V4L2 specifies an event mechanism to notify applications when controls | |
49 | change value (see | |
7347081e | 50 | :ref:`VIDIOC_SUBSCRIBE_EVENT`, event |
5377d91f MH |
51 | ``V4L2_EVENT_CTRL``), panel applications might want to make use of that |
52 | in order to always reflect the correct control value. | |
53 | ||
54 | All controls use machine endianness. | |
55 | ||
56 | ||
57 | .. _control-id: | |
58 | ||
59 | Control IDs | |
60 | =========== | |
61 | ||
62 | ``V4L2_CID_BASE`` | |
63 | First predefined ID, equal to ``V4L2_CID_BRIGHTNESS``. | |
64 | ||
65 | ``V4L2_CID_USER_BASE`` | |
66 | Synonym of ``V4L2_CID_BASE``. | |
67 | ||
68 | ``V4L2_CID_BRIGHTNESS`` ``(integer)`` | |
69 | Picture brightness, or more precisely, the black level. | |
70 | ||
71 | ``V4L2_CID_CONTRAST`` ``(integer)`` | |
72 | Picture contrast or luma gain. | |
73 | ||
74 | ``V4L2_CID_SATURATION`` ``(integer)`` | |
75 | Picture color saturation or chroma gain. | |
76 | ||
77 | ``V4L2_CID_HUE`` ``(integer)`` | |
78 | Hue or color balance. | |
79 | ||
80 | ``V4L2_CID_AUDIO_VOLUME`` ``(integer)`` | |
81 | Overall audio volume. Note some drivers also provide an OSS or ALSA | |
82 | mixer interface. | |
83 | ||
84 | ``V4L2_CID_AUDIO_BALANCE`` ``(integer)`` | |
85 | Audio stereo balance. Minimum corresponds to all the way left, | |
86 | maximum to right. | |
87 | ||
88 | ``V4L2_CID_AUDIO_BASS`` ``(integer)`` | |
89 | Audio bass adjustment. | |
90 | ||
91 | ``V4L2_CID_AUDIO_TREBLE`` ``(integer)`` | |
92 | Audio treble adjustment. | |
93 | ||
94 | ``V4L2_CID_AUDIO_MUTE`` ``(boolean)`` | |
95 | Mute audio, i. e. set the volume to zero, however without affecting | |
96 | ``V4L2_CID_AUDIO_VOLUME``. Like ALSA drivers, V4L2 drivers must mute | |
97 | at load time to avoid excessive noise. Actually the entire device | |
98 | should be reset to a low power consumption state. | |
99 | ||
100 | ``V4L2_CID_AUDIO_LOUDNESS`` ``(boolean)`` | |
101 | Loudness mode (bass boost). | |
102 | ||
103 | ``V4L2_CID_BLACK_LEVEL`` ``(integer)`` | |
104 | Another name for brightness (not a synonym of | |
105 | ``V4L2_CID_BRIGHTNESS``). This control is deprecated and should not | |
106 | be used in new drivers and applications. | |
107 | ||
108 | ``V4L2_CID_AUTO_WHITE_BALANCE`` ``(boolean)`` | |
109 | Automatic white balance (cameras). | |
110 | ||
111 | ``V4L2_CID_DO_WHITE_BALANCE`` ``(button)`` | |
112 | This is an action control. When set (the value is ignored), the | |
113 | device will do a white balance and then hold the current setting. | |
114 | Contrast this with the boolean ``V4L2_CID_AUTO_WHITE_BALANCE``, | |
115 | which, when activated, keeps adjusting the white balance. | |
116 | ||
117 | ``V4L2_CID_RED_BALANCE`` ``(integer)`` | |
118 | Red chroma balance. | |
119 | ||
120 | ``V4L2_CID_BLUE_BALANCE`` ``(integer)`` | |
121 | Blue chroma balance. | |
122 | ||
123 | ``V4L2_CID_GAMMA`` ``(integer)`` | |
124 | Gamma adjust. | |
125 | ||
126 | ``V4L2_CID_WHITENESS`` ``(integer)`` | |
127 | Whiteness for grey-scale devices. This is a synonym for | |
128 | ``V4L2_CID_GAMMA``. This control is deprecated and should not be | |
129 | used in new drivers and applications. | |
130 | ||
131 | ``V4L2_CID_EXPOSURE`` ``(integer)`` | |
132 | Exposure (cameras). [Unit?] | |
133 | ||
134 | ``V4L2_CID_AUTOGAIN`` ``(boolean)`` | |
135 | Automatic gain/exposure control. | |
136 | ||
137 | ``V4L2_CID_GAIN`` ``(integer)`` | |
138 | Gain control. | |
139 | ||
140 | ``V4L2_CID_HFLIP`` ``(boolean)`` | |
141 | Mirror the picture horizontally. | |
142 | ||
143 | ``V4L2_CID_VFLIP`` ``(boolean)`` | |
144 | Mirror the picture vertically. | |
145 | ||
6aeb3f67 | 146 | .. _v4l2-power-line-frequency: |
5377d91f MH |
147 | |
148 | ``V4L2_CID_POWER_LINE_FREQUENCY`` ``(enum)`` | |
149 | Enables a power line frequency filter to avoid flicker. Possible | |
150 | values for ``enum v4l2_power_line_frequency`` are: | |
151 | ``V4L2_CID_POWER_LINE_FREQUENCY_DISABLED`` (0), | |
152 | ``V4L2_CID_POWER_LINE_FREQUENCY_50HZ`` (1), | |
153 | ``V4L2_CID_POWER_LINE_FREQUENCY_60HZ`` (2) and | |
154 | ``V4L2_CID_POWER_LINE_FREQUENCY_AUTO`` (3). | |
155 | ||
156 | ``V4L2_CID_HUE_AUTO`` ``(boolean)`` | |
157 | Enables automatic hue control by the device. The effect of setting | |
158 | ``V4L2_CID_HUE`` while automatic hue control is enabled is | |
159 | undefined, drivers should ignore such request. | |
160 | ||
161 | ``V4L2_CID_WHITE_BALANCE_TEMPERATURE`` ``(integer)`` | |
162 | This control specifies the white balance settings as a color | |
163 | temperature in Kelvin. A driver should have a minimum of 2800 | |
164 | (incandescent) to 6500 (daylight). For more information about color | |
165 | temperature see | |
166 | `Wikipedia <http://en.wikipedia.org/wiki/Color_temperature>`__. | |
167 | ||
168 | ``V4L2_CID_SHARPNESS`` ``(integer)`` | |
169 | Adjusts the sharpness filters in a camera. The minimum value | |
170 | disables the filters, higher values give a sharper picture. | |
171 | ||
172 | ``V4L2_CID_BACKLIGHT_COMPENSATION`` ``(integer)`` | |
173 | Adjusts the backlight compensation in a camera. The minimum value | |
174 | disables backlight compensation. | |
175 | ||
176 | ``V4L2_CID_CHROMA_AGC`` ``(boolean)`` | |
177 | Chroma automatic gain control. | |
178 | ||
179 | ``V4L2_CID_CHROMA_GAIN`` ``(integer)`` | |
180 | Adjusts the Chroma gain control (for use when chroma AGC is | |
181 | disabled). | |
182 | ||
183 | ``V4L2_CID_COLOR_KILLER`` ``(boolean)`` | |
184 | Enable the color killer (i. e. force a black & white image in case | |
185 | of a weak video signal). | |
186 | ||
6aeb3f67 | 187 | .. _v4l2-colorfx: |
5377d91f MH |
188 | |
189 | ``V4L2_CID_COLORFX`` ``(enum)`` | |
190 | Selects a color effect. The following values are defined: | |
191 | ||
192 | ||
193 | ||
194 | .. flat-table:: | |
195 | :header-rows: 0 | |
196 | :stub-columns: 0 | |
197 | ||
198 | ||
199 | - .. row 1 | |
200 | ||
201 | - ``V4L2_COLORFX_NONE`` | |
202 | ||
203 | - Color effect is disabled. | |
204 | ||
205 | - .. row 2 | |
206 | ||
207 | - ``V4L2_COLORFX_ANTIQUE`` | |
208 | ||
209 | - An aging (old photo) effect. | |
210 | ||
211 | - .. row 3 | |
212 | ||
213 | - ``V4L2_COLORFX_ART_FREEZE`` | |
214 | ||
215 | - Frost color effect. | |
216 | ||
217 | - .. row 4 | |
218 | ||
219 | - ``V4L2_COLORFX_AQUA`` | |
220 | ||
221 | - Water color, cool tone. | |
222 | ||
223 | - .. row 5 | |
224 | ||
225 | - ``V4L2_COLORFX_BW`` | |
226 | ||
227 | - Black and white. | |
228 | ||
229 | - .. row 6 | |
230 | ||
231 | - ``V4L2_COLORFX_EMBOSS`` | |
232 | ||
233 | - Emboss, the highlights and shadows replace light/dark boundaries | |
0579e6e3 | 234 | and low contrast areas are set to a gray background. |
5377d91f MH |
235 | |
236 | - .. row 7 | |
237 | ||
238 | - ``V4L2_COLORFX_GRASS_GREEN`` | |
239 | ||
240 | - Grass green. | |
241 | ||
242 | - .. row 8 | |
243 | ||
244 | - ``V4L2_COLORFX_NEGATIVE`` | |
245 | ||
246 | - Negative. | |
247 | ||
248 | - .. row 9 | |
249 | ||
250 | - ``V4L2_COLORFX_SEPIA`` | |
251 | ||
252 | - Sepia tone. | |
253 | ||
254 | - .. row 10 | |
255 | ||
256 | - ``V4L2_COLORFX_SKETCH`` | |
257 | ||
258 | - Sketch. | |
259 | ||
260 | - .. row 11 | |
261 | ||
262 | - ``V4L2_COLORFX_SKIN_WHITEN`` | |
263 | ||
264 | - Skin whiten. | |
265 | ||
266 | - .. row 12 | |
267 | ||
268 | - ``V4L2_COLORFX_SKY_BLUE`` | |
269 | ||
270 | - Sky blue. | |
271 | ||
272 | - .. row 13 | |
273 | ||
274 | - ``V4L2_COLORFX_SOLARIZATION`` | |
275 | ||
276 | - Solarization, the image is partially reversed in tone, only color | |
0579e6e3 | 277 | values above or below a certain threshold are inverted. |
5377d91f MH |
278 | |
279 | - .. row 14 | |
280 | ||
281 | - ``V4L2_COLORFX_SILHOUETTE`` | |
282 | ||
283 | - Silhouette (outline). | |
284 | ||
285 | - .. row 15 | |
286 | ||
287 | - ``V4L2_COLORFX_VIVID`` | |
288 | ||
289 | - Vivid colors. | |
290 | ||
291 | - .. row 16 | |
292 | ||
293 | - ``V4L2_COLORFX_SET_CBCR`` | |
294 | ||
295 | - The Cb and Cr chroma components are replaced by fixed coefficients | |
0579e6e3 | 296 | determined by ``V4L2_CID_COLORFX_CBCR`` control. |
5377d91f MH |
297 | |
298 | ||
299 | ||
300 | ``V4L2_CID_COLORFX_CBCR`` ``(integer)`` | |
301 | Determines the Cb and Cr coefficients for ``V4L2_COLORFX_SET_CBCR`` | |
302 | color effect. Bits [7:0] of the supplied 32 bit value are | |
303 | interpreted as Cr component, bits [15:8] as Cb component and bits | |
304 | [31:16] must be zero. | |
305 | ||
306 | ``V4L2_CID_AUTOBRIGHTNESS`` ``(boolean)`` | |
307 | Enable Automatic Brightness. | |
308 | ||
309 | ``V4L2_CID_ROTATE`` ``(integer)`` | |
310 | Rotates the image by specified angle. Common angles are 90, 270 and | |
311 | 180. Rotating the image to 90 and 270 will reverse the height and | |
312 | width of the display window. It is necessary to set the new height | |
313 | and width of the picture using the | |
af4a4d0d | 314 | :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl according to the |
5377d91f MH |
315 | rotation angle selected. |
316 | ||
317 | ``V4L2_CID_BG_COLOR`` ``(integer)`` | |
318 | Sets the background color on the current output device. Background | |
319 | color needs to be specified in the RGB24 format. The supplied 32 bit | |
320 | value is interpreted as bits 0-7 Red color information, bits 8-15 | |
321 | Green color information, bits 16-23 Blue color information and bits | |
322 | 24-31 must be zero. | |
323 | ||
324 | ``V4L2_CID_ILLUMINATORS_1 V4L2_CID_ILLUMINATORS_2`` ``(boolean)`` | |
325 | Switch on or off the illuminator 1 or 2 of the device (usually a | |
326 | microscope). | |
327 | ||
328 | ``V4L2_CID_MIN_BUFFERS_FOR_CAPTURE`` ``(integer)`` | |
329 | This is a read-only control that can be read by the application and | |
330 | used as a hint to determine the number of CAPTURE buffers to pass to | |
331 | REQBUFS. The value is the minimum number of CAPTURE buffers that is | |
332 | necessary for hardware to work. | |
333 | ||
334 | ``V4L2_CID_MIN_BUFFERS_FOR_OUTPUT`` ``(integer)`` | |
335 | This is a read-only control that can be read by the application and | |
336 | used as a hint to determine the number of OUTPUT buffers to pass to | |
337 | REQBUFS. The value is the minimum number of OUTPUT buffers that is | |
338 | necessary for hardware to work. | |
339 | ||
6aeb3f67 | 340 | .. _v4l2-alpha-component: |
5377d91f MH |
341 | |
342 | ``V4L2_CID_ALPHA_COMPONENT`` ``(integer)`` | |
343 | Sets the alpha color component. When a capture device (or capture | |
344 | queue of a mem-to-mem device) produces a frame format that includes | |
345 | an alpha component (e.g. | |
346 | :ref:`packed RGB image formats <rgb-formats>`) and the alpha value | |
347 | is not defined by the device or the mem-to-mem input data this | |
348 | control lets you select the alpha component value of all pixels. | |
349 | When an output device (or output queue of a mem-to-mem device) | |
350 | consumes a frame format that doesn't include an alpha component and | |
351 | the device supports alpha channel processing this control lets you | |
352 | set the alpha component value of all pixels for further processing | |
353 | in the device. | |
354 | ||
355 | ``V4L2_CID_LASTP1`` | |
356 | End of the predefined control IDs (currently | |
357 | ``V4L2_CID_ALPHA_COMPONENT`` + 1). | |
358 | ||
359 | ``V4L2_CID_PRIVATE_BASE`` | |
360 | ID of the first custom (driver specific) control. Applications | |
361 | depending on particular custom controls should check the driver name | |
362 | and version, see :ref:`querycap`. | |
363 | ||
364 | Applications can enumerate the available controls with the | |
7347081e | 365 | :ref:`VIDIOC_QUERYCTRL` and |
af4a4d0d | 366 | :ref:`VIDIOC_QUERYMENU <VIDIOC_QUERYCTRL>` ioctls, get and set a |
4e03cb76 | 367 | control value with the :ref:`VIDIOC_G_CTRL <VIDIOC_G_CTRL>` and |
af4a4d0d | 368 | :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` ioctls. Drivers must implement |
5377d91f MH |
369 | ``VIDIOC_QUERYCTRL``, ``VIDIOC_G_CTRL`` and ``VIDIOC_S_CTRL`` when the |
370 | device has one or more controls, ``VIDIOC_QUERYMENU`` when it has one or | |
371 | more menu type controls. | |
372 | ||
373 | ||
bb27da1d MCC |
374 | .. _enum_all_controls: |
375 | ||
5377d91f | 376 | .. code-block:: c |
da1621c3 | 377 | :caption: Example 1.8. Enumerating all user controls |
63ea6309 | 378 | |
5377d91f MH |
379 | |
380 | struct v4l2_queryctrl queryctrl; | |
381 | struct v4l2_querymenu querymenu; | |
382 | ||
383 | static void enumerate_menu(void) | |
384 | { | |
0579e6e3 MCC |
385 | printf(" Menu items:\\n"); |
386 | ||
387 | memset(&querymenu, 0, sizeof(querymenu)); | |
388 | querymenu.id = queryctrl.id; | |
389 | ||
390 | for (querymenu.index = queryctrl.minimum; | |
391 | querymenu.index <= queryctrl.maximum; | |
392 | querymenu.index++) { | |
393 | if (0 == ioctl(fd, VIDIOC_QUERYMENU, &querymenu)) { | |
394 | printf(" %s\\n", querymenu.name); | |
395 | } | |
396 | } | |
5377d91f MH |
397 | } |
398 | ||
399 | memset(&queryctrl, 0, sizeof(queryctrl)); | |
400 | ||
401 | for (queryctrl.id = V4L2_CID_BASE; | |
0579e6e3 MCC |
402 | queryctrl.id < V4L2_CID_LASTP1; |
403 | queryctrl.id++) { | |
404 | if (0 == ioctl(fd, VIDIOC_QUERYCTRL, &queryctrl)) { | |
405 | if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) | |
406 | continue; | |
407 | ||
408 | printf("Control %s\\n", queryctrl.name); | |
409 | ||
410 | if (queryctrl.type == V4L2_CTRL_TYPE_MENU) | |
411 | enumerate_menu(); | |
412 | } else { | |
413 | if (errno == EINVAL) | |
414 | continue; | |
415 | ||
416 | perror("VIDIOC_QUERYCTRL"); | |
417 | exit(EXIT_FAILURE); | |
418 | } | |
5377d91f MH |
419 | } |
420 | ||
421 | for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; | |
0579e6e3 MCC |
422 | queryctrl.id++) { |
423 | if (0 == ioctl(fd, VIDIOC_QUERYCTRL, &queryctrl)) { | |
424 | if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) | |
425 | continue; | |
426 | ||
427 | printf("Control %s\\n", queryctrl.name); | |
428 | ||
429 | if (queryctrl.type == V4L2_CTRL_TYPE_MENU) | |
430 | enumerate_menu(); | |
431 | } else { | |
432 | if (errno == EINVAL) | |
433 | break; | |
434 | ||
435 | perror("VIDIOC_QUERYCTRL"); | |
436 | exit(EXIT_FAILURE); | |
437 | } | |
5377d91f MH |
438 | } |
439 | ||
440 | ||
441 | .. code-block:: c | |
da1621c3 | 442 | :caption: Example 1.9. Enumerating all user controls (alternative) |
5377d91f MH |
443 | |
444 | memset(&queryctrl, 0, sizeof(queryctrl)); | |
445 | ||
446 | queryctrl.id = V4L2_CTRL_CLASS_USER | V4L2_CTRL_FLAG_NEXT_CTRL; | |
447 | while (0 == ioctl(fd, VIDIOC_QUERYCTRL, &queryctrl)) { | |
0579e6e3 MCC |
448 | if (V4L2_CTRL_ID2CLASS(queryctrl.id) != V4L2_CTRL_CLASS_USER) |
449 | break; | |
450 | if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) | |
451 | continue; | |
5377d91f | 452 | |
0579e6e3 | 453 | printf("Control %s\\n", queryctrl.name); |
5377d91f | 454 | |
0579e6e3 MCC |
455 | if (queryctrl.type == V4L2_CTRL_TYPE_MENU) |
456 | enumerate_menu(); | |
5377d91f | 457 | |
0579e6e3 | 458 | queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; |
5377d91f MH |
459 | } |
460 | if (errno != EINVAL) { | |
0579e6e3 MCC |
461 | perror("VIDIOC_QUERYCTRL"); |
462 | exit(EXIT_FAILURE); | |
5377d91f MH |
463 | } |
464 | ||
465 | ||
466 | .. code-block:: c | |
da1621c3 | 467 | :caption: Example 1.10. Changing controls |
5377d91f MH |
468 | |
469 | struct v4l2_queryctrl queryctrl; | |
470 | struct v4l2_control control; | |
471 | ||
472 | memset(&queryctrl, 0, sizeof(queryctrl)); | |
473 | queryctrl.id = V4L2_CID_BRIGHTNESS; | |
474 | ||
475 | if (-1 == ioctl(fd, VIDIOC_QUERYCTRL, &queryctrl)) { | |
0579e6e3 MCC |
476 | if (errno != EINVAL) { |
477 | perror("VIDIOC_QUERYCTRL"); | |
478 | exit(EXIT_FAILURE); | |
479 | } else { | |
480 | printf("V4L2_CID_BRIGHTNESS is not supportedn"); | |
481 | } | |
5377d91f | 482 | } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { |
0579e6e3 | 483 | printf("V4L2_CID_BRIGHTNESS is not supportedn"); |
5377d91f | 484 | } else { |
0579e6e3 MCC |
485 | memset(&control, 0, sizeof (control)); |
486 | control.id = V4L2_CID_BRIGHTNESS; | |
487 | control.value = queryctrl.default_value; | |
488 | ||
489 | if (-1 == ioctl(fd, VIDIOC_S_CTRL, &control)) { | |
490 | perror("VIDIOC_S_CTRL"); | |
491 | exit(EXIT_FAILURE); | |
492 | } | |
5377d91f MH |
493 | } |
494 | ||
495 | memset(&control, 0, sizeof(control)); | |
496 | control.id = V4L2_CID_CONTRAST; | |
497 | ||
498 | if (0 == ioctl(fd, VIDIOC_G_CTRL, &control)) { | |
0579e6e3 | 499 | control.value += 1; |
5377d91f | 500 | |
0579e6e3 | 501 | /* The driver may clamp the value or return ERANGE, ignored here */ |
5377d91f | 502 | |
0579e6e3 MCC |
503 | if (-1 == ioctl(fd, VIDIOC_S_CTRL, &control) |
504 | && errno != ERANGE) { | |
505 | perror("VIDIOC_S_CTRL"); | |
506 | exit(EXIT_FAILURE); | |
507 | } | |
5377d91f MH |
508 | /* Ignore if V4L2_CID_CONTRAST is unsupported */ |
509 | } else if (errno != EINVAL) { | |
0579e6e3 MCC |
510 | perror("VIDIOC_G_CTRL"); |
511 | exit(EXIT_FAILURE); | |
5377d91f MH |
512 | } |
513 | ||
514 | control.id = V4L2_CID_AUDIO_MUTE; | |
515 | control.value = 1; /* silence */ | |
516 | ||
517 | /* Errors ignored */ | |
518 | ioctl(fd, VIDIOC_S_CTRL, &control); | |
519 | ||
520 | .. [1] | |
521 | The use of ``V4L2_CID_PRIVATE_BASE`` is problematic because different | |
522 | drivers may use the same ``V4L2_CID_PRIVATE_BASE`` ID for different | |
523 | controls. This makes it hard to programatically set such controls | |
524 | since the meaning of the control with that ID is driver dependent. In | |
525 | order to resolve this drivers use unique IDs and the | |
526 | ``V4L2_CID_PRIVATE_BASE`` IDs are mapped to those unique IDs by the | |
527 | kernel. Consider these ``V4L2_CID_PRIVATE_BASE`` IDs as aliases to | |
528 | the real IDs. | |
529 | ||
530 | Many applications today still use the ``V4L2_CID_PRIVATE_BASE`` IDs | |
7347081e | 531 | instead of using :ref:`VIDIOC_QUERYCTRL` with |
5377d91f MH |
532 | the ``V4L2_CTRL_FLAG_NEXT_CTRL`` flag to enumerate all IDs, so |
533 | support for ``V4L2_CID_PRIVATE_BASE`` is still around. |