1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Codec Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="devices.html" title="Chapter 4. Interfaces"><link rel="prev" href="osd.html" title="Video Output Overlay Interface"><link rel="next" href="effect.html" title="Effect Devices Interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Codec Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="osd.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Interfaces</th><td width="20%" align="right"> <a accesskey="n" href="effect.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="codec"></a>Codec Interface</h2></div></div></div><p>A V4L2 codec can compress, decompress, transform, or otherwise 2convert video data from one format into another format, in memory. Typically 3such devices are memory-to-memory devices (i.e. devices with the 4<code class="constant">V4L2_CAP_VIDEO_M2M</code> or <code class="constant">V4L2_CAP_VIDEO_M2M_MPLANE</code> 5capability set). 6</p><p>A memory-to-memory video node acts just like a normal video node, but it 7supports both output (sending frames from memory to the codec hardware) and 8capture (receiving the processed frames from the codec hardware into memory) 9stream I/O. An application will have to setup the stream 10I/O for both sides and finally call <a class="link" href="vidioc-streamon.html" title="ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF"><code class="constant">VIDIOC_STREAMON</code></a> for both capture and output 11to start the codec.</p><p>Video compression codecs use the MPEG controls to setup their codec parameters 12(note that the MPEG controls actually support many more codecs than just MPEG). 13See <a class="xref" href="extended-controls.html#mpeg-controls" title="Codec Control Reference">the section called “Codec Control Reference”</a>.</p><p>Memory-to-memory devices can often be used as a shared resource: you can 14open the video node multiple times, each application setting up their own codec properties 15that are local to the file handle, and each can use it independently from the others. 16The driver will arbitrate access to the codec and reprogram it whenever another file 17handler gets access. This is different from the usual video node behavior where the video properties 18are global to the device (i.e. changing something through one file handle is visible 19through another file handle).</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="osd.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="devices.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="effect.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Video Output Overlay Interface </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Effect Devices Interface</td></tr></table></div></body></html> 20