2020-08-26 15:03:09 +08:00
|
|
|
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
|
2018-08-30 22:15:26 +08:00
|
|
|
|
2016-06-30 21:18:56 +08:00
|
|
|
.. _app-pri:
|
|
|
|
|
|
|
|
********************
|
|
|
|
Application Priority
|
|
|
|
********************
|
|
|
|
|
|
|
|
When multiple applications share a device it may be desirable to assign
|
|
|
|
them different priorities. Contrary to the traditional "rm -rf /" school
|
2018-10-26 20:18:33 +08:00
|
|
|
of thought, a video recording application could for example block other
|
2016-06-30 21:18:56 +08:00
|
|
|
applications from changing video controls or switching the current TV
|
|
|
|
channel. Another objective is to permit low priority applications
|
|
|
|
working in background, which can be preempted by user controlled
|
|
|
|
applications and automatically regain control of the device at a later
|
|
|
|
time.
|
|
|
|
|
|
|
|
Since these features cannot be implemented entirely in user space V4L2
|
2016-07-03 21:02:29 +08:00
|
|
|
defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
|
2016-07-02 00:42:29 +08:00
|
|
|
:ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
|
2016-06-30 21:18:56 +08:00
|
|
|
query the access priority associate with a file descriptor. Opening a
|
|
|
|
device assigns a medium priority, compatible with earlier versions of
|
|
|
|
V4L2 and drivers not supporting these ioctls. Applications requiring a
|
2016-07-01 08:58:44 +08:00
|
|
|
different priority will usually call :ref:`VIDIOC_S_PRIORITY
|
2016-07-02 00:42:29 +08:00
|
|
|
<VIDIOC_G_PRIORITY>` after verifying the device with the
|
2016-07-02 00:58:44 +08:00
|
|
|
:ref:`VIDIOC_QUERYCAP` ioctl.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
Ioctls changing driver properties, such as
|
2016-07-03 22:53:09 +08:00
|
|
|
:ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
|
2016-06-30 21:18:56 +08:00
|
|
|
after another application obtained higher priority.
|