vidioc-queryctrl.rst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_QUERYCTRL:
  4. *******************************************************************
  5. ioctls VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL and VIDIOC_QUERYMENU
  6. *******************************************************************
  7. Name
  8. ====
  9. VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls and menu control items
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_QUERY_CTRL
  13. ``int ioctl(int fd, int VIDIOC_QUERYCTRL, struct v4l2_queryctrl *argp)``
  14. .. c:macro:: VIDIOC_QUERY_EXT_CTRL
  15. ``int ioctl(int fd, VIDIOC_QUERY_EXT_CTRL, struct v4l2_query_ext_ctrl *argp)``
  16. .. c:macro:: VIDIOC_QUERYMENU
  17. ``int ioctl(int fd, VIDIOC_QUERYMENU, struct v4l2_querymenu *argp)``
  18. Arguments
  19. =========
  20. ``fd``
  21. File descriptor returned by :c:func:`open()`.
  22. ``argp``
  23. Pointer to struct :c:type:`v4l2_queryctrl`, :c:type:`v4l2_query_ext_ctrl`
  24. or :c:type:`v4l2_querymenu` (depending on the ioctl).
  25. Description
  26. ===========
  27. To query the attributes of a control applications set the ``id`` field
  28. of a struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` and call the
  29. ``VIDIOC_QUERYCTRL`` ioctl with a pointer to this structure. The driver
  30. fills the rest of the structure or returns an ``EINVAL`` error code when the
  31. ``id`` is invalid.
  32. It is possible to enumerate controls by calling ``VIDIOC_QUERYCTRL``
  33. with successive ``id`` values starting from ``V4L2_CID_BASE`` up to and
  34. exclusive ``V4L2_CID_LASTP1``. Drivers may return ``EINVAL`` if a control in
  35. this range is not supported. Further applications can enumerate private
  36. controls, which are not defined in this specification, by starting at
  37. ``V4L2_CID_PRIVATE_BASE`` and incrementing ``id`` until the driver
  38. returns ``EINVAL``.
  39. In both cases, when the driver sets the ``V4L2_CTRL_FLAG_DISABLED`` flag
  40. in the ``flags`` field this control is permanently disabled and should
  41. be ignored by the application. [#f1]_
  42. When the application ORs ``id`` with ``V4L2_CTRL_FLAG_NEXT_CTRL`` the
  43. driver returns the next supported non-compound control, or ``EINVAL`` if
  44. there is none. In addition, the ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` flag
  45. can be specified to enumerate all compound controls (i.e. controls with
  46. type ≥ ``V4L2_CTRL_COMPOUND_TYPES`` and/or array control, in other words
  47. controls that contain more than one value). Specify both
  48. ``V4L2_CTRL_FLAG_NEXT_CTRL`` and ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` in
  49. order to enumerate all controls, compound or not. Drivers which do not
  50. support these flags yet always return ``EINVAL``.
  51. The ``VIDIOC_QUERY_EXT_CTRL`` ioctl was introduced in order to better
  52. support controls that can use compound types, and to expose additional
  53. control information that cannot be returned in struct
  54. :ref:`v4l2_queryctrl <v4l2-queryctrl>` since that structure is full.
  55. ``VIDIOC_QUERY_EXT_CTRL`` is used in the same way as
  56. ``VIDIOC_QUERYCTRL``, except that the ``reserved`` array must be zeroed
  57. as well.
  58. Additional information is required for menu controls: the names of the
  59. menu items. To query them applications set the ``id`` and ``index``
  60. fields of struct :ref:`v4l2_querymenu <v4l2-querymenu>` and call the
  61. ``VIDIOC_QUERYMENU`` ioctl with a pointer to this structure. The driver
  62. fills the rest of the structure or returns an ``EINVAL`` error code when the
  63. ``id`` or ``index`` is invalid. Menu items are enumerated by calling
  64. ``VIDIOC_QUERYMENU`` with successive ``index`` values from struct
  65. :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``minimum`` to ``maximum``,
  66. inclusive.
  67. .. note::
  68. It is possible for ``VIDIOC_QUERYMENU`` to return
  69. an ``EINVAL`` error code for some indices between ``minimum`` and
  70. ``maximum``. In that case that particular menu item is not supported by
  71. this driver. Also note that the ``minimum`` value is not necessarily 0.
  72. See also the examples in :ref:`control`.
  73. .. tabularcolumns:: |p{1.2cm}|p{3.6cm}|p{12.5cm}|
  74. .. _v4l2-queryctrl:
  75. .. c:struct:: v4l2_queryctrl
  76. .. cssclass:: longtable
  77. .. flat-table:: struct v4l2_queryctrl
  78. :header-rows: 0
  79. :stub-columns: 0
  80. :widths: 1 1 2
  81. * - __u32
  82. - ``id``
  83. - Identifies the control, set by the application. See
  84. :ref:`control-id` for predefined IDs. When the ID is ORed with
  85. V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and
  86. returns the first control with a higher ID. Drivers which do not
  87. support this flag yet always return an ``EINVAL`` error code.
  88. * - __u32
  89. - ``type``
  90. - Type of control, see :c:type:`v4l2_ctrl_type`.
  91. * - __u8
  92. - ``name``\ [32]
  93. - Name of the control, a NUL-terminated ASCII string. This
  94. information is intended for the user.
  95. * - __s32
  96. - ``minimum``
  97. - Minimum value, inclusive. This field gives a lower bound for the
  98. control. See enum :c:type:`v4l2_ctrl_type` how
  99. the minimum value is to be used for each possible control type.
  100. Note that this a signed 32-bit value.
  101. * - __s32
  102. - ``maximum``
  103. - Maximum value, inclusive. This field gives an upper bound for the
  104. control. See enum :c:type:`v4l2_ctrl_type` how
  105. the maximum value is to be used for each possible control type.
  106. Note that this a signed 32-bit value.
  107. * - __s32
  108. - ``step``
  109. - This field gives a step size for the control. See enum
  110. :c:type:`v4l2_ctrl_type` how the step value is
  111. to be used for each possible control type. Note that this an
  112. unsigned 32-bit value.
  113. Generally drivers should not scale hardware control values. It may
  114. be necessary for example when the ``name`` or ``id`` imply a
  115. particular unit and the hardware actually accepts only multiples
  116. of said unit. If so, drivers must take care values are properly
  117. rounded when scaling, such that errors will not accumulate on
  118. repeated read-write cycles.
  119. This field gives the smallest change of an integer control
  120. actually affecting hardware. Often the information is needed when
  121. the user can change controls by keyboard or GUI buttons, rather
  122. than a slider. When for example a hardware register accepts values
  123. 0-511 and the driver reports 0-65535, step should be 128.
  124. Note that although signed, the step value is supposed to be always
  125. positive.
  126. * - __s32
  127. - ``default_value``
  128. - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``,
  129. ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid
  130. for other types of controls.
  131. .. note::
  132. Drivers reset controls to their default value only when
  133. the driver is first loaded, never afterwards.
  134. * - __u32
  135. - ``flags``
  136. - Control flags, see :ref:`control-flags`.
  137. * - __u32
  138. - ``reserved``\ [2]
  139. - Reserved for future extensions. Drivers must set the array to
  140. zero.
  141. .. tabularcolumns:: |p{1.2cm}|p{5.5cm}|p{10.6cm}|
  142. .. _v4l2-query-ext-ctrl:
  143. .. cssclass:: longtable
  144. .. c:struct:: v4l2_query_ext_ctrl
  145. .. flat-table:: struct v4l2_query_ext_ctrl
  146. :header-rows: 0
  147. :stub-columns: 0
  148. :widths: 1 1 2
  149. * - __u32
  150. - ``id``
  151. - Identifies the control, set by the application. See
  152. :ref:`control-id` for predefined IDs. When the ID is ORed with
  153. ``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and
  154. returns the first non-compound control with a higher ID. When the
  155. ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears
  156. the flag and returns the first compound control with a higher ID.
  157. Set both to get the first control (compound or not) with a higher
  158. ID.
  159. * - __u32
  160. - ``type``
  161. - Type of control, see :c:type:`v4l2_ctrl_type`.
  162. * - char
  163. - ``name``\ [32]
  164. - Name of the control, a NUL-terminated ASCII string. This
  165. information is intended for the user.
  166. * - __s64
  167. - ``minimum``
  168. - Minimum value, inclusive. This field gives a lower bound for the
  169. control. See enum :c:type:`v4l2_ctrl_type` how
  170. the minimum value is to be used for each possible control type.
  171. Note that this a signed 64-bit value.
  172. * - __s64
  173. - ``maximum``
  174. - Maximum value, inclusive. This field gives an upper bound for the
  175. control. See enum :c:type:`v4l2_ctrl_type` how
  176. the maximum value is to be used for each possible control type.
  177. Note that this a signed 64-bit value.
  178. * - __u64
  179. - ``step``
  180. - This field gives a step size for the control. See enum
  181. :c:type:`v4l2_ctrl_type` how the step value is
  182. to be used for each possible control type. Note that this an
  183. unsigned 64-bit value.
  184. Generally drivers should not scale hardware control values. It may
  185. be necessary for example when the ``name`` or ``id`` imply a
  186. particular unit and the hardware actually accepts only multiples
  187. of said unit. If so, drivers must take care values are properly
  188. rounded when scaling, such that errors will not accumulate on
  189. repeated read-write cycles.
  190. This field gives the smallest change of an integer control
  191. actually affecting hardware. Often the information is needed when
  192. the user can change controls by keyboard or GUI buttons, rather
  193. than a slider. When for example a hardware register accepts values
  194. 0-511 and the driver reports 0-65535, step should be 128.
  195. * - __s64
  196. - ``default_value``
  197. - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``,
  198. ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8``
  199. or ``_U16`` control. Not valid for other types of controls.
  200. .. note::
  201. Drivers reset controls to their default value only when
  202. the driver is first loaded, never afterwards.
  203. * - __u32
  204. - ``flags``
  205. - Control flags, see :ref:`control-flags`.
  206. * - __u32
  207. - ``elem_size``
  208. - The size in bytes of a single element of the array. Given a char
  209. pointer ``p`` to a 3-dimensional array you can find the position
  210. of cell ``(z, y, x)`` as follows:
  211. ``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``.
  212. ``elem_size`` is always valid, also when the control isn't an
  213. array. For string controls ``elem_size`` is equal to
  214. ``maximum + 1``.
  215. * - __u32
  216. - ``elems``
  217. - The number of elements in the N-dimensional array. If this control
  218. is not an array, then ``elems`` is 1. The ``elems`` field can
  219. never be 0.
  220. * - __u32
  221. - ``nr_of_dims``
  222. - The number of dimension in the N-dimensional array. If this
  223. control is not an array, then this field is 0.
  224. * - __u32
  225. - ``dims[V4L2_CTRL_MAX_DIMS]``
  226. - The size of each dimension. The first ``nr_of_dims`` elements of
  227. this array must be non-zero, all remaining elements must be zero.
  228. * - __u32
  229. - ``reserved``\ [32]
  230. - Reserved for future extensions. Applications and drivers must set
  231. the array to zero.
  232. .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.1cm}|
  233. .. _v4l2-querymenu:
  234. .. c:struct:: v4l2_querymenu
  235. .. flat-table:: struct v4l2_querymenu
  236. :header-rows: 0
  237. :stub-columns: 0
  238. :widths: 1 1 2
  239. * - __u32
  240. - ``id``
  241. - Identifies the control, set by the application from the respective
  242. struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id``.
  243. * - __u32
  244. - ``index``
  245. - Index of the menu item, starting at zero, set by the application.
  246. * - union {
  247. - (anonymous)
  248. * - __u8
  249. - ``name``\ [32]
  250. - Name of the menu item, a NUL-terminated ASCII string. This
  251. information is intended for the user. This field is valid for
  252. ``V4L2_CTRL_TYPE_MENU`` type controls.
  253. * - __s64
  254. - ``value``
  255. - Value of the integer menu item. This field is valid for
  256. ``V4L2_CTRL_TYPE_INTEGER_MENU`` type controls.
  257. * - }
  258. -
  259. * - __u32
  260. - ``reserved``
  261. - Reserved for future extensions. Drivers must set the array to
  262. zero.
  263. .. c:type:: v4l2_ctrl_type
  264. .. raw:: latex
  265. \footnotesize
  266. .. tabularcolumns:: |p{6.5cm}|p{1.5cm}|p{1.1cm}|p{1.5cm}|p{6.8cm}|
  267. .. cssclass:: longtable
  268. .. flat-table:: enum v4l2_ctrl_type
  269. :header-rows: 1
  270. :stub-columns: 0
  271. :widths: 30 5 5 5 55
  272. * - Type
  273. - ``minimum``
  274. - ``step``
  275. - ``maximum``
  276. - Description
  277. * - ``V4L2_CTRL_TYPE_INTEGER``
  278. - any
  279. - any
  280. - any
  281. - An integer-valued control ranging from minimum to maximum
  282. inclusive. The step value indicates the increment between values.
  283. * - ``V4L2_CTRL_TYPE_BOOLEAN``
  284. - 0
  285. - 1
  286. - 1
  287. - A boolean-valued control. Zero corresponds to "disabled", and one
  288. means "enabled".
  289. * - ``V4L2_CTRL_TYPE_MENU``
  290. - ≥ 0
  291. - 1
  292. - N-1
  293. - The control has a menu of N choices. The names of the menu items
  294. can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl.
  295. * - ``V4L2_CTRL_TYPE_INTEGER_MENU``
  296. - ≥ 0
  297. - 1
  298. - N-1
  299. - The control has a menu of N choices. The values of the menu items
  300. can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is
  301. similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings,
  302. the menu items are signed 64-bit integers.
  303. * - ``V4L2_CTRL_TYPE_BITMASK``
  304. - 0
  305. - n/a
  306. - any
  307. - A bitmask field. The maximum value is the set of bits that can be
  308. used, all other bits are to be 0. The maximum value is interpreted
  309. as a __u32, allowing the use of bit 31 in the bitmask.
  310. * - ``V4L2_CTRL_TYPE_BUTTON``
  311. - 0
  312. - 0
  313. - 0
  314. - A control which performs an action when set. Drivers must ignore
  315. the value passed with ``VIDIOC_S_CTRL`` and return an ``EACCES`` error
  316. code on a ``VIDIOC_G_CTRL`` attempt.
  317. * - ``V4L2_CTRL_TYPE_INTEGER64``
  318. - any
  319. - any
  320. - any
  321. - A 64-bit integer valued control. Minimum, maximum and step size
  322. cannot be queried using ``VIDIOC_QUERYCTRL``. Only
  323. ``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step
  324. values, they should be interpreted as n/a when using
  325. ``VIDIOC_QUERYCTRL``.
  326. * - ``V4L2_CTRL_TYPE_STRING``
  327. - ≥ 0
  328. - ≥ 1
  329. - ≥ 0
  330. - The minimum and maximum string lengths. The step size means that
  331. the string must be (minimum + N * step) characters long for N ≥ 0.
  332. These lengths do not include the terminating zero, so in order to
  333. pass a string of length 8 to
  334. :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you need to
  335. set the ``size`` field of struct
  336. :c:type:`v4l2_ext_control` to 9. For
  337. :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you can set
  338. the ``size`` field to ``maximum`` + 1. Which character encoding is
  339. used will depend on the string control itself and should be part
  340. of the control documentation.
  341. * - ``V4L2_CTRL_TYPE_CTRL_CLASS``
  342. - n/a
  343. - n/a
  344. - n/a
  345. - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a
  346. control ID equal to a control class code (see :ref:`ctrl-class`)
  347. + 1, the ioctl returns the name of the control class and this
  348. control type. Older drivers which do not support this feature
  349. return an ``EINVAL`` error code.
  350. * - ``V4L2_CTRL_TYPE_U8``
  351. - any
  352. - any
  353. - any
  354. - An unsigned 8-bit valued control ranging from minimum to maximum
  355. inclusive. The step value indicates the increment between values.
  356. * - ``V4L2_CTRL_TYPE_U16``
  357. - any
  358. - any
  359. - any
  360. - An unsigned 16-bit valued control ranging from minimum to maximum
  361. inclusive. The step value indicates the increment between values.
  362. * - ``V4L2_CTRL_TYPE_U32``
  363. - any
  364. - any
  365. - any
  366. - An unsigned 32-bit valued control ranging from minimum to maximum
  367. inclusive. The step value indicates the increment between values.
  368. * - ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``
  369. - n/a
  370. - n/a
  371. - n/a
  372. - A struct :c:type:`v4l2_ctrl_mpeg2_quantisation`, containing MPEG-2
  373. quantisation matrices for stateless video decoders.
  374. * - ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``
  375. - n/a
  376. - n/a
  377. - n/a
  378. - A struct :c:type:`v4l2_ctrl_mpeg2_sequence`, containing MPEG-2
  379. sequence parameters for stateless video decoders.
  380. * - ``V4L2_CTRL_TYPE_MPEG2_PICTURE``
  381. - n/a
  382. - n/a
  383. - n/a
  384. - A struct :c:type:`v4l2_ctrl_mpeg2_picture`, containing MPEG-2
  385. picture parameters for stateless video decoders.
  386. * - ``V4L2_CTRL_TYPE_AREA``
  387. - n/a
  388. - n/a
  389. - n/a
  390. - A struct :c:type:`v4l2_area`, containing the width and the height
  391. of a rectangular area. Units depend on the use case.
  392. * - ``V4L2_CTRL_TYPE_RECT``
  393. - n/a
  394. - n/a
  395. - n/a
  396. - A struct :c:type:`v4l2_rect`, containing a rectangle described by
  397. the position of its top-left corner, the width and the height. Units
  398. depend on the use case. Support for ``V4L2_CTRL_WHICH_MIN_VAL`` and
  399. ``V4L2_CTRL_WHICH_MAX_VAL`` is optional and depends on the
  400. ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`` flag. See the documentation of
  401. the specific control on how to interpret the minimum and maximum values.
  402. * - ``V4L2_CTRL_TYPE_H264_SPS``
  403. - n/a
  404. - n/a
  405. - n/a
  406. - A struct :c:type:`v4l2_ctrl_h264_sps`, containing H264
  407. sequence parameters for stateless video decoders.
  408. * - ``V4L2_CTRL_TYPE_H264_PPS``
  409. - n/a
  410. - n/a
  411. - n/a
  412. - A struct :c:type:`v4l2_ctrl_h264_pps`, containing H264
  413. picture parameters for stateless video decoders.
  414. * - ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``
  415. - n/a
  416. - n/a
  417. - n/a
  418. - A struct :c:type:`v4l2_ctrl_h264_scaling_matrix`, containing H264
  419. scaling matrices for stateless video decoders.
  420. * - ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``
  421. - n/a
  422. - n/a
  423. - n/a
  424. - A struct :c:type:`v4l2_ctrl_h264_slice_params`, containing H264
  425. slice parameters for stateless video decoders.
  426. * - ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``
  427. - n/a
  428. - n/a
  429. - n/a
  430. - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
  431. decode parameters for stateless video decoders.
  432. * - ``V4L2_CTRL_TYPE_FWHT_PARAMS``
  433. - n/a
  434. - n/a
  435. - n/a
  436. - A struct :c:type:`v4l2_ctrl_fwht_params`, containing FWHT
  437. parameters for stateless video decoders.
  438. * - ``V4L2_CTRL_TYPE_HEVC_SPS``
  439. - n/a
  440. - n/a
  441. - n/a
  442. - A struct :c:type:`v4l2_ctrl_hevc_sps`, containing HEVC Sequence
  443. Parameter Set for stateless video decoders.
  444. * - ``V4L2_CTRL_TYPE_HEVC_PPS``
  445. - n/a
  446. - n/a
  447. - n/a
  448. - A struct :c:type:`v4l2_ctrl_hevc_pps`, containing HEVC Picture
  449. Parameter Set for stateless video decoders.
  450. * - ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``
  451. - n/a
  452. - n/a
  453. - n/a
  454. - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC
  455. slice parameters for stateless video decoders.
  456. * - ``V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``
  457. - n/a
  458. - n/a
  459. - n/a
  460. - A struct :c:type:`v4l2_ctrl_hevc_scaling_matrix`, containing HEVC
  461. scaling matrix for stateless video decoders.
  462. * - ``V4L2_CTRL_TYPE_VP8_FRAME``
  463. - n/a
  464. - n/a
  465. - n/a
  466. - A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8
  467. frame parameters for stateless video decoders.
  468. * - ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``
  469. - n/a
  470. - n/a
  471. - n/a
  472. - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC
  473. decoding parameters for stateless video decoders.
  474. * - ``V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS``
  475. - n/a
  476. - n/a
  477. - n/a
  478. - A struct :c:type:`v4l2_ctrl_hevc_ext_sps_lt_rps`, containing HEVC
  479. extended Long-Term RPS for stateless video decoders.
  480. * - ``V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS``
  481. - n/a
  482. - n/a
  483. - n/a
  484. - A struct :c:type:`v4l2_ctrl_hevc_ext_sps_st_rps`, containing HEVC
  485. extended Short-Term RPS for stateless video decoders.
  486. * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``
  487. - n/a
  488. - n/a
  489. - n/a
  490. - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`, containing VP9
  491. probabilities updates for stateless video decoders.
  492. * - ``V4L2_CTRL_TYPE_VP9_FRAME``
  493. - n/a
  494. - n/a
  495. - n/a
  496. - A struct :c:type:`v4l2_ctrl_vp9_frame`, containing VP9
  497. frame decode parameters for stateless video decoders.
  498. * - ``V4L2_CTRL_TYPE_AV1_SEQUENCE``
  499. - n/a
  500. - n/a
  501. - n/a
  502. - A struct :c:type:`v4l2_ctrl_av1_sequence`, containing AV1 Sequence OBU
  503. decoding parameters for stateless video decoders.
  504. * - ``V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``
  505. - n/a
  506. - n/a
  507. - n/a
  508. - A struct :c:type:`v4l2_ctrl_av1_tile_group_entry`, containing AV1 Tile Group
  509. OBU decoding parameters for stateless video decoders.
  510. * - ``V4L2_CTRL_TYPE_AV1_FRAME``
  511. - n/a
  512. - n/a
  513. - n/a
  514. - A struct :c:type:`v4l2_ctrl_av1_frame`, containing AV1 Frame/Frame
  515. Header OBU decoding parameters for stateless video decoders.
  516. * - ``V4L2_CTRL_TYPE_AV1_FILM_GRAIN``
  517. - n/a
  518. - n/a
  519. - n/a
  520. - A struct :c:type:`v4l2_ctrl_av1_film_grain`, containing AV1 Film Grain
  521. parameters for stateless video decoders.
  522. .. raw:: latex
  523. \normalsize
  524. .. tabularcolumns:: |p{7.3cm}|p{1.8cm}|p{8.2cm}|
  525. .. cssclass:: longtable
  526. .. _control-flags:
  527. .. flat-table:: Control Flags
  528. :header-rows: 0
  529. :stub-columns: 0
  530. :widths: 3 1 4
  531. * - ``V4L2_CTRL_FLAG_DISABLED``
  532. - 0x0001
  533. - This control is permanently disabled and should be ignored by the
  534. application. Any attempt to change the control will result in an
  535. ``EINVAL`` error code.
  536. * - ``V4L2_CTRL_FLAG_GRABBED``
  537. - 0x0002
  538. - This control is temporarily unchangeable, for example because
  539. another application took over control of the respective resource.
  540. Such controls may be displayed specially in a user interface.
  541. Attempts to change the control may result in an ``EBUSY`` error code.
  542. * - ``V4L2_CTRL_FLAG_READ_ONLY``
  543. - 0x0004
  544. - This control is permanently readable only. Any attempt to change
  545. the control will result in an ``EINVAL`` error code.
  546. * - ``V4L2_CTRL_FLAG_UPDATE``
  547. - 0x0008
  548. - A hint that changing this control may affect the value of other
  549. controls within the same control class. Applications should update
  550. their user interface accordingly.
  551. * - ``V4L2_CTRL_FLAG_INACTIVE``
  552. - 0x0010
  553. - This control is not applicable to the current configuration and
  554. should be displayed accordingly in a user interface. For example
  555. the flag may be set on a MPEG audio level 2 bitrate control when
  556. MPEG audio encoding level 1 was selected with another control.
  557. * - ``V4L2_CTRL_FLAG_SLIDER``
  558. - 0x0020
  559. - A hint that this control is best represented as a slider-like
  560. element in a user interface.
  561. * - ``V4L2_CTRL_FLAG_WRITE_ONLY``
  562. - 0x0040
  563. - This control is permanently writable only. Any attempt to read the
  564. control will result in an ``EACCES`` error code error code. This flag
  565. is typically present for relative controls or action controls
  566. where writing a value will cause the device to carry out a given
  567. action (e. g. motor control) but no meaningful value can be
  568. returned.
  569. * - ``V4L2_CTRL_FLAG_VOLATILE``
  570. - 0x0080
  571. - This control is volatile, which means that the value of the
  572. control changes continuously. A typical example would be the
  573. current gain value if the device is in auto-gain mode. In such a
  574. case the hardware calculates the gain value based on the lighting
  575. conditions which can change over time.
  576. .. note::
  577. Setting a new value for a volatile control will be ignored
  578. unless
  579. :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE <FLAG_EXECUTE_ON_WRITE>`
  580. is also set.
  581. Setting a new value for a volatile control will *never* trigger a
  582. :ref:`V4L2_EVENT_CTRL_CH_VALUE <ctrl-changes-flags>` event.
  583. * - ``V4L2_CTRL_FLAG_HAS_PAYLOAD``
  584. - 0x0100
  585. - This control has a pointer type, so its value has to be accessed
  586. using one of the pointer fields of struct
  587. :c:type:`v4l2_ext_control`. This flag is set
  588. for controls that are an array, string, or have a compound type.
  589. In all cases you have to set a pointer to memory containing the
  590. payload of the control.
  591. * .. _FLAG_EXECUTE_ON_WRITE:
  592. - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE``
  593. - 0x0200
  594. - The value provided to the control will be propagated to the driver
  595. even if it remains constant. This is required when the control
  596. represents an action on the hardware. For example: clearing an
  597. error flag or triggering the flash. All the controls of the type
  598. ``V4L2_CTRL_TYPE_BUTTON`` have this flag set.
  599. * .. _FLAG_MODIFY_LAYOUT:
  600. - ``V4L2_CTRL_FLAG_MODIFY_LAYOUT``
  601. - 0x0400
  602. - Changing this control value may modify the layout of the
  603. buffer (for video devices) or the media bus format (for sub-devices).
  604. A typical example would be the ``V4L2_CID_ROTATE`` control.
  605. Note that typically controls with this flag will also set the
  606. ``V4L2_CTRL_FLAG_GRABBED`` flag when buffers are allocated or
  607. streaming is in progress since most drivers do not support changing
  608. the format in that case.
  609. * - ``V4L2_CTRL_FLAG_DYNAMIC_ARRAY``
  610. - 0x0800
  611. - This control is a dynamically sized 1-dimensional array. It
  612. behaves the same as a regular array, except that the number
  613. of elements as reported by the ``elems`` field is between 1 and
  614. ``dims[0]``. So setting the control with a differently sized
  615. array will change the ``elems`` field when the control is
  616. queried afterwards.
  617. * - ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX``
  618. - 0x1000
  619. - This control supports getting minimum and maximum values using
  620. vidioc_g_ext_ctrls with V4L2_CTRL_WHICH_MIN/MAX_VAL.
  621. Return Value
  622. ============
  623. On success 0 is returned, on error -1 and the ``errno`` variable is set
  624. appropriately. The generic error codes are described at the
  625. :ref:`Generic Error Codes <gen-errors>` chapter.
  626. EINVAL
  627. The struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id`` is
  628. invalid. The struct :ref:`v4l2_querymenu <v4l2-querymenu>` ``id``
  629. is invalid or ``index`` is out of range (less than ``minimum`` or
  630. greater than ``maximum``) or this particular menu item is not
  631. supported by the driver.
  632. EACCES
  633. An attempt was made to read a write-only control.
  634. .. [#f1]
  635. ``V4L2_CTRL_FLAG_DISABLED`` was intended for two purposes: Drivers
  636. can skip predefined controls not supported by the hardware (although
  637. returning ``EINVAL`` would do as well), or disable predefined and private
  638. controls after hardware detection without the trouble of reordering
  639. control arrays and indices (``EINVAL`` cannot be used to skip private
  640. controls because it would prematurely end the enumeration).