dev-output.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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> or
  17. <constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant> flag in the
  18. <structfield>capabilities</structfield> field of &v4l2-capability;
  19. returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions
  20. they may also support the <link linkend="raw-vbi">raw VBI
  21. output</link> (<constant>V4L2_CAP_VBI_OUTPUT</constant>) interface. At
  22. least one of the read/write or streaming I/O methods must be
  23. supported. Modulators and audio outputs are optional.</para>
  24. </section>
  25. <section>
  26. <title>Supplemental Functions</title>
  27. <para>Video output devices shall support <link
  28. linkend="audio">audio output</link>, <link
  29. linkend="tuner">modulator</link>, <link linkend="control">controls</link>,
  30. <link linkend="crop">cropping and scaling</link> and <link
  31. linkend="streaming-par">streaming parameter</link> ioctls as needed.
  32. The <link linkend="video">video output</link> and <link
  33. linkend="standard">video standard</link> ioctls must be supported by
  34. all video output devices.</para>
  35. </section>
  36. <section>
  37. <title>Image Format Negotiation</title>
  38. <para>The output is determined by cropping and image format
  39. parameters. The former select an area of the video picture where the
  40. image will appear, the latter how images are stored in memory, &ie; in
  41. RGB or YUV format, the number of bits per pixel or width and height.
  42. Together they also define how images are scaled in the process.</para>
  43. <para>As usual these parameters are <emphasis>not</emphasis> reset
  44. at &func-open; time to permit Unix tool chains, programming a device
  45. and then writing to it as if it was a plain file. Well written V4L2
  46. applications ensure they really get what they want, including cropping
  47. and scaling.</para>
  48. <para>Cropping initialization at minimum requires to reset the
  49. parameters to defaults. An example is given in <xref
  50. linkend="crop" />.</para>
  51. <para>To query the current image format applications set the
  52. <structfield>type</structfield> field of a &v4l2-format; to
  53. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> or
  54. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant> and call the
  55. &VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill
  56. the &v4l2-pix-format; <structfield>pix</structfield> or the
  57. &v4l2-pix-format-mplane; <structfield>pix_mp</structfield> member of the
  58. <structfield>fmt</structfield> union.</para>
  59. <para>To request different parameters applications set the
  60. <structfield>type</structfield> field of a &v4l2-format; as above and
  61. initialize all fields of the &v4l2-pix-format;
  62. <structfield>vbi</structfield> member of the
  63. <structfield>fmt</structfield> union, or better just modify the
  64. results of <constant>VIDIOC_G_FMT</constant>, and call the
  65. &VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may
  66. adjust the parameters and finally return the actual parameters as
  67. <constant>VIDIOC_G_FMT</constant> does.</para>
  68. <para>Like <constant>VIDIOC_S_FMT</constant> the
  69. &VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations
  70. without disabling I/O or possibly time consuming hardware
  71. preparations.</para>
  72. <para>The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane;
  73. are discussed in <xref linkend="pixfmt" />. See also the specification of the
  74. <constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant>
  75. and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video
  76. output devices must implement both the
  77. <constant>VIDIOC_G_FMT</constant> and
  78. <constant>VIDIOC_S_FMT</constant> ioctl, even if
  79. <constant>VIDIOC_S_FMT</constant> ignores all requests and always
  80. returns default parameters as <constant>VIDIOC_G_FMT</constant> does.
  81. <constant>VIDIOC_TRY_FMT</constant> is optional.</para>
  82. </section>
  83. <section>
  84. <title>Writing Images</title>
  85. <para>A video output device may support the <link
  86. linkend="rw">write() function</link> and/or streaming (<link
  87. linkend="mmap">memory mapping</link> or <link
  88. linkend="userp">user pointer</link>) I/O. See <xref
  89. linkend="io" /> for details.</para>
  90. </section>