Home | History | Annotate | Download | only in spec
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
      2 <HTML
      3 ><HEAD
      4 ><TITLE
      5 >Video Output Interface</TITLE
      6 ><META
      7 NAME="GENERATOR"
      8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
      9 REL="HOME"
     10 TITLE="Video for Linux Two API Specification"
     11 HREF="book1.htm"><LINK
     12 REL="UP"
     13 TITLE="Interfaces"
     14 HREF="c6488.htm"><LINK
     15 REL="PREVIOUS"
     16 TITLE="Video Overlay Interface"
     17 HREF="x6570.htm"><LINK
     18 REL="NEXT"
     19 TITLE="Video Output Overlay Interface"
     20 HREF="x6909.htm"></HEAD
     21 ><BODY
     22 CLASS="SECTION"
     23 BGCOLOR="#FFFFFF"
     24 TEXT="#000000"
     25 LINK="#0000FF"
     26 VLINK="#840084"
     27 ALINK="#0000FF"
     28 ><DIV
     29 CLASS="NAVHEADER"
     30 ><TABLE
     31 SUMMARY="Header navigation table"
     32 WIDTH="100%"
     33 BORDER="0"
     34 CELLPADDING="0"
     35 CELLSPACING="0"
     36 ><TR
     37 ><TH
     38 COLSPAN="3"
     39 ALIGN="center"
     40 >Video for Linux Two API Specification: Revision 0.24</TH
     41 ></TR
     42 ><TR
     43 ><TD
     44 WIDTH="10%"
     45 ALIGN="left"
     46 VALIGN="bottom"
     47 ><A
     48 HREF="x6570.htm"
     49 ACCESSKEY="P"
     50 >Prev</A
     51 ></TD
     52 ><TD
     53 WIDTH="80%"
     54 ALIGN="center"
     55 VALIGN="bottom"
     56 >Chapter 4. Interfaces</TD
     57 ><TD
     58 WIDTH="10%"
     59 ALIGN="right"
     60 VALIGN="bottom"
     61 ><A
     62 HREF="x6909.htm"
     63 ACCESSKEY="N"
     64 >Next</A
     65 ></TD
     66 ></TR
     67 ></TABLE
     68 ><HR
     69 ALIGN="LEFT"
     70 WIDTH="100%"></DIV
     71 ><DIV
     72 CLASS="SECTION"
     73 ><H1
     74 CLASS="SECTION"
     75 ><A
     76 NAME="OUTPUT"
     77 >4.3. Video Output Interface</A
     78 ></H1
     79 ><P
     80 >Video output devices encode stills or image sequences as
     81 analog video signal. With this interface applications can
     82 control the encoding process and move images from user space to
     83 the driver.</P
     84 ><P
     85 >Conventionally V4L2 video output devices are accessed through
     86 character device special files named <TT
     87 CLASS="FILENAME"
     88 >/dev/video</TT
     89 >
     90 and <TT
     91 CLASS="FILENAME"
     92 >/dev/video0</TT
     93 > to
     94 <TT
     95 CLASS="FILENAME"
     96 >/dev/video63</TT
     97 > with major number 81 and minor
     98 numbers 0 to 63. <TT
     99 CLASS="FILENAME"
    100 >/dev/video</TT
    101 > is typically a
    102 symbolic link to the preferred video device. Note the same device
    103 files are used for video capture devices.</P
    104 ><DIV
    105 CLASS="SECTION"
    106 ><H2
    107 CLASS="SECTION"
    108 ><A
    109 NAME="AEN6839"
    110 >4.3.1. Querying Capabilities</A
    111 ></H2
    112 ><P
    113 >Devices supporting the video output interface set the
    114 <CODE
    115 CLASS="CONSTANT"
    116 >V4L2_CAP_VIDEO_OUTPUT</CODE
    117 > flag in the
    118 <CODE
    119 CLASS="STRUCTFIELD"
    120 >capabilities</CODE
    121 > field of struct&nbsp;<A
    122 HREF="r13105.htm#V4L2-CAPABILITY"
    123 >v4l2_capability</A
    124 >
    125 returned by the <A
    126 HREF="r13105.htm"
    127 ><CODE
    128 CLASS="CONSTANT"
    129 >VIDIOC_QUERYCAP</CODE
    130 ></A
    131 > ioctl. As secondary device functions
    132 they may also support the <A
    133 HREF="x7013.htm"
    134 >raw VBI
    135 output</A
    136 > (<CODE
    137 CLASS="CONSTANT"
    138 >V4L2_CAP_VBI_OUTPUT</CODE
    139 >) interface. At
    140 least one of the read/write or streaming I/O methods must be
    141 supported. Modulators and audio outputs are optional.</P
    142 ></DIV
    143 ><DIV
    144 CLASS="SECTION"
    145 ><H2
    146 CLASS="SECTION"
    147 ><A
    148 NAME="AEN6849"
    149 >4.3.2. Supplemental Functions</A
    150 ></H2
    151 ><P
    152 >Video output devices shall support <A
    153 HREF="x341.htm"
    154 >audio output</A
    155 >, <A
    156 HREF="x394.htm"
    157 >modulator</A
    158 >, <A
    159 HREF="x542.htm"
    160 >controls</A
    161 >,
    162 <A
    163 HREF="x1904.htm"
    164 >cropping and scaling</A
    165 > and <A
    166 HREF="x2009.htm"
    167 >streaming parameter</A
    168 > ioctls as needed.
    169 The <A
    170 HREF="x309.htm"
    171 >video output</A
    172 > and <A
    173 HREF="x448.htm"
    174 >video standard</A
    175 > ioctls must be supported by
    176 all video output devices.</P
    177 ></DIV
    178 ><DIV
    179 CLASS="SECTION"
    180 ><H2
    181 CLASS="SECTION"
    182 ><A
    183 NAME="AEN6859"
    184 >4.3.3. Image Format Negotiation</A
    185 ></H2
    186 ><P
    187 >The output is determined by cropping and image format
    188 parameters. The former select an area of the video picture where the
    189 image will appear, the latter how images are stored in memory, i.&nbsp;e. in
    190 RGB or YUV format, the number of bits per pixel or width and height.
    191 Together they also define how images are scaled in the process.</P
    192 ><P
    193 >As usual these parameters are <SPAN
    194 CLASS="emphasis"
    195 ><I
    196 CLASS="EMPHASIS"
    197 >not</I
    198 ></SPAN
    199 > reset
    200 at <A
    201 HREF="r14090.htm"
    202 ><CODE
    203 CLASS="FUNCTION"
    204 >open()</CODE
    205 ></A
    206 > time to permit Unix tool chains, programming a device
    207 and then writing to it as if it was a plain file. Well written V4L2
    208 applications ensure they really get what they want, including cropping
    209 and scaling.</P
    210 ><P
    211 >Cropping initialization at minimum requires to reset the
    212 parameters to defaults. An example is given in <A
    213 HREF="x1904.htm"
    214 >Section 1.11</A
    215 >.</P
    216 ><P
    217 >To query the current image format applications set the
    218 <CODE
    219 CLASS="STRUCTFIELD"
    220 >type</CODE
    221 > field of a struct&nbsp;<A
    222 HREF="r10944.htm#V4L2-FORMAT"
    223 >v4l2_format</A
    224 > to
    225 <CODE
    226 CLASS="CONSTANT"
    227 >V4L2_BUF_TYPE_VIDEO_OUTPUT</CODE
    228 > and call the
    229 <A
    230 HREF="r10944.htm"
    231 ><CODE
    232 CLASS="CONSTANT"
    233 >VIDIOC_G_FMT</CODE
    234 ></A
    235 > ioctl with a pointer to this structure. Drivers fill
    236 the struct&nbsp;<A
    237 HREF="c2030.htm#V4L2-PIX-FORMAT"
    238 >v4l2_pix_format</A
    239 > <CODE
    240 CLASS="STRUCTFIELD"
    241 >pix</CODE
    242 > member of the
    243 <CODE
    244 CLASS="STRUCTFIELD"
    245 >fmt</CODE
    246 > union.</P
    247 ><P
    248 >To request different parameters applications set the
    249 <CODE
    250 CLASS="STRUCTFIELD"
    251 >type</CODE
    252 > field of a struct&nbsp;<A
    253 HREF="r10944.htm#V4L2-FORMAT"
    254 >v4l2_format</A
    255 > as above and
    256 initialize all fields of the struct&nbsp;<A
    257 HREF="c2030.htm#V4L2-PIX-FORMAT"
    258 >v4l2_pix_format</A
    259 >
    260 <CODE
    261 CLASS="STRUCTFIELD"
    262 >vbi</CODE
    263 > member of the
    264 <CODE
    265 CLASS="STRUCTFIELD"
    266 >fmt</CODE
    267 > union, or better just modify the
    268 results of <CODE
    269 CLASS="CONSTANT"
    270 >VIDIOC_G_FMT</CODE
    271 >, and call the
    272 <A
    273 HREF="r10944.htm"
    274 ><CODE
    275 CLASS="CONSTANT"
    276 >VIDIOC_S_FMT</CODE
    277 ></A
    278 > ioctl with a pointer to this structure. Drivers may
    279 adjust the parameters and finally return the actual parameters as
    280 <CODE
    281 CLASS="CONSTANT"
    282 >VIDIOC_G_FMT</CODE
    283 > does.</P
    284 ><P
    285 >Like <CODE
    286 CLASS="CONSTANT"
    287 >VIDIOC_S_FMT</CODE
    288 > the
    289 <A
    290 HREF="r10944.htm"
    291 ><CODE
    292 CLASS="CONSTANT"
    293 >VIDIOC_TRY_FMT</CODE
    294 ></A
    295 > ioctl can be used to learn about hardware limitations
    296 without disabling I/O or possibly time consuming hardware
    297 preparations.</P
    298 ><P
    299 >The contents of struct&nbsp;<A
    300 HREF="c2030.htm#V4L2-PIX-FORMAT"
    301 >v4l2_pix_format</A
    302 > are discussed in <A
    303 HREF="c2030.htm"
    304 >Chapter 2</A
    305 >. See also the specification of the
    306 <CODE
    307 CLASS="CONSTANT"
    308 >VIDIOC_G_FMT</CODE
    309 >, <CODE
    310 CLASS="CONSTANT"
    311 >VIDIOC_S_FMT</CODE
    312 >
    313 and <CODE
    314 CLASS="CONSTANT"
    315 >VIDIOC_TRY_FMT</CODE
    316 > ioctls for details. Video
    317 output devices must implement both the
    318 <CODE
    319 CLASS="CONSTANT"
    320 >VIDIOC_G_FMT</CODE
    321 > and
    322 <CODE
    323 CLASS="CONSTANT"
    324 >VIDIOC_S_FMT</CODE
    325 > ioctl, even if
    326 <CODE
    327 CLASS="CONSTANT"
    328 >VIDIOC_S_FMT</CODE
    329 > ignores all requests and always
    330 returns default parameters as <CODE
    331 CLASS="CONSTANT"
    332 >VIDIOC_G_FMT</CODE
    333 > does.
    334 <CODE
    335 CLASS="CONSTANT"
    336 >VIDIOC_TRY_FMT</CODE
    337 > is optional.</P
    338 ></DIV
    339 ><DIV
    340 CLASS="SECTION"
    341 ><H2
    342 CLASS="SECTION"
    343 ><A
    344 NAME="AEN6902"
    345 >4.3.4. Writing Images</A
    346 ></H2
    347 ><P
    348 >A video output device may support the <A
    349 HREF="c5742.htm#RW"
    350 >write() function</A
    351 > and/or streaming (<A
    352 HREF="x5791.htm"
    353 >memory mapping</A
    354 > or <A
    355 HREF="x5884.htm"
    356 >user pointer</A
    357 >) I/O. See <A
    358 HREF="c5742.htm"
    359 >Chapter 3</A
    360 > for details.</P
    361 ></DIV
    362 ></DIV
    363 ><DIV
    364 CLASS="NAVFOOTER"
    365 ><HR
    366 ALIGN="LEFT"
    367 WIDTH="100%"><TABLE
    368 SUMMARY="Footer navigation table"
    369 WIDTH="100%"
    370 BORDER="0"
    371 CELLPADDING="0"
    372 CELLSPACING="0"
    373 ><TR
    374 ><TD
    375 WIDTH="33%"
    376 ALIGN="left"
    377 VALIGN="top"
    378 ><A
    379 HREF="x6570.htm"
    380 ACCESSKEY="P"
    381 >Prev</A
    382 ></TD
    383 ><TD
    384 WIDTH="34%"
    385 ALIGN="center"
    386 VALIGN="top"
    387 ><A
    388 HREF="book1.htm"
    389 ACCESSKEY="H"
    390 >Home</A
    391 ></TD
    392 ><TD
    393 WIDTH="33%"
    394 ALIGN="right"
    395 VALIGN="top"
    396 ><A
    397 HREF="x6909.htm"
    398 ACCESSKEY="N"
    399 >Next</A
    400 ></TD
    401 ></TR
    402 ><TR
    403 ><TD
    404 WIDTH="33%"
    405 ALIGN="left"
    406 VALIGN="top"
    407 >Video Overlay Interface</TD
    408 ><TD
    409 WIDTH="34%"
    410 ALIGN="center"
    411 VALIGN="top"
    412 ><A
    413 HREF="c6488.htm"
    414 ACCESSKEY="U"
    415 >Up</A
    416 ></TD
    417 ><TD
    418 WIDTH="33%"
    419 ALIGN="right"
    420 VALIGN="top"
    421 >Video Output Overlay Interface</TD
    422 ></TR
    423 ></TABLE
    424 ></DIV
    425 ></BODY
    426 ></HTML
    427 >
    428