vidioc-subscribe-event.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <refentry id="vidioc-subscribe-event">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refname>
  8. <refpurpose>Subscribe or unsubscribe event</refpurpose>
  9. </refnamediv>
  10. <refsynopsisdiv>
  11. <funcsynopsis>
  12. <funcprototype>
  13. <funcdef>int <function>ioctl</function></funcdef>
  14. <paramdef>int <parameter>fd</parameter></paramdef>
  15. <paramdef>int <parameter>request</parameter></paramdef>
  16. <paramdef>struct v4l2_event_subscription
  17. *<parameter>argp</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. </refsynopsisdiv>
  21. <refsect1>
  22. <title>Arguments</title>
  23. <variablelist>
  24. <varlistentry>
  25. <term><parameter>fd</parameter></term>
  26. <listitem>
  27. <para>&fd;</para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term><parameter>request</parameter></term>
  32. <listitem>
  33. <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para>
  34. </listitem>
  35. </varlistentry>
  36. <varlistentry>
  37. <term><parameter>argp</parameter></term>
  38. <listitem>
  39. <para></para>
  40. </listitem>
  41. </varlistentry>
  42. </variablelist>
  43. </refsect1>
  44. <refsect1>
  45. <title>Description</title>
  46. <para>Subscribe or unsubscribe V4L2 event. Subscribed events are
  47. dequeued by using the &VIDIOC-DQEVENT; ioctl.</para>
  48. <table frame="none" pgwide="1" id="v4l2-event-subscription">
  49. <title>struct <structname>v4l2_event_subscription</structname></title>
  50. <tgroup cols="3">
  51. &cs-str;
  52. <tbody valign="top">
  53. <row>
  54. <entry>__u32</entry>
  55. <entry><structfield>type</structfield></entry>
  56. <entry>Type of the event.</entry>
  57. </row>
  58. <row>
  59. <entry>__u32</entry>
  60. <entry><structfield>id</structfield></entry>
  61. <entry>ID of the event source. If there is no ID associated with
  62. the event source, then set this to 0. Whether or not an event
  63. needs an ID depends on the event type.</entry>
  64. </row>
  65. <row>
  66. <entry>__u32</entry>
  67. <entry><structfield>flags</structfield></entry>
  68. <entry>Event flags, see <xref linkend="event-flags" />.</entry>
  69. </row>
  70. <row>
  71. <entry>__u32</entry>
  72. <entry><structfield>reserved</structfield>[5]</entry>
  73. <entry>Reserved for future extensions. Drivers and applications
  74. must set the array to zero.</entry>
  75. </row>
  76. </tbody>
  77. </tgroup>
  78. </table>
  79. <table frame="none" pgwide="1" id="event-type">
  80. <title>Event Types</title>
  81. <tgroup cols="3">
  82. &cs-def;
  83. <tbody valign="top">
  84. <row>
  85. <entry><constant>V4L2_EVENT_ALL</constant></entry>
  86. <entry>0</entry>
  87. <entry>All events. V4L2_EVENT_ALL is valid only for
  88. VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once.
  89. </entry>
  90. </row>
  91. <row>
  92. <entry><constant>V4L2_EVENT_VSYNC</constant></entry>
  93. <entry>1</entry>
  94. <entry>This event is triggered on the vertical sync.
  95. This event has a &v4l2-event-vsync; associated with it.
  96. </entry>
  97. </row>
  98. <row>
  99. <entry><constant>V4L2_EVENT_EOS</constant></entry>
  100. <entry>2</entry>
  101. <entry>This event is triggered when the end of a stream is reached.
  102. This is typically used with MPEG decoders to report to the application
  103. when the last of the MPEG stream has been decoded.
  104. </entry>
  105. </row>
  106. <row>
  107. <entry><constant>V4L2_EVENT_CTRL</constant></entry>
  108. <entry>3</entry>
  109. <entry><para>This event requires that the <structfield>id</structfield>
  110. matches the control ID from which you want to receive events.
  111. This event is triggered if the control's value changes, if a
  112. button control is pressed or if the control's flags change.
  113. This event has a &v4l2-event-ctrl; associated with it. This struct
  114. contains much of the same information as &v4l2-queryctrl; and
  115. &v4l2-control;.</para>
  116. <para>If the event is generated due to a call to &VIDIOC-S-CTRL; or
  117. &VIDIOC-S-EXT-CTRLS;, then the event will <emphasis>not</emphasis> be sent to
  118. the file handle that called the ioctl function. This prevents
  119. nasty feedback loops. If you <emphasis>do</emphasis> want to get the
  120. event, then set the <constant>V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK</constant>
  121. flag.
  122. </para>
  123. <para>This event type will ensure that no information is lost when
  124. more events are raised than there is room internally. In that
  125. case the &v4l2-event-ctrl; of the second-oldest event is kept,
  126. but the <structfield>changes</structfield> field of the
  127. second-oldest event is ORed with the <structfield>changes</structfield>
  128. field of the oldest event.</para>
  129. </entry>
  130. </row>
  131. <row>
  132. <entry><constant>V4L2_EVENT_FRAME_SYNC</constant></entry>
  133. <entry>4</entry>
  134. <entry>
  135. <para>Triggered immediately when the reception of a
  136. frame has begun. This event has a
  137. &v4l2-event-frame-sync; associated with it.</para>
  138. <para>If the hardware needs to be stopped in the case of a
  139. buffer underrun it might not be able to generate this event.
  140. In such cases the <structfield>frame_sequence</structfield>
  141. field in &v4l2-event-frame-sync; will not be incremented. This
  142. causes two consecutive frame sequence numbers to have n times
  143. frame interval in between them.</para>
  144. </entry>
  145. </row>
  146. <row>
  147. <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>
  148. <entry>0x08000000</entry>
  149. <entry>Base event number for driver-private events.</entry>
  150. </row>
  151. </tbody>
  152. </tgroup>
  153. </table>
  154. <table pgwide="1" frame="none" id="event-flags">
  155. <title>Event Flags</title>
  156. <tgroup cols="3">
  157. &cs-def;
  158. <tbody valign="top">
  159. <row>
  160. <entry><constant>V4L2_EVENT_SUB_FL_SEND_INITIAL</constant></entry>
  161. <entry>0x0001</entry>
  162. <entry>When this event is subscribed an initial event will be sent
  163. containing the current status. This only makes sense for events
  164. that are triggered by a status change such as <constant>V4L2_EVENT_CTRL</constant>.
  165. Other events will ignore this flag.</entry>
  166. </row>
  167. <row>
  168. <entry><constant>V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK</constant></entry>
  169. <entry>0x0002</entry>
  170. <entry><para>If set, then events directly caused by an ioctl will also be sent to
  171. the filehandle that called that ioctl. For example, changing a control using
  172. &VIDIOC-S-CTRL; will cause a V4L2_EVENT_CTRL to be sent back to that same
  173. filehandle. Normally such events are suppressed to prevent feedback loops
  174. where an application changes a control to a one value and then another, and
  175. then receives an event telling it that that control has changed to the first
  176. value.</para>
  177. <para>Since it can't tell whether that event was caused by another application
  178. or by the &VIDIOC-S-CTRL; call it is hard to decide whether to set the
  179. control to the value in the event, or ignore it.</para>
  180. <para>Think carefully when you set this flag so you won't get into situations
  181. like that.</para>
  182. </entry>
  183. </row>
  184. </tbody>
  185. </tgroup>
  186. </table>
  187. </refsect1>
  188. <refsect1>
  189. &return-value;
  190. </refsect1>
  191. </refentry>