GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / staging / media / av7110 / video-get-event.rst
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: DTV.video
3
4 .. _VIDEO_GET_EVENT:
5
6 ===============
7 VIDEO_GET_EVENT
8 ===============
9
10 Name
11 ----
12
13 VIDEO_GET_EVENT
14
15 .. attention:: This ioctl is deprecated.
16
17 Synopsis
18 --------
19
20 .. c:macro:: VIDEO_GET_EVENT
21
22 ``int ioctl(fd, VIDEO_GET_EVENT, struct video_event *ev)``
23
24 Arguments
25 ---------
26
27 .. flat-table::
28     :header-rows:  0
29     :stub-columns: 0
30
31     -  .. row 1
32
33        -  int fd
34
35        -  File descriptor returned by a previous call to open().
36
37     -  .. row 2
38
39        -  int request
40
41        -  Equals VIDEO_GET_EVENT for this command.
42
43     -  .. row 3
44
45        -  struct video_event \*ev
46
47        -  Points to the location where the event, if any, is to be stored.
48
49 Description
50 -----------
51
52 This ioctl is for Digital TV devices only. To get events from a V4L2 decoder
53 use the V4L2 :ref:`VIDIOC_DQEVENT` ioctl instead.
54
55 This ioctl call returns an event of type video_event if available. If
56 an event is not available, the behavior depends on whether the device is
57 in blocking or non-blocking mode. In the latter case, the call fails
58 immediately with errno set to ``EWOULDBLOCK``. In the former case, the call
59 blocks until an event becomes available. The standard Linux poll()
60 and/or select() system calls can be used with the device file descriptor
61 to watch for new events. For select(), the file descriptor should be
62 included in the exceptfds argument, and for poll(), POLLPRI should be
63 specified as the wake-up condition. Read-only permissions are sufficient
64 for this ioctl call.
65
66 .. c:type:: video_event
67
68 .. code-block:: c
69
70         struct video_event {
71                 __s32 type;
72         #define VIDEO_EVENT_SIZE_CHANGED        1
73         #define VIDEO_EVENT_FRAME_RATE_CHANGED  2
74         #define VIDEO_EVENT_DECODER_STOPPED     3
75         #define VIDEO_EVENT_VSYNC               4
76                 long timestamp;
77                 union {
78                         video_size_t size;
79                         unsigned int frame_rate;        /* in frames per 1000sec */
80                         unsigned char vsync_field;      /* unknown/odd/even/progressive */
81                 } u;
82         };
83
84 Return Value
85 ------------
86
87 On success 0 is returned, on error -1 and the ``errno`` variable is set
88 appropriately. The generic error codes are described at the
89 :ref:`Generic Error Codes <gen-errors>` chapter.
90
91 .. flat-table::
92     :header-rows:  0
93     :stub-columns: 0
94
95     -  .. row 1
96
97        -  ``EWOULDBLOCK``
98
99        -  There is no event pending, and the device is in non-blocking mode.
100
101     -  .. row 2
102
103        -  ``EOVERFLOW``
104
105        -  Overflow in event queue - one or more events were lost.