xref: /linux/Documentation/userspace-api/media/v4l/app-pri.rst (revision 778b8ebe5192e7a7f00563a7456517dfa63e1d90)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2.. c:namespace:: V4L
3
4.. _app-pri:
5
6********************
7Application Priority
8********************
9
10When multiple applications share a device it may be desirable to assign
11them different priorities. Contrary to the traditional "rm -rf /" school
12of thought, a video recording application could for example block other
13applications from changing video controls or switching the current TV
14channel. Another objective is to permit low priority applications
15working in background, which can be preempted by user controlled
16applications and automatically regain control of the device at a later
17time.
18
19Since these features cannot be implemented entirely in user space V4L2
20defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
21:ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
22query the access priority associate with a file descriptor. Opening a
23device assigns a medium priority, compatible with earlier versions of
24V4L2 and drivers not supporting these ioctls. Applications requiring a
25different priority will usually call :ref:`VIDIOC_S_PRIORITY
26<VIDIOC_G_PRIORITY>` after verifying the device with the
27:ref:`VIDIOC_QUERYCAP` ioctl.
28
29Ioctls changing driver properties, such as
30:ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
31after another application obtained higher priority.
32