io.xml 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. <title>Input/Output</title>
  2. <para>The V4L2 API defines several different methods to read from or
  3. write to a device. All drivers exchanging data with applications must
  4. support at least one of them.</para>
  5. <para>The classic I/O method using the <function>read()</function>
  6. and <function>write()</function> function is automatically selected
  7. after opening a V4L2 device. When the driver does not support this
  8. method attempts to read or write will fail at any time.</para>
  9. <para>Other methods must be negotiated. To select the streaming I/O
  10. method with memory mapped or user buffers applications call the
  11. &VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined
  12. yet.</para>
  13. <para>Video overlay can be considered another I/O method, although
  14. the application does not directly receive the image data. It is
  15. selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl.
  16. For more information see <xref linkend="overlay" />.</para>
  17. <para>Generally exactly one I/O method, including overlay, is
  18. associated with each file descriptor. The only exceptions are
  19. applications not exchanging data with a driver ("panel applications",
  20. see <xref linkend="open" />) and drivers permitting simultaneous video capturing
  21. and overlay using the same file descriptor, for compatibility with V4L
  22. and earlier versions of V4L2.</para>
  23. <para><constant>VIDIOC_S_FMT</constant> and
  24. <constant>VIDIOC_REQBUFS</constant> would permit this to some degree,
  25. but for simplicity drivers need not support switching the I/O method
  26. (after first switching away from read/write) other than by closing
  27. and reopening the device.</para>
  28. <para>The following sections describe the various I/O methods in
  29. more detail.</para>
  30. <section id="rw">
  31. <title>Read/Write</title>
  32. <para>Input and output devices support the
  33. <function>read()</function> and <function>write()</function> function,
  34. respectively, when the <constant>V4L2_CAP_READWRITE</constant> flag in
  35. the <structfield>capabilities</structfield> field of &v4l2-capability;
  36. returned by the &VIDIOC-QUERYCAP; ioctl is set.</para>
  37. <para>Drivers may need the CPU to copy the data, but they may also
  38. support DMA to or from user memory, so this I/O method is not
  39. necessarily less efficient than other methods merely exchanging buffer
  40. pointers. It is considered inferior though because no meta-information
  41. like frame counters or timestamps are passed. This information is
  42. necessary to recognize frame dropping and to synchronize with other
  43. data streams. However this is also the simplest I/O method, requiring
  44. little or no setup to exchange data. It permits command line stunts
  45. like this (the <application>vidctrl</application> tool is
  46. fictitious):</para>
  47. <informalexample>
  48. <screen>
  49. &gt; vidctrl /dev/video --input=0 --format=YUYV --size=352x288
  50. &gt; dd if=/dev/video of=myimage.422 bs=202752 count=1
  51. </screen>
  52. </informalexample>
  53. <para>To read from the device applications use the
  54. &func-read; function, to write the &func-write; function.
  55. Drivers must implement one I/O method if they
  56. exchange data with applications, but it need not be this.<footnote>
  57. <para>It would be desirable if applications could depend on
  58. drivers supporting all I/O interfaces, but as much as the complex
  59. memory mapping I/O can be inadequate for some devices we have no
  60. reason to require this interface, which is most useful for simple
  61. applications capturing still images.</para>
  62. </footnote> When reading or writing is supported, the driver
  63. must also support the &func-select; and &func-poll;
  64. function.<footnote>
  65. <para>At the driver level <function>select()</function> and
  66. <function>poll()</function> are the same, and
  67. <function>select()</function> is too important to be optional.</para>
  68. </footnote></para>
  69. </section>
  70. <section id="mmap">
  71. <title>Streaming I/O (Memory Mapping)</title>
  72. <para>Input and output devices support this I/O method when the
  73. <constant>V4L2_CAP_STREAMING</constant> flag in the
  74. <structfield>capabilities</structfield> field of &v4l2-capability;
  75. returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two
  76. streaming methods, to determine if the memory mapping flavor is
  77. supported applications must call the &VIDIOC-REQBUFS; ioctl.</para>
  78. <para>Streaming is an I/O method where only pointers to buffers
  79. are exchanged between application and driver, the data itself is not
  80. copied. Memory mapping is primarily intended to map buffers in device
  81. memory into the application's address space. Device memory can be for
  82. example the video memory on a graphics card with a video capture
  83. add-on. However, being the most efficient I/O method available for a
  84. long time, many other drivers support streaming as well, allocating
  85. buffers in DMA-able main memory.</para>
  86. <para>A driver can support many sets of buffers. Each set is
  87. identified by a unique buffer type value. The sets are independent and
  88. each set can hold a different type of data. To access different sets
  89. at the same time different file descriptors must be used.<footnote>
  90. <para>One could use one file descriptor and set the buffer
  91. type field accordingly when calling &VIDIOC-QBUF; etc., but it makes
  92. the <function>select()</function> function ambiguous. We also like the
  93. clean approach of one file descriptor per logical stream. Video
  94. overlay for example is also a logical stream, although the CPU is not
  95. needed for continuous operation.</para>
  96. </footnote></para>
  97. <para>To allocate device buffers applications call the
  98. &VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer
  99. type, for example <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>.
  100. This ioctl can also be used to change the number of buffers or to free
  101. the allocated memory, provided none of the buffers are still
  102. mapped.</para>
  103. <para>Before applications can access the buffers they must map
  104. them into their address space with the &func-mmap; function. The
  105. location of the buffers in device memory can be determined with the
  106. &VIDIOC-QUERYBUF; ioctl. The <structfield>m.offset</structfield> and
  107. <structfield>length</structfield> returned in a &v4l2-buffer; are
  108. passed as sixth and second parameter to the
  109. <function>mmap()</function> function. The offset and length values
  110. must not be modified. Remember the buffers are allocated in physical
  111. memory, as opposed to virtual memory which can be swapped out to disk.
  112. Applications should free the buffers as soon as possible with the
  113. &func-munmap; function.</para>
  114. <example>
  115. <title>Mapping buffers</title>
  116. <programlisting>
  117. &v4l2-requestbuffers; reqbuf;
  118. struct {
  119. void *start;
  120. size_t length;
  121. } *buffers;
  122. unsigned int i;
  123. memset (&amp;reqbuf, 0, sizeof (reqbuf));
  124. reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  125. reqbuf.memory = V4L2_MEMORY_MMAP;
  126. reqbuf.count = 20;
  127. if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf)) {
  128. if (errno == EINVAL)
  129. printf ("Video capturing or mmap-streaming is not supported\n");
  130. else
  131. perror ("VIDIOC_REQBUFS");
  132. exit (EXIT_FAILURE);
  133. }
  134. /* We want at least five buffers. */
  135. if (reqbuf.count &lt; 5) {
  136. /* You may need to free the buffers here. */
  137. printf ("Not enough buffer memory\n");
  138. exit (EXIT_FAILURE);
  139. }
  140. buffers = calloc (reqbuf.count, sizeof (*buffers));
  141. assert (buffers != NULL);
  142. for (i = 0; i &lt; reqbuf.count; i++) {
  143. &v4l2-buffer; buffer;
  144. memset (&amp;buffer, 0, sizeof (buffer));
  145. buffer.type = reqbuf.type;
  146. buffer.memory = V4L2_MEMORY_MMAP;
  147. buffer.index = i;
  148. if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &amp;buffer)) {
  149. perror ("VIDIOC_QUERYBUF");
  150. exit (EXIT_FAILURE);
  151. }
  152. buffers[i].length = buffer.length; /* remember for munmap() */
  153. buffers[i].start = mmap (NULL, buffer.length,
  154. PROT_READ | PROT_WRITE, /* recommended */
  155. MAP_SHARED, /* recommended */
  156. fd, buffer.m.offset);
  157. if (MAP_FAILED == buffers[i].start) {
  158. /* If you do not exit here you should unmap() and free()
  159. the buffers mapped so far. */
  160. perror ("mmap");
  161. exit (EXIT_FAILURE);
  162. }
  163. }
  164. /* Cleanup. */
  165. for (i = 0; i &lt; reqbuf.count; i++)
  166. munmap (buffers[i].start, buffers[i].length);
  167. </programlisting>
  168. </example>
  169. <para>Conceptually streaming drivers maintain two buffer queues, an incoming
  170. and an outgoing queue. They separate the synchronous capture or output
  171. operation locked to a video clock from the application which is
  172. subject to random disk or network delays and preemption by
  173. other processes, thereby reducing the probability of data loss.
  174. The queues are organized as FIFOs, buffers will be
  175. output in the order enqueued in the incoming FIFO, and were
  176. captured in the order dequeued from the outgoing FIFO.</para>
  177. <para>The driver may require a minimum number of buffers enqueued
  178. at all times to function, apart of this no limit exists on the number
  179. of buffers applications can enqueue in advance, or dequeue and
  180. process. They can also enqueue in a different order than buffers have
  181. been dequeued, and the driver can <emphasis>fill</emphasis> enqueued
  182. <emphasis>empty</emphasis> buffers in any order. <footnote>
  183. <para>Random enqueue order permits applications processing
  184. images out of order (such as video codecs) to return buffers earlier,
  185. reducing the probability of data loss. Random fill order allows
  186. drivers to reuse buffers on a LIFO-basis, taking advantage of caches
  187. holding scatter-gather lists and the like.</para>
  188. </footnote> The index number of a buffer (&v4l2-buffer;
  189. <structfield>index</structfield>) plays no role here, it only
  190. identifies the buffer.</para>
  191. <para>Initially all mapped buffers are in dequeued state,
  192. inaccessible by the driver. For capturing applications it is customary
  193. to first enqueue all mapped buffers, then to start capturing and enter
  194. the read loop. Here the application waits until a filled buffer can be
  195. dequeued, and re-enqueues the buffer when the data is no longer
  196. needed. Output applications fill and enqueue buffers, when enough
  197. buffers are stacked up the output is started with
  198. <constant>VIDIOC_STREAMON</constant>. In the write loop, when
  199. the application runs out of free buffers, it must wait until an empty
  200. buffer can be dequeued and reused.</para>
  201. <para>To enqueue and dequeue a buffer applications use the
  202. &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being
  203. mapped, enqueued, full or empty can be determined at any time using the
  204. &VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the
  205. application until one or more buffers can be dequeued. By default
  206. <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
  207. outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
  208. given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
  209. returns immediately with an &EAGAIN; when no buffer is available. The
  210. &func-select; or &func-poll; function are always available.</para>
  211. <para>To start and stop capturing or output applications call the
  212. &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
  213. <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
  214. queues as a side effect. Since there is no notion of doing anything
  215. "now" on a multitasking system, if an application needs to synchronize
  216. with another event it should examine the &v4l2-buffer;
  217. <structfield>timestamp</structfield> of captured buffers, or set the
  218. field before enqueuing buffers for output.</para>
  219. <para>Drivers implementing memory mapping I/O must
  220. support the <constant>VIDIOC_REQBUFS</constant>,
  221. <constant>VIDIOC_QUERYBUF</constant>,
  222. <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
  223. <constant>VIDIOC_STREAMON</constant> and
  224. <constant>VIDIOC_STREAMOFF</constant> ioctl, the
  225. <function>mmap()</function>, <function>munmap()</function>,
  226. <function>select()</function> and <function>poll()</function>
  227. function.<footnote>
  228. <para>At the driver level <function>select()</function> and
  229. <function>poll()</function> are the same, and
  230. <function>select()</function> is too important to be optional. The
  231. rest should be evident.</para>
  232. </footnote></para>
  233. <para>[capture example]</para>
  234. </section>
  235. <section id="userp">
  236. <title>Streaming I/O (User Pointers)</title>
  237. <para>Input and output devices support this I/O method when the
  238. <constant>V4L2_CAP_STREAMING</constant> flag in the
  239. <structfield>capabilities</structfield> field of &v4l2-capability;
  240. returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user
  241. pointer method (not only memory mapping) is supported must be
  242. determined by calling the &VIDIOC-REQBUFS; ioctl.</para>
  243. <para>This I/O method combines advantages of the read/write and
  244. memory mapping methods. Buffers are allocated by the application
  245. itself, and can reside for example in virtual or shared memory. Only
  246. pointers to data are exchanged, these pointers and meta-information
  247. are passed in &v4l2-buffer;. The driver must be switched
  248. into user pointer I/O mode by calling the &VIDIOC-REQBUFS; with the
  249. desired buffer type. No buffers are allocated beforehands,
  250. consequently they are not indexed and cannot be queried like mapped
  251. buffers with the <constant>VIDIOC_QUERYBUF</constant> ioctl.</para>
  252. <example>
  253. <title>Initiating streaming I/O with user pointers</title>
  254. <programlisting>
  255. &v4l2-requestbuffers; reqbuf;
  256. memset (&amp;reqbuf, 0, sizeof (reqbuf));
  257. reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  258. reqbuf.memory = V4L2_MEMORY_USERPTR;
  259. if (ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf) == -1) {
  260. if (errno == EINVAL)
  261. printf ("Video capturing or user pointer streaming is not supported\n");
  262. else
  263. perror ("VIDIOC_REQBUFS");
  264. exit (EXIT_FAILURE);
  265. }
  266. </programlisting>
  267. </example>
  268. <para>Buffer addresses and sizes are passed on the fly with the
  269. &VIDIOC-QBUF; ioctl. Although buffers are commonly cycled,
  270. applications can pass different addresses and sizes at each
  271. <constant>VIDIOC_QBUF</constant> call. If required by the hardware the
  272. driver swaps memory pages within physical memory to create a
  273. continuous area of memory. This happens transparently to the
  274. application in the virtual memory subsystem of the kernel. When buffer
  275. pages have been swapped out to disk they are brought back and finally
  276. locked in physical memory for DMA.<footnote>
  277. <para>We expect that frequently used buffers are typically not
  278. swapped out. Anyway, the process of swapping, locking or generating
  279. scatter-gather lists may be time consuming. The delay can be masked by
  280. the depth of the incoming buffer queue, and perhaps by maintaining
  281. caches assuming a buffer will be soon enqueued again. On the other
  282. hand, to optimize memory usage drivers can limit the number of buffers
  283. locked in advance and recycle the most recently used buffers first. Of
  284. course, the pages of empty buffers in the incoming queue need not be
  285. saved to disk. Output buffers must be saved on the incoming and
  286. outgoing queue because an application may share them with other
  287. processes.</para>
  288. </footnote></para>
  289. <para>Filled or displayed buffers are dequeued with the
  290. &VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any
  291. time between the completion of the DMA and this ioctl. The memory is
  292. also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or
  293. when the device is closed. Applications must take care not to free
  294. buffers without dequeuing. For once, the buffers remain locked until
  295. further, wasting physical memory. Second the driver will not be
  296. notified when the memory is returned to the application's free list
  297. and subsequently reused for other purposes, possibly completing the
  298. requested DMA and overwriting valuable data.</para>
  299. <para>For capturing applications it is customary to enqueue a
  300. number of empty buffers, to start capturing and enter the read loop.
  301. Here the application waits until a filled buffer can be dequeued, and
  302. re-enqueues the buffer when the data is no longer needed. Output
  303. applications fill and enqueue buffers, when enough buffers are stacked
  304. up output is started. In the write loop, when the application
  305. runs out of free buffers it must wait until an empty buffer can be
  306. dequeued and reused. Two methods exist to suspend execution of the
  307. application until one or more buffers can be dequeued. By default
  308. <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
  309. outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
  310. given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
  311. returns immediately with an &EAGAIN; when no buffer is available. The
  312. &func-select; or &func-poll; function are always available.</para>
  313. <para>To start and stop capturing or output applications call the
  314. &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
  315. <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
  316. queues and unlocks all buffers as a side effect. Since there is no
  317. notion of doing anything "now" on a multitasking system, if an
  318. application needs to synchronize with another event it should examine
  319. the &v4l2-buffer; <structfield>timestamp</structfield> of captured
  320. buffers, or set the field before enqueuing buffers for output.</para>
  321. <para>Drivers implementing user pointer I/O must
  322. support the <constant>VIDIOC_REQBUFS</constant>,
  323. <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
  324. <constant>VIDIOC_STREAMON</constant> and
  325. <constant>VIDIOC_STREAMOFF</constant> ioctl, the
  326. <function>select()</function> and <function>poll()</function> function.<footnote>
  327. <para>At the driver level <function>select()</function> and
  328. <function>poll()</function> are the same, and
  329. <function>select()</function> is too important to be optional. The
  330. rest should be evident.</para>
  331. </footnote></para>
  332. </section>
  333. <section id="async">
  334. <title>Asynchronous I/O</title>
  335. <para>This method is not defined yet.</para>
  336. </section>
  337. <section id="buffer">
  338. <title>Buffers</title>
  339. <para>A buffer contains data exchanged by application and
  340. driver using one of the Streaming I/O methods. Only pointers to
  341. buffers are exchanged, the data itself is not copied. These pointers,
  342. together with meta-information like timestamps or field parity, are
  343. stored in a struct <structname>v4l2_buffer</structname>, argument to
  344. the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl.</para>
  345. <para>Nominally timestamps refer to the first data byte transmitted.
  346. In practice however the wide range of hardware covered by the V4L2 API
  347. limits timestamp accuracy. Often an interrupt routine will
  348. sample the system clock shortly after the field or frame was stored
  349. completely in memory. So applications must expect a constant
  350. difference up to one field or frame period plus a small (few scan
  351. lines) random error. The delay and error can be much
  352. larger due to compression or transmission over an external bus when
  353. the frames are not properly stamped by the sender. This is frequently
  354. the case with USB cameras. Here timestamps refer to the instant the
  355. field or frame was received by the driver, not the capture time. These
  356. devices identify by not enumerating any video standards, see <xref
  357. linkend="standard" />.</para>
  358. <para>Similar limitations apply to output timestamps. Typically
  359. the video hardware locks to a clock controlling the video timing, the
  360. horizontal and vertical synchronization pulses. At some point in the
  361. line sequence, possibly the vertical blanking, an interrupt routine
  362. samples the system clock, compares against the timestamp and programs
  363. the hardware to repeat the previous field or frame, or to display the
  364. buffer contents.</para>
  365. <para>Apart of limitations of the video device and natural
  366. inaccuracies of all clocks, it should be noted system time itself is
  367. not perfectly stable. It can be affected by power saving cycles,
  368. warped to insert leap seconds, or even turned back or forth by the
  369. system administrator affecting long term measurements. <footnote>
  370. <para>Since no other Linux multimedia
  371. API supports unadjusted time it would be foolish to introduce here. We
  372. must use a universally supported clock to synchronize different media,
  373. hence time of day.</para>
  374. </footnote></para>
  375. <table frame="none" pgwide="1" id="v4l2-buffer">
  376. <title>struct <structname>v4l2_buffer</structname></title>
  377. <tgroup cols="4">
  378. &cs-ustr;
  379. <tbody valign="top">
  380. <row>
  381. <entry>__u32</entry>
  382. <entry><structfield>index</structfield></entry>
  383. <entry></entry>
  384. <entry>Number of the buffer, set by the application. This
  385. field is only used for <link linkend="mmap">memory mapping</link> I/O
  386. and can range from zero to the number of buffers allocated
  387. with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry>
  388. </row>
  389. <row>
  390. <entry>&v4l2-buf-type;</entry>
  391. <entry><structfield>type</structfield></entry>
  392. <entry></entry>
  393. <entry>Type of the buffer, same as &v4l2-format;
  394. <structfield>type</structfield> or &v4l2-requestbuffers;
  395. <structfield>type</structfield>, set by the application.</entry>
  396. </row>
  397. <row>
  398. <entry>__u32</entry>
  399. <entry><structfield>bytesused</structfield></entry>
  400. <entry></entry>
  401. <entry>The number of bytes occupied by the data in the
  402. buffer. It depends on the negotiated data format and may change with
  403. each buffer for compressed variable size data like JPEG images.
  404. Drivers must set this field when <structfield>type</structfield>
  405. refers to an input stream, applications when an output stream.</entry>
  406. </row>
  407. <row>
  408. <entry>__u32</entry>
  409. <entry><structfield>flags</structfield></entry>
  410. <entry></entry>
  411. <entry>Flags set by the application or driver, see <xref
  412. linkend="buffer-flags" />.</entry>
  413. </row>
  414. <row>
  415. <entry>&v4l2-field;</entry>
  416. <entry><structfield>field</structfield></entry>
  417. <entry></entry>
  418. <entry>Indicates the field order of the image in the
  419. buffer, see <xref linkend="v4l2-field" />. This field is not used when
  420. the buffer contains VBI data. Drivers must set it when
  421. <structfield>type</structfield> refers to an input stream,
  422. applications when an output stream.</entry>
  423. </row>
  424. <row>
  425. <entry>struct timeval</entry>
  426. <entry><structfield>timestamp</structfield></entry>
  427. <entry></entry>
  428. <entry><para>For input streams this is the
  429. system time (as returned by the <function>gettimeofday()</function>
  430. function) when the first data byte was captured. For output streams
  431. the data will not be displayed before this time, secondary to the
  432. nominal frame rate determined by the current video standard in
  433. enqueued order. Applications can for example zero this field to
  434. display frames as soon as possible. The driver stores the time at
  435. which the first data byte was actually sent out in the
  436. <structfield>timestamp</structfield> field. This permits
  437. applications to monitor the drift between the video and system
  438. clock.</para></entry>
  439. </row>
  440. <row>
  441. <entry>&v4l2-timecode;</entry>
  442. <entry><structfield>timecode</structfield></entry>
  443. <entry></entry>
  444. <entry>When <structfield>type</structfield> is
  445. <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> and the
  446. <constant>V4L2_BUF_FLAG_TIMECODE</constant> flag is set in
  447. <structfield>flags</structfield>, this structure contains a frame
  448. timecode. In <link linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link>
  449. mode the top and bottom field contain the same timecode.
  450. Timecodes are intended to help video editing and are typically recorded on
  451. video tapes, but also embedded in compressed formats like MPEG. This
  452. field is independent of the <structfield>timestamp</structfield> and
  453. <structfield>sequence</structfield> fields.</entry>
  454. </row>
  455. <row>
  456. <entry>__u32</entry>
  457. <entry><structfield>sequence</structfield></entry>
  458. <entry></entry>
  459. <entry>Set by the driver, counting the frames in the
  460. sequence.</entry>
  461. </row>
  462. <row>
  463. <entry spanname="hspan"><para>In <link
  464. linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link> mode the top and
  465. bottom field have the same sequence number. The count starts at zero
  466. and includes dropped or repeated frames. A dropped frame was received
  467. by an input device but could not be stored due to lack of free buffer
  468. space. A repeated frame was displayed again by an output device
  469. because the application did not pass new data in
  470. time.</para><para>Note this may count the frames received
  471. e.g. over USB, without taking into account the frames dropped by the
  472. remote hardware due to limited compression throughput or bus
  473. bandwidth. These devices identify by not enumerating any video
  474. standards, see <xref linkend="standard" />.</para></entry>
  475. </row>
  476. <row>
  477. <entry>&v4l2-memory;</entry>
  478. <entry><structfield>memory</structfield></entry>
  479. <entry></entry>
  480. <entry>This field must be set by applications and/or drivers
  481. in accordance with the selected I/O method.</entry>
  482. </row>
  483. <row>
  484. <entry>union</entry>
  485. <entry><structfield>m</structfield></entry>
  486. </row>
  487. <row>
  488. <entry></entry>
  489. <entry>__u32</entry>
  490. <entry><structfield>offset</structfield></entry>
  491. <entry>When <structfield>memory</structfield> is
  492. <constant>V4L2_MEMORY_MMAP</constant> this is the offset of the buffer
  493. from the start of the device memory. The value is returned by the
  494. driver and apart of serving as parameter to the &func-mmap; function
  495. not useful for applications. See <xref linkend="mmap" /> for details.</entry>
  496. </row>
  497. <row>
  498. <entry></entry>
  499. <entry>unsigned long</entry>
  500. <entry><structfield>userptr</structfield></entry>
  501. <entry>When <structfield>memory</structfield> is
  502. <constant>V4L2_MEMORY_USERPTR</constant> this is a pointer to the
  503. buffer (casted to unsigned long type) in virtual memory, set by the
  504. application. See <xref linkend="userp" /> for details.</entry>
  505. </row>
  506. <row>
  507. <entry>__u32</entry>
  508. <entry><structfield>length</structfield></entry>
  509. <entry></entry>
  510. <entry>Size of the buffer (not the payload) in bytes.</entry>
  511. </row>
  512. <row>
  513. <entry>__u32</entry>
  514. <entry><structfield>input</structfield></entry>
  515. <entry></entry>
  516. <entry>Some video capture drivers support rapid and
  517. synchronous video input changes, a function useful for example in
  518. video surveillance applications. For this purpose applications set the
  519. <constant>V4L2_BUF_FLAG_INPUT</constant> flag, and this field to the
  520. number of a video input as in &v4l2-input; field
  521. <structfield>index</structfield>.</entry>
  522. </row>
  523. <row>
  524. <entry>__u32</entry>
  525. <entry><structfield>reserved</structfield></entry>
  526. <entry></entry>
  527. <entry>A place holder for future extensions and custom
  528. (driver defined) buffer types
  529. <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher.</entry>
  530. </row>
  531. </tbody>
  532. </tgroup>
  533. </table>
  534. <table frame="none" pgwide="1" id="v4l2-buf-type">
  535. <title>enum v4l2_buf_type</title>
  536. <tgroup cols="3">
  537. &cs-def;
  538. <tbody valign="top">
  539. <row>
  540. <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry>
  541. <entry>1</entry>
  542. <entry>Buffer of a video capture stream, see <xref
  543. linkend="capture" />.</entry>
  544. </row>
  545. <row>
  546. <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry>
  547. <entry>2</entry>
  548. <entry>Buffer of a video output stream, see <xref
  549. linkend="output" />.</entry>
  550. </row>
  551. <row>
  552. <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry>
  553. <entry>3</entry>
  554. <entry>Buffer for video overlay, see <xref linkend="overlay" />.</entry>
  555. </row>
  556. <row>
  557. <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry>
  558. <entry>4</entry>
  559. <entry>Buffer of a raw VBI capture stream, see <xref
  560. linkend="raw-vbi" />.</entry>
  561. </row>
  562. <row>
  563. <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry>
  564. <entry>5</entry>
  565. <entry>Buffer of a raw VBI output stream, see <xref
  566. linkend="raw-vbi" />.</entry>
  567. </row>
  568. <row>
  569. <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry>
  570. <entry>6</entry>
  571. <entry>Buffer of a sliced VBI capture stream, see <xref
  572. linkend="sliced" />.</entry>
  573. </row>
  574. <row>
  575. <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry>
  576. <entry>7</entry>
  577. <entry>Buffer of a sliced VBI output stream, see <xref
  578. linkend="sliced" />.</entry>
  579. </row>
  580. <row>
  581. <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant></entry>
  582. <entry>8</entry>
  583. <entry>Buffer for video output overlay (OSD), see <xref
  584. linkend="osd" />. Status: <link
  585. linkend="experimental">Experimental</link>.</entry>
  586. </row>
  587. <row>
  588. <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry>
  589. <entry>0x80</entry>
  590. <entry>This and higher values are reserved for custom
  591. (driver defined) buffer types.</entry>
  592. </row>
  593. </tbody>
  594. </tgroup>
  595. </table>
  596. <table frame="none" pgwide="1" id="buffer-flags">
  597. <title>Buffer Flags</title>
  598. <tgroup cols="3">
  599. &cs-def;
  600. <tbody valign="top">
  601. <row>
  602. <entry><constant>V4L2_BUF_FLAG_MAPPED</constant></entry>
  603. <entry>0x0001</entry>
  604. <entry>The buffer resides in device memory and has been mapped
  605. into the application's address space, see <xref linkend="mmap" /> for details.
  606. Drivers set or clear this flag when the
  607. <link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link
  608. linkend="vidioc-qbuf">VIDIOC_QBUF</link> or <link
  609. linkend="vidioc-qbuf">VIDIOC_DQBUF</link> ioctl is called. Set by the driver.</entry>
  610. </row>
  611. <row>
  612. <entry><constant>V4L2_BUF_FLAG_QUEUED</constant></entry>
  613. <entry>0x0002</entry>
  614. <entry>Internally drivers maintain two buffer queues, an
  615. incoming and outgoing queue. When this flag is set, the buffer is
  616. currently on the incoming queue. It automatically moves to the
  617. outgoing queue after the buffer has been filled (capture devices) or
  618. displayed (output devices). Drivers set or clear this flag when the
  619. <constant>VIDIOC_QUERYBUF</constant> ioctl is called. After
  620. (successful) calling the <constant>VIDIOC_QBUF </constant>ioctl it is
  621. always set and after <constant>VIDIOC_DQBUF</constant> always
  622. cleared.</entry>
  623. </row>
  624. <row>
  625. <entry><constant>V4L2_BUF_FLAG_DONE</constant></entry>
  626. <entry>0x0004</entry>
  627. <entry>When this flag is set, the buffer is currently on
  628. the outgoing queue, ready to be dequeued from the driver. Drivers set
  629. or clear this flag when the <constant>VIDIOC_QUERYBUF</constant> ioctl
  630. is called. After calling the <constant>VIDIOC_QBUF</constant> or
  631. <constant>VIDIOC_DQBUF</constant> it is always cleared. Of course a
  632. buffer cannot be on both queues at the same time, the
  633. <constant>V4L2_BUF_FLAG_QUEUED</constant> and
  634. <constant>V4L2_BUF_FLAG_DONE</constant> flag are mutually exclusive.
  635. They can be both cleared however, then the buffer is in "dequeued"
  636. state, in the application domain to say so.</entry>
  637. </row>
  638. <row>
  639. <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry>
  640. <entry>0x0008</entry>
  641. <entry>Drivers set or clear this flag when calling the
  642. <constant>VIDIOC_DQBUF</constant> ioctl. It may be set by video
  643. capture devices when the buffer contains a compressed image which is a
  644. key frame (or field), &ie; can be decompressed on its own.</entry>
  645. </row>
  646. <row>
  647. <entry><constant>V4L2_BUF_FLAG_PFRAME</constant></entry>
  648. <entry>0x0010</entry>
  649. <entry>Similar to <constant>V4L2_BUF_FLAG_KEYFRAME</constant>
  650. this flags predicted frames or fields which contain only differences to a
  651. previous key frame.</entry>
  652. </row>
  653. <row>
  654. <entry><constant>V4L2_BUF_FLAG_BFRAME</constant></entry>
  655. <entry>0x0020</entry>
  656. <entry>Similar to <constant>V4L2_BUF_FLAG_PFRAME</constant>
  657. this is a bidirectional predicted frame or field. [ooc tbd]</entry>
  658. </row>
  659. <row>
  660. <entry><constant>V4L2_BUF_FLAG_TIMECODE</constant></entry>
  661. <entry>0x0100</entry>
  662. <entry>The <structfield>timecode</structfield> field is valid.
  663. Drivers set or clear this flag when the <constant>VIDIOC_DQBUF</constant>
  664. ioctl is called.</entry>
  665. </row>
  666. <row>
  667. <entry><constant>V4L2_BUF_FLAG_INPUT</constant></entry>
  668. <entry>0x0200</entry>
  669. <entry>The <structfield>input</structfield> field is valid.
  670. Applications set or clear this flag before calling the
  671. <constant>VIDIOC_QBUF</constant> ioctl.</entry>
  672. </row>
  673. </tbody>
  674. </tgroup>
  675. </table>
  676. <table pgwide="1" frame="none" id="v4l2-memory">
  677. <title>enum v4l2_memory</title>
  678. <tgroup cols="3">
  679. &cs-def;
  680. <tbody valign="top">
  681. <row>
  682. <entry><constant>V4L2_MEMORY_MMAP</constant></entry>
  683. <entry>1</entry>
  684. <entry>The buffer is used for <link linkend="mmap">memory
  685. mapping</link> I/O.</entry>
  686. </row>
  687. <row>
  688. <entry><constant>V4L2_MEMORY_USERPTR</constant></entry>
  689. <entry>2</entry>
  690. <entry>The buffer is used for <link linkend="userp">user
  691. pointer</link> I/O.</entry>
  692. </row>
  693. <row>
  694. <entry><constant>V4L2_MEMORY_OVERLAY</constant></entry>
  695. <entry>3</entry>
  696. <entry>[to do]</entry>
  697. </row>
  698. </tbody>
  699. </tgroup>
  700. </table>
  701. <section>
  702. <title>Timecodes</title>
  703. <para>The <structname>v4l2_timecode</structname> structure is
  704. designed to hold a <xref linkend="smpte12m" /> or similar timecode.
  705. (struct <structname>timeval</structname> timestamps are stored in
  706. &v4l2-buffer; field <structfield>timestamp</structfield>.)</para>
  707. <table frame="none" pgwide="1" id="v4l2-timecode">
  708. <title>struct <structname>v4l2_timecode</structname></title>
  709. <tgroup cols="3">
  710. &cs-str;
  711. <tbody valign="top">
  712. <row>
  713. <entry>__u32</entry>
  714. <entry><structfield>type</structfield></entry>
  715. <entry>Frame rate the timecodes are based on, see <xref
  716. linkend="timecode-type" />.</entry>
  717. </row>
  718. <row>
  719. <entry>__u32</entry>
  720. <entry><structfield>flags</structfield></entry>
  721. <entry>Timecode flags, see <xref linkend="timecode-flags" />.</entry>
  722. </row>
  723. <row>
  724. <entry>__u8</entry>
  725. <entry><structfield>frames</structfield></entry>
  726. <entry>Frame count, 0 ... 23/24/29/49/59, depending on the
  727. type of timecode.</entry>
  728. </row>
  729. <row>
  730. <entry>__u8</entry>
  731. <entry><structfield>seconds</structfield></entry>
  732. <entry>Seconds count, 0 ... 59. This is a binary, not BCD number.</entry>
  733. </row>
  734. <row>
  735. <entry>__u8</entry>
  736. <entry><structfield>minutes</structfield></entry>
  737. <entry>Minutes count, 0 ... 59. This is a binary, not BCD number.</entry>
  738. </row>
  739. <row>
  740. <entry>__u8</entry>
  741. <entry><structfield>hours</structfield></entry>
  742. <entry>Hours count, 0 ... 29. This is a binary, not BCD number.</entry>
  743. </row>
  744. <row>
  745. <entry>__u8</entry>
  746. <entry><structfield>userbits</structfield>[4]</entry>
  747. <entry>The "user group" bits from the timecode.</entry>
  748. </row>
  749. </tbody>
  750. </tgroup>
  751. </table>
  752. <table frame="none" pgwide="1" id="timecode-type">
  753. <title>Timecode Types</title>
  754. <tgroup cols="3">
  755. &cs-def;
  756. <tbody valign="top">
  757. <row>
  758. <entry><constant>V4L2_TC_TYPE_24FPS</constant></entry>
  759. <entry>1</entry>
  760. <entry>24 frames per second, i.&nbsp;e. film.</entry>
  761. </row>
  762. <row>
  763. <entry><constant>V4L2_TC_TYPE_25FPS</constant></entry>
  764. <entry>2</entry>
  765. <entry>25 frames per second, &ie; PAL or SECAM video.</entry>
  766. </row>
  767. <row>
  768. <entry><constant>V4L2_TC_TYPE_30FPS</constant></entry>
  769. <entry>3</entry>
  770. <entry>30 frames per second, &ie; NTSC video.</entry>
  771. </row>
  772. <row>
  773. <entry><constant>V4L2_TC_TYPE_50FPS</constant></entry>
  774. <entry>4</entry>
  775. <entry></entry>
  776. </row>
  777. <row>
  778. <entry><constant>V4L2_TC_TYPE_60FPS</constant></entry>
  779. <entry>5</entry>
  780. <entry></entry>
  781. </row>
  782. </tbody>
  783. </tgroup>
  784. </table>
  785. <table frame="none" pgwide="1" id="timecode-flags">
  786. <title>Timecode Flags</title>
  787. <tgroup cols="3">
  788. &cs-def;
  789. <tbody valign="top">
  790. <row>
  791. <entry><constant>V4L2_TC_FLAG_DROPFRAME</constant></entry>
  792. <entry>0x0001</entry>
  793. <entry>Indicates "drop frame" semantics for counting frames
  794. in 29.97 fps material. When set, frame numbers 0 and 1 at the start of
  795. each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the
  796. count.</entry>
  797. </row>
  798. <row>
  799. <entry><constant>V4L2_TC_FLAG_COLORFRAME</constant></entry>
  800. <entry>0x0002</entry>
  801. <entry>The "color frame" flag.</entry>
  802. </row>
  803. <row>
  804. <entry><constant>V4L2_TC_USERBITS_field</constant></entry>
  805. <entry>0x000C</entry>
  806. <entry>Field mask for the "binary group flags".</entry>
  807. </row>
  808. <row>
  809. <entry><constant>V4L2_TC_USERBITS_USERDEFINED</constant></entry>
  810. <entry>0x0000</entry>
  811. <entry>Unspecified format.</entry>
  812. </row>
  813. <row>
  814. <entry><constant>V4L2_TC_USERBITS_8BITCHARS</constant></entry>
  815. <entry>0x0008</entry>
  816. <entry>8-bit ISO characters.</entry>
  817. </row>
  818. </tbody>
  819. </tgroup>
  820. </table>
  821. </section>
  822. </section>
  823. <section id="field-order">
  824. <title>Field Order</title>
  825. <para>We have to distinguish between progressive and interlaced
  826. video. Progressive video transmits all lines of a video image
  827. sequentially. Interlaced video divides an image into two fields,
  828. containing only the odd and even lines of the image, respectively.
  829. Alternating the so called odd and even field are transmitted, and due
  830. to a small delay between fields a cathode ray TV displays the lines
  831. interleaved, yielding the original frame. This curious technique was
  832. invented because at refresh rates similar to film the image would
  833. fade out too quickly. Transmitting fields reduces the flicker without
  834. the necessity of doubling the frame rate and with it the bandwidth
  835. required for each channel.</para>
  836. <para>It is important to understand a video camera does not expose
  837. one frame at a time, merely transmitting the frames separated into
  838. fields. The fields are in fact captured at two different instances in
  839. time. An object on screen may well move between one field and the
  840. next. For applications analysing motion it is of paramount importance
  841. to recognize which field of a frame is older, the <emphasis>temporal
  842. order</emphasis>.</para>
  843. <para>When the driver provides or accepts images field by field
  844. rather than interleaved, it is also important applications understand
  845. how the fields combine to frames. We distinguish between top and
  846. bottom fields, the <emphasis>spatial order</emphasis>: The first line
  847. of the top field is the first line of an interlaced frame, the first
  848. line of the bottom field is the second line of that frame.</para>
  849. <para>However because fields were captured one after the other,
  850. arguing whether a frame commences with the top or bottom field is
  851. pointless. Any two successive top and bottom, or bottom and top fields
  852. yield a valid frame. Only when the source was progressive to begin
  853. with, &eg; when transferring film to video, two fields may come from
  854. the same frame, creating a natural order.</para>
  855. <para>Counter to intuition the top field is not necessarily the
  856. older field. Whether the older field contains the top or bottom lines
  857. is a convention determined by the video standard. Hence the
  858. distinction between temporal and spatial order of fields. The diagrams
  859. below should make this clearer.</para>
  860. <para>All video capture and output devices must report the current
  861. field order. Some drivers may permit the selection of a different
  862. order, to this end applications initialize the
  863. <structfield>field</structfield> field of &v4l2-pix-format; before
  864. calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should
  865. have the value <constant>V4L2_FIELD_ANY</constant> (0).</para>
  866. <table frame="none" pgwide="1" id="v4l2-field">
  867. <title>enum v4l2_field</title>
  868. <tgroup cols="3">
  869. &cs-def;
  870. <tbody valign="top">
  871. <row>
  872. <entry><constant>V4L2_FIELD_ANY</constant></entry>
  873. <entry>0</entry>
  874. <entry>Applications request this field order when any
  875. one of the <constant>V4L2_FIELD_NONE</constant>,
  876. <constant>V4L2_FIELD_TOP</constant>,
  877. <constant>V4L2_FIELD_BOTTOM</constant>, or
  878. <constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable.
  879. Drivers choose depending on hardware capabilities or e.&nbsp;g. the
  880. requested image size, and return the actual field order. &v4l2-buffer;
  881. <structfield>field</structfield> can never be
  882. <constant>V4L2_FIELD_ANY</constant>.</entry>
  883. </row>
  884. <row>
  885. <entry><constant>V4L2_FIELD_NONE</constant></entry>
  886. <entry>1</entry>
  887. <entry>Images are in progressive format, not interlaced.
  888. The driver may also indicate this order when it cannot distinguish
  889. between <constant>V4L2_FIELD_TOP</constant> and
  890. <constant>V4L2_FIELD_BOTTOM</constant>.</entry>
  891. </row>
  892. <row>
  893. <entry><constant>V4L2_FIELD_TOP</constant></entry>
  894. <entry>2</entry>
  895. <entry>Images consist of the top field only.</entry>
  896. </row>
  897. <row>
  898. <entry><constant>V4L2_FIELD_BOTTOM</constant></entry>
  899. <entry>3</entry>
  900. <entry>Images consist of the bottom field only.
  901. Applications may wish to prevent a device from capturing interlaced
  902. images because they will have "comb" or "feathering" artefacts around
  903. moving objects.</entry>
  904. </row>
  905. <row>
  906. <entry><constant>V4L2_FIELD_INTERLACED</constant></entry>
  907. <entry>4</entry>
  908. <entry>Images contain both fields, interleaved line by
  909. line. The temporal order of the fields (whether the top or bottom
  910. field is first transmitted) depends on the current video standard.
  911. M/NTSC transmits the bottom field first, all other standards the top
  912. field first.</entry>
  913. </row>
  914. <row>
  915. <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry>
  916. <entry>5</entry>
  917. <entry>Images contain both fields, the top field lines
  918. are stored first in memory, immediately followed by the bottom field
  919. lines. Fields are always stored in temporal order, the older one first
  920. in memory. Image sizes refer to the frame, not fields.</entry>
  921. </row>
  922. <row>
  923. <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry>
  924. <entry>6</entry>
  925. <entry>Images contain both fields, the bottom field
  926. lines are stored first in memory, immediately followed by the top
  927. field lines. Fields are always stored in temporal order, the older one
  928. first in memory. Image sizes refer to the frame, not fields.</entry>
  929. </row>
  930. <row>
  931. <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry>
  932. <entry>7</entry>
  933. <entry>The two fields of a frame are passed in separate
  934. buffers, in temporal order, &ie; the older one first. To indicate the field
  935. parity (whether the current field is a top or bottom field) the driver
  936. or application, depending on data direction, must set &v4l2-buffer;
  937. <structfield>field</structfield> to
  938. <constant>V4L2_FIELD_TOP</constant> or
  939. <constant>V4L2_FIELD_BOTTOM</constant>. Any two successive fields pair
  940. to build a frame. If fields are successive, without any dropped fields
  941. between them (fields can drop individually), can be determined from
  942. the &v4l2-buffer; <structfield>sequence</structfield> field. Image
  943. sizes refer to the frame, not fields. This format cannot be selected
  944. when using the read/write I/O method.<!-- Where it's indistinguishable
  945. from V4L2_FIELD_SEQ_*. --></entry>
  946. </row>
  947. <row>
  948. <entry><constant>V4L2_FIELD_INTERLACED_TB</constant></entry>
  949. <entry>8</entry>
  950. <entry>Images contain both fields, interleaved line by
  951. line, top field first. The top field is transmitted first.</entry>
  952. </row>
  953. <row>
  954. <entry><constant>V4L2_FIELD_INTERLACED_BT</constant></entry>
  955. <entry>9</entry>
  956. <entry>Images contain both fields, interleaved line by
  957. line, top field first. The bottom field is transmitted first.</entry>
  958. </row>
  959. </tbody>
  960. </tgroup>
  961. </table>
  962. <figure id="fieldseq-tb">
  963. <title>Field Order, Top Field First Transmitted</title>
  964. <mediaobject>
  965. <imageobject>
  966. <imagedata fileref="fieldseq_tb.pdf" format="PS" />
  967. </imageobject>
  968. <imageobject>
  969. <imagedata fileref="fieldseq_tb.gif" format="GIF" />
  970. </imageobject>
  971. </mediaobject>
  972. </figure>
  973. <figure id="fieldseq-bt">
  974. <title>Field Order, Bottom Field First Transmitted</title>
  975. <mediaobject>
  976. <imageobject>
  977. <imagedata fileref="fieldseq_bt.pdf" format="PS" />
  978. </imageobject>
  979. <imageobject>
  980. <imagedata fileref="fieldseq_bt.gif" format="GIF" />
  981. </imageobject>
  982. </mediaobject>
  983. </figure>
  984. </section>
  985. <!--
  986. Local Variables:
  987. mode: sgml
  988. sgml-parent-document: "v4l2.sgml"
  989. indent-tabs-mode: nil
  990. End:
  991. -->