Path: blob/master/Documentation/DocBook/v4l/dev-output.xml
10823 views
<title>Video Output Interface</title>12<para>Video output devices encode stills or image sequences as3analog video signal. With this interface applications can4control the encoding process and move images from user space to5the driver.</para>67<para>Conventionally V4L2 video output devices are accessed through8character device special files named <filename>/dev/video</filename>9and <filename>/dev/video0</filename> to10<filename>/dev/video63</filename> with major number 81 and minor11numbers 0 to 63. <filename>/dev/video</filename> is typically a12symbolic link to the preferred video device. Note the same device13files are used for video capture devices.</para>1415<section>16<title>Querying Capabilities</title>1718<para>Devices supporting the video output interface set the19<constant>V4L2_CAP_VIDEO_OUTPUT</constant> or20<constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant> flag in the21<structfield>capabilities</structfield> field of &v4l2-capability;22returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions23they may also support the <link linkend="raw-vbi">raw VBI24output</link> (<constant>V4L2_CAP_VBI_OUTPUT</constant>) interface. At25least one of the read/write or streaming I/O methods must be26supported. Modulators and audio outputs are optional.</para>27</section>2829<section>30<title>Supplemental Functions</title>3132<para>Video output devices shall support <link33linkend="audio">audio output</link>, <link34linkend="tuner">modulator</link>, <link linkend="control">controls</link>,35<link linkend="crop">cropping and scaling</link> and <link36linkend="streaming-par">streaming parameter</link> ioctls as needed.37The <link linkend="video">video output</link> and <link38linkend="standard">video standard</link> ioctls must be supported by39all video output devices.</para>40</section>4142<section>43<title>Image Format Negotiation</title>4445<para>The output is determined by cropping and image format46parameters. The former select an area of the video picture where the47image will appear, the latter how images are stored in memory, &ie; in48RGB or YUV format, the number of bits per pixel or width and height.49Together they also define how images are scaled in the process.</para>5051<para>As usual these parameters are <emphasis>not</emphasis> reset52at &func-open; time to permit Unix tool chains, programming a device53and then writing to it as if it was a plain file. Well written V4L254applications ensure they really get what they want, including cropping55and scaling.</para>5657<para>Cropping initialization at minimum requires to reset the58parameters to defaults. An example is given in <xref59linkend="crop" />.</para>6061<para>To query the current image format applications set the62<structfield>type</structfield> field of a &v4l2-format; to63<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> or64<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant> and call the65&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill66the &v4l2-pix-format; <structfield>pix</structfield> or the67&v4l2-pix-format-mplane; <structfield>pix_mp</structfield> member of the68<structfield>fmt</structfield> union.</para>6970<para>To request different parameters applications set the71<structfield>type</structfield> field of a &v4l2-format; as above and72initialize all fields of the &v4l2-pix-format;73<structfield>vbi</structfield> member of the74<structfield>fmt</structfield> union, or better just modify the75results of <constant>VIDIOC_G_FMT</constant>, and call the76&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may77adjust the parameters and finally return the actual parameters as78<constant>VIDIOC_G_FMT</constant> does.</para>7980<para>Like <constant>VIDIOC_S_FMT</constant> the81&VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations82without disabling I/O or possibly time consuming hardware83preparations.</para>8485<para>The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane;86are discussed in <xref linkend="pixfmt" />. See also the specification of the87<constant>VIDIOC_G_FMT</constant>, <constant>VIDIOC_S_FMT</constant>88and <constant>VIDIOC_TRY_FMT</constant> ioctls for details. Video89output devices must implement both the90<constant>VIDIOC_G_FMT</constant> and91<constant>VIDIOC_S_FMT</constant> ioctl, even if92<constant>VIDIOC_S_FMT</constant> ignores all requests and always93returns default parameters as <constant>VIDIOC_G_FMT</constant> does.94<constant>VIDIOC_TRY_FMT</constant> is optional.</para>95</section>9697<section>98<title>Writing Images</title>99100<para>A video output device may support the <link101linkend="rw">write() function</link> and/or streaming (<link102linkend="mmap">memory mapping</link> or <link103linkend="userp">user pointer</link>) I/O. See <xref104linkend="io" /> for details.</para>105</section>106107<!--108Local Variables:109mode: sgml110sgml-parent-document: "v4l2.sgml"111indent-tabs-mode: nil112End:113-->114115116