About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / DocBook / media / v4l / vidioc-dqevent.xml


Based on kernel version 4.7.2. Page generated on 2016-08-22 22:45 EST.

1	<refentry id="vidioc-dqevent">
2	  <refmeta>
3	    <refentrytitle>ioctl VIDIOC_DQEVENT</refentrytitle>
4	    &manvol;
5	  </refmeta>
6	
7	  <refnamediv>
8	    <refname>VIDIOC_DQEVENT</refname>
9	    <refpurpose>Dequeue event</refpurpose>
10	  </refnamediv>
11	
12	  <refsynopsisdiv>
13	    <funcsynopsis>
14	      <funcprototype>
15		<funcdef>int <function>ioctl</function></funcdef>
16		<paramdef>int <parameter>fd</parameter></paramdef>
17		<paramdef>int <parameter>request</parameter></paramdef>
18		<paramdef>struct v4l2_event
19	*<parameter>argp</parameter></paramdef>
20	      </funcprototype>
21	    </funcsynopsis>
22	  </refsynopsisdiv>
23	
24	  <refsect1>
25	    <title>Arguments</title>
26	
27	    <variablelist>
28	      <varlistentry>
29		<term><parameter>fd</parameter></term>
30		<listitem>
31		  <para>&fd;</para>
32		</listitem>
33	      </varlistentry>
34	      <varlistentry>
35		<term><parameter>request</parameter></term>
36		<listitem>
37		  <para>VIDIOC_DQEVENT</para>
38		</listitem>
39	      </varlistentry>
40	      <varlistentry>
41		<term><parameter>argp</parameter></term>
42		<listitem>
43		  <para></para>
44		</listitem>
45	      </varlistentry>
46	    </variablelist>
47	  </refsect1>
48	
49	  <refsect1>
50	    <title>Description</title>
51	
52	    <para>Dequeue an event from a video device. No input is required
53	    for this ioctl. All the fields of the &v4l2-event; structure are
54	    filled by the driver. The file handle will also receive exceptions
55	    which the application may get by e.g. using the select system
56	    call.</para>
57	
58	    <table frame="none" pgwide="1" id="v4l2-event">
59	      <title>struct <structname>v4l2_event</structname></title>
60	      <tgroup cols="4">
61		&cs-str;
62		<tbody valign="top">
63		  <row>
64		    <entry>__u32</entry>
65		    <entry><structfield>type</structfield></entry>
66	            <entry></entry>
67		    <entry>Type of the event, see <xref linkend="event-type" />.</entry>
68		  </row>
69		  <row>
70		    <entry>union</entry>
71		    <entry><structfield>u</structfield></entry>
72	            <entry></entry>
73		    <entry></entry>
74		  </row>
75		  <row>
76		    <entry></entry>
77		    <entry>&v4l2-event-vsync;</entry>
78	            <entry><structfield>vsync</structfield></entry>
79		    <entry>Event data for event <constant>V4L2_EVENT_VSYNC</constant>.
80	            </entry>
81		  </row>
82		  <row>
83		    <entry></entry>
84		    <entry>&v4l2-event-ctrl;</entry>
85	            <entry><structfield>ctrl</structfield></entry>
86		    <entry>Event data for event <constant>V4L2_EVENT_CTRL</constant>.
87	            </entry>
88		  </row>
89		  <row>
90		    <entry></entry>
91		    <entry>&v4l2-event-frame-sync;</entry>
92	            <entry><structfield>frame_sync</structfield></entry>
93		    <entry>Event data for event
94		    <constant>V4L2_EVENT_FRAME_SYNC</constant>.</entry>
95		  </row>
96		  <row>
97		    <entry></entry>
98		    <entry>&v4l2-event-motion-det;</entry>
99	            <entry><structfield>motion_det</structfield></entry>
100		    <entry>Event data for event V4L2_EVENT_MOTION_DET.</entry>
101		  </row>
102		  <row>
103		    <entry></entry>
104		    <entry>&v4l2-event-src-change;</entry>
105	            <entry><structfield>src_change</structfield></entry>
106		    <entry>Event data for event V4L2_EVENT_SOURCE_CHANGE.</entry>
107		  </row>
108		  <row>
109		    <entry></entry>
110		    <entry>__u8</entry>
111	            <entry><structfield>data</structfield>[64]</entry>
112		    <entry>Event data. Defined by the event type. The union
113	            should be used to define easily accessible type for
114	            events.</entry>
115		  </row>
116		  <row>
117		    <entry>__u32</entry>
118		    <entry><structfield>pending</structfield></entry>
119	            <entry></entry>
120		    <entry>Number of pending events excluding this one.</entry>
121		  </row>
122		  <row>
123		    <entry>__u32</entry>
124		    <entry><structfield>sequence</structfield></entry>
125	            <entry></entry>
126		    <entry>Event sequence number. The sequence number is
127		    incremented for every subscribed event that takes place.
128		    If sequence numbers are not contiguous it means that
129		    events have been lost.
130		    </entry>
131		  </row>
132		  <row>
133		    <entry>struct timespec</entry>
134		    <entry><structfield>timestamp</structfield></entry>
135	            <entry></entry>
136		    <entry>Event timestamp. The timestamp has been taken from the
137		    <constant>CLOCK_MONOTONIC</constant> clock. To access the
138		    same clock outside V4L2, use <function>clock_gettime(2)</function>.
139		    </entry>
140		  </row>
141		  <row>
142		    <entry>u32</entry>
143		    <entry><structfield>id</structfield></entry>
144	            <entry></entry>
145		    <entry>The ID associated with the event source. If the event does not
146			have an associated ID (this depends on the event type), then this
147			is 0.</entry>
148		  </row>
149		  <row>
150		    <entry>__u32</entry>
151		    <entry><structfield>reserved</structfield>[8]</entry>
152	            <entry></entry>
153		    <entry>Reserved for future extensions. Drivers must set
154		    the array to zero.</entry>
155		  </row>
156		</tbody>
157	      </tgroup>
158	    </table>
159	
160	    <table frame="none" pgwide="1" id="event-type">
161	      <title>Event Types</title>
162	      <tgroup cols="3">
163		&cs-def;
164		<tbody valign="top">
165		  <row>
166		    <entry><constant>V4L2_EVENT_ALL</constant></entry>
167		    <entry>0</entry>
168		    <entry>All events. V4L2_EVENT_ALL is valid only for
169		    VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once.
170		    </entry>
171		  </row>
172		  <row>
173		    <entry><constant>V4L2_EVENT_VSYNC</constant></entry>
174		    <entry>1</entry>
175		    <entry>This event is triggered on the vertical sync.
176		    This event has a &v4l2-event-vsync; associated with it.
177		    </entry>
178		  </row>
179		  <row>
180		    <entry><constant>V4L2_EVENT_EOS</constant></entry>
181		    <entry>2</entry>
182		    <entry>This event is triggered when the end of a stream is reached.
183		    This is typically used with MPEG decoders to report to the application
184		    when the last of the MPEG stream has been decoded.
185		    </entry>
186		  </row>
187		  <row>
188		    <entry><constant>V4L2_EVENT_CTRL</constant></entry>
189		    <entry>3</entry>
190		    <entry><para>This event requires that the <structfield>id</structfield>
191			matches the control ID from which you want to receive events.
192			This event is triggered if the control's value changes, if a
193			button control is pressed or if the control's flags change.
194		    	This event has a &v4l2-event-ctrl; associated with it. This struct
195			contains much of the same information as &v4l2-queryctrl; and
196			&v4l2-control;.</para>
197	
198			<para>If the event is generated due to a call to &VIDIOC-S-CTRL; or
199			&VIDIOC-S-EXT-CTRLS;, then the event will <emphasis>not</emphasis> be sent to
200			the file handle that called the ioctl function. This prevents
201			nasty feedback loops. If you <emphasis>do</emphasis> want to get the
202			event, then set the <constant>V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK</constant>
203			flag.
204			</para>
205	
206			<para>This event type will ensure that no information is lost when
207			more events are raised than there is room internally. In that
208			case the &v4l2-event-ctrl; of the second-oldest event is kept,
209			but the <structfield>changes</structfield> field of the
210			second-oldest event is ORed with the <structfield>changes</structfield>
211			field of the oldest event.</para>
212		    </entry>
213		  </row>
214		  <row>
215		    <entry><constant>V4L2_EVENT_FRAME_SYNC</constant></entry>
216		    <entry>4</entry>
217		    <entry>
218		      <para>Triggered immediately when the reception of a
219		      frame has begun. This event has a
220		      &v4l2-event-frame-sync; associated with it.</para>
221	
222		      <para>If the hardware needs to be stopped in the case of a
223		      buffer underrun it might not be able to generate this event.
224		      In such cases the <structfield>frame_sequence</structfield>
225		      field in &v4l2-event-frame-sync; will not be incremented. This
226		      causes two consecutive frame sequence numbers to have n times
227		      frame interval in between them.</para>
228		    </entry>
229		  </row>
230		  <row>
231		    <entry><constant>V4L2_EVENT_SOURCE_CHANGE</constant></entry>
232		    <entry>5</entry>
233		    <entry>
234		      <para>This event is triggered when a source parameter change is
235		       detected during runtime by the video device. It can be a
236		       runtime resolution change triggered by a video decoder or the
237		       format change happening on an input connector.
238		       This event requires that the <structfield>id</structfield>
239		       matches the input index (when used with a video device node)
240		       or the pad index (when used with a subdevice node) from which
241		       you want to receive events.</para>
242	
243	              <para>This event has a &v4l2-event-src-change; associated
244		      with it. The <structfield>changes</structfield> bitfield denotes
245		      what has changed for the subscribed pad. If multiple events
246		      occurred before application could dequeue them, then the changes
247		      will have the ORed value of all the events generated.</para>
248		    </entry>
249		  </row>
250		  <row>
251		    <entry><constant>V4L2_EVENT_MOTION_DET</constant></entry>
252		    <entry>6</entry>
253		    <entry>
254		      <para>Triggered whenever the motion detection state for one or more of the regions
255		      changes. This event has a &v4l2-event-motion-det; associated with it.</para>
256		    </entry>
257		  </row>
258		  <row>
259		    <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>
260		    <entry>0x08000000</entry>
261		    <entry>Base event number for driver-private events.</entry>
262		  </row>
263		</tbody>
264	      </tgroup>
265	    </table>
266	
267	    <table frame="none" pgwide="1" id="v4l2-event-vsync">
268	      <title>struct <structname>v4l2_event_vsync</structname></title>
269	      <tgroup cols="3">
270		&cs-str;
271		<tbody valign="top">
272		  <row>
273		    <entry>__u8</entry>
274		    <entry><structfield>field</structfield></entry>
275		    <entry>The upcoming field. See &v4l2-field;.</entry>
276		  </row>
277		</tbody>
278	      </tgroup>
279	    </table>
280	
281	    <table frame="none" pgwide="1" id="v4l2-event-ctrl">
282	      <title>struct <structname>v4l2_event_ctrl</structname></title>
283	      <tgroup cols="4">
284		&cs-str;
285		<tbody valign="top">
286		  <row>
287		    <entry>__u32</entry>
288		    <entry><structfield>changes</structfield></entry>
289		    <entry></entry>
290		    <entry>A bitmask that tells what has changed. See <xref linkend="ctrl-changes-flags" />.</entry>
291		  </row>
292		  <row>
293		    <entry>__u32</entry>
294		    <entry><structfield>type</structfield></entry>
295		    <entry></entry>
296		    <entry>The type of the control. See &v4l2-ctrl-type;.</entry>
297		  </row>
298		  <row>
299		    <entry>union (anonymous)</entry>
300		    <entry></entry>
301		    <entry></entry>
302		    <entry></entry>
303		  </row>
304		  <row>
305		    <entry></entry>
306		    <entry>__s32</entry>
307		    <entry><structfield>value</structfield></entry>
308		    <entry>The 32-bit value of the control for 32-bit control types.
309			This is 0 for string controls since the value of a string
310			cannot be passed using &VIDIOC-DQEVENT;.</entry>
311		  </row>
312		  <row>
313		    <entry></entry>
314		    <entry>__s64</entry>
315		    <entry><structfield>value64</structfield></entry>
316		    <entry>The 64-bit value of the control for 64-bit control types.</entry>
317		  </row>
318		  <row>
319		    <entry>__u32</entry>
320		    <entry><structfield>flags</structfield></entry>
321		    <entry></entry>
322		    <entry>The control flags. See <xref linkend="control-flags" />.</entry>
323		  </row>
324		  <row>
325		    <entry>__s32</entry>
326		    <entry><structfield>minimum</structfield></entry>
327		    <entry></entry>
328		    <entry>The minimum value of the control. See &v4l2-queryctrl;.</entry>
329		  </row>
330		  <row>
331		    <entry>__s32</entry>
332		    <entry><structfield>maximum</structfield></entry>
333		    <entry></entry>
334		    <entry>The maximum value of the control. See &v4l2-queryctrl;.</entry>
335		  </row>
336		  <row>
337		    <entry>__s32</entry>
338		    <entry><structfield>step</structfield></entry>
339		    <entry></entry>
340		    <entry>The step value of the control. See &v4l2-queryctrl;.</entry>
341		  </row>
342		  <row>
343		    <entry>__s32</entry>
344		    <entry><structfield>default_value</structfield></entry>
345		    <entry></entry>
346		    <entry>The default value value of the control. See &v4l2-queryctrl;.</entry>
347		  </row>
348		</tbody>
349	      </tgroup>
350	    </table>
351	
352	    <table frame="none" pgwide="1" id="v4l2-event-frame-sync">
353	      <title>struct <structname>v4l2_event_frame_sync</structname></title>
354	      <tgroup cols="3">
355		&cs-str;
356		<tbody valign="top">
357		  <row>
358		    <entry>__u32</entry>
359		    <entry><structfield>frame_sequence</structfield></entry>
360		    <entry>
361		      The sequence number of the frame being received.
362		    </entry>
363		  </row>
364		</tbody>
365	      </tgroup>
366	    </table>
367	
368	    <table frame="none" pgwide="1" id="v4l2-event-src-change">
369	      <title>struct <structname>v4l2_event_src_change</structname></title>
370	      <tgroup cols="3">
371		&cs-str;
372		<tbody valign="top">
373		  <row>
374		    <entry>__u32</entry>
375		    <entry><structfield>changes</structfield></entry>
376		    <entry>
377		      A bitmask that tells what has changed. See <xref linkend="src-changes-flags" />.
378		    </entry>
379		  </row>
380		</tbody>
381	      </tgroup>
382	    </table>
383	
384	    <table frame="none" pgwide="1" id="v4l2-event-motion-det">
385	      <title>struct <structname>v4l2_event_motion_det</structname></title>
386	      <tgroup cols="3">
387		&cs-str;
388		<tbody valign="top">
389		  <row>
390		    <entry>__u32</entry>
391		    <entry><structfield>flags</structfield></entry>
392		    <entry>
393		      Currently only one flag is available: if <constant>V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ</constant>
394		      is set, then the <structfield>frame_sequence</structfield> field is valid,
395		      otherwise that field should be ignored.
396		    </entry>
397		  </row>
398		  <row>
399		    <entry>__u32</entry>
400		    <entry><structfield>frame_sequence</structfield></entry>
401		    <entry>
402		      The sequence number of the frame being received. Only valid if the
403		      <constant>V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ</constant> flag was set.
404		    </entry>
405		  </row>
406		  <row>
407		    <entry>__u32</entry>
408		    <entry><structfield>region_mask</structfield></entry>
409		    <entry>
410		      The bitmask of the regions that reported motion. There is at least one
411		      region. If this field is 0, then no motion was detected at all.
412		      If there is no <constant>V4L2_CID_DETECT_MD_REGION_GRID</constant> control
413		      (see <xref linkend="detect-controls" />) to assign a different region
414		      to each cell in the motion detection grid, then that all cells
415		      are automatically assigned to the default region 0.
416		    </entry>
417		  </row>
418		</tbody>
419	      </tgroup>
420	    </table>
421	
422	    <table pgwide="1" frame="none" id="ctrl-changes-flags">
423	      <title>Control Changes</title>
424	      <tgroup cols="3">
425		&cs-def;
426		<tbody valign="top">
427		  <row>
428		    <entry><constant>V4L2_EVENT_CTRL_CH_VALUE</constant></entry>
429		    <entry>0x0001</entry>
430		    <entry>This control event was triggered because the value of the control
431			changed. Special cases: Volatile controls do no generate this event;
432			If a control has the <constant>V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</constant>
433			flag set, then this event is sent as well, regardless its value.</entry>
434		  </row>
435		  <row>
436		    <entry><constant>V4L2_EVENT_CTRL_CH_FLAGS</constant></entry>
437		    <entry>0x0002</entry>
438		    <entry>This control event was triggered because the control flags
439			changed.</entry>
440		  </row>
441		  <row>
442		    <entry><constant>V4L2_EVENT_CTRL_CH_RANGE</constant></entry>
443		    <entry>0x0004</entry>
444		    <entry>This control event was triggered because the minimum,
445		    maximum, step or the default value of the control changed.</entry>
446		  </row>
447		</tbody>
448	      </tgroup>
449	    </table>
450	
451	    <table pgwide="1" frame="none" id="src-changes-flags">
452	      <title>Source Changes</title>
453	      <tgroup cols="3">
454		&cs-def;
455		<tbody valign="top">
456		  <row>
457		    <entry><constant>V4L2_EVENT_SRC_CH_RESOLUTION</constant></entry>
458		    <entry>0x0001</entry>
459		    <entry>This event gets triggered when a resolution change is
460		    detected at an input. This can come from an input connector or
461		    from a video decoder.
462		    </entry>
463		  </row>
464		</tbody>
465	      </tgroup>
466	    </table>
467	  </refsect1>
468	  <refsect1>
469	    &return-value;
470	  </refsect1>
471	</refentry>
Hide Line Numbers


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog