dev-output.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <title>Video Output Interface</title>
  2. <para>Video output devices encode stills or image sequences as
  3. analog video signal. With this interface applications can
  4. control the encoding process and move images from user space to
  5. the driver.</para>
  6. <para>Conventionally V4L2 video output devices are accessed through
  7. character device special files named <filename>/dev/video</filename>
  8. and <filename>/dev/video0</filename> to
  9. <filename>/dev/video63</filename> with major number 81 and minor
  10. numbers 0 to 63. <filename>/dev/video</filename> is typically a
  11. symbolic link to the preferred video device. Note the same device
  12. files are used for video capture devices.</para>
  13. <section>
  14. <title>Querying Capabilities</title>
  15. <para>Devices supporting the video output interface set the
  16. <constant>V4L2_CAP_VIDEO_OUTPUT</constant> flag in the
  17. <structfield>capabilities</structfield> field of &v4l2-capability;
  18. returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions
  19. they may also support the <link linkend="raw-vbi">raw VBI
  20. output</link> (<constant>V4L2_CAP_VBI_OUTPUT</constant>) interface. At
  21. least one of the read/write or streaming I/O methods must be
  22. supported. Modulators and audio outputs are optional.</para>
  23. </section>
  24. <section>
  25. <title>Supplemental Functions</title>
  26. <para>Video output devices shall support <link
  27. linkend="audio">audio output</link>, <link
  28. linkend="tuner">modulator</link>, <link linkend="control">controls</link>,
  29. <link linkend="crop">cropping and scaling</link> and <link
  30. linkend="streaming-par">streaming parameter</link> ioctls as needed.
  31. The <link linkend="video">video output</link> and <link
  32. linkend="standard">video standard</link> ioctls must be supported by
  33. all video output devices.</para>
  34. </section>
  35. <section>
  36. <title>Image Format Negotiation</title>
  37. <para>The output is determined by cropping and image format
  38. parameters. The former select an area of the video picture where the
  39. image will appear, the latter how images are stored in memory, &ie; in
  40. RGB or YUV format, the number of bits per pixel or width and height.
  41. Together they also define how images are scaled in the process.</para>
  42. <para>As usual these parameters are <emphasis>not</emphasis> reset
  43. at &func-open; time to permit Unix tool chains, programming a device
  44. and then writing to it as if it was a plain file. Well written V4L2
  45. applications ensure they really get what they want, including cropping
  46. and scaling.</para>
  47. <para>Cropping initialization at minimum requires to reset the
  48. parameters to defaults. An example is given in <xref
  49. linkend="crop" />.</para>
  50. <para>To query the current image format applications set the
  51. <structfield>type</structfield> field of a &v4l2-format; to
  52. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> and call the
  53. &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill
  54. the &v4l2-pix-format; <structfield>pix</structfield> member of the
  55. <structfield>fmt</structfield> union.</para>
  56. <para>To request different parameters applications set the
  57. <structfield>type</structfield> field of a &v4l2-format; as above and
  58. initialize all fields of the &v4l2-pix-format;
  59. <structfield>vbi</structfield> member of the
  60. <structfield>fmt</structfield> union, or better just modify the
  61. results of <constant>VIDIOC_G_FMT</constant>, and call the
  62. &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may
  63. adjust the parameters and finally return the actual parameters as
  64. <constant>VIDIOC_G_FMT</constant> does.</para>
  65. <para>Like <constant>VIDIOC_S_FMT</constant> the
  66. &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations
  67. without disabling I/O or possibly time consuming hardware
  68. preparations.</para>
  69. <para>The contents of &v4l2-pix-format; are discussed in <xref
  70. linkend="pixfmt" />. See also the specification of the
  71. <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant>
  72. and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video
  73. output devices must implement both the
  74. <constant>VIDIOC_G_FMT</constant> and
  75. <constant>VIDIOC_S_FMT</constant> ioctl, even if
  76. <constant>VIDIOC_S_FMT</constant> ignores all requests and always
  77. returns default parameters as <constant>VIDIOC_G_FMT</constant> does.
  78. <constant>VIDIOC_TRY_FMT</constant> is optional.</para>
  79. </section>
  80. <section>
  81. <title>Writing Images</title>
  82. <para>A video output device may support the <link
  83. linkend="rw">write() function</link> and/or streaming (<link
  84. linkend="mmap">memory mapping</link> or <link
  85. linkend="userp">user pointer</link>) I/O. See <xref
  86. linkend="io" /> for details.</para>
  87. </section>
  88. <!--
  89. Local Variables:
  90. mode: sgml
  91. sgml-parent-document: "v4l2.sgml"
  92. indent-tabs-mode: nil
  93. End:
  94. -->