~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/media/v4l/control.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/media/v4l/control.rst (Architecture alpha) and /Documentation/userspace-api/media/v4l/control.rst (Architecture i386)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php