1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Demux Function Calls</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="dvb_demux.html" title="Chapter 10. DVB Demux Device"><link rel="prev" href="dvb_demux.html" title="Chapter 10. DVB Demux Device"><link rel="next" href="dvb_video.html" title="Chapter 11. DVB Video Device"></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">Demux Function Calls</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dvb_demux.html">Prev</a> </td><th width="60%" align="center">Chapter 10. DVB Demux Device</th><td width="20%" align="right"> <a accesskey="n" href="dvb_video.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dmx_fcalls"></a>Demux Function Calls</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="dmx_fcalls.html#dmx_fopen">open()</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#dmx_fclose">close()</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#dmx_fread">read()</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#dmx_fwrite">write()</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_START">DMX_START</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_STOP">DMX_STOP</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_SET_FILTER">DMX_SET_FILTER</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_SET_PES_FILTER">DMX_SET_PES_FILTER</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_SET_BUFFER_SIZE">DMX_SET_BUFFER_SIZE</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_GET_EVENT">DMX_GET_EVENT</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_GET_STC">DMX_GET_STC</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_GET_PES_PIDS">DMX_GET_PES_PIDS</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_GET_CAPS">DMX_GET_CAPS</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_SET_SOURCE">DMX_SET_SOURCE</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_ADD_PID">DMX_ADD_PID</a></span></dt><dt><span class="section"><a href="dmx_fcalls.html#DMX_REMOVE_PID">DMX_REMOVE_PID</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dmx_fopen"></a>open()</h3></div></div></div><p>DESCRIPTION 2</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 3<p>This system call, used with a device name of /dev/dvb/adapter0/demux0, 4 allocates a new filter and returns a handle which can be used for subsequent 5 control of that filter. This call has to be made for each filter to be used, i.e. every 6 returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0 7 is a logical device to be used for retrieving Transport Streams for digital 8 video recording. When reading from this device a transport stream containing 9 the packets from all PES filters set in the corresponding demux device 10 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A 11 recorded Transport Stream is replayed by writing to this device. </p> 12<p>The significance of blocking or non-blocking mode is described in the 13 documentation for functions where there is a difference. It does not affect the 14 semantics of the open() call itself. A device opened in blocking mode can later 15 be put into non-blocking mode (and vice versa) using the F_SETFL command 16 of the fcntl system call.</p> 17</td></tr></tbody></table></div><p>SYNOPSIS 18</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 19<p>int open(const char ⋆deviceName, int flags);</p> 20</td></tr></tbody></table></div><p>PARAMETERS 21</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 22<p>const char 23 *deviceName</p> 24</td><td align="char"> 25<p>Name of demux device.</p> 26</td></tr><tr><td align="char"> 27<p>int flags</p> 28</td><td align="char"> 29<p>A bit-wise OR of the following flags:</p> 30</td></tr><tr><td align="char"> 31</td><td align="char"> 32<p>O_RDWR read/write access</p> 33</td></tr><tr><td align="char"> 34</td><td align="char"> 35<p>O_NONBLOCK open in non-blocking mode</p> 36</td></tr><tr><td align="char"> 37</td><td align="char"> 38<p>(blocking mode is the default)</p> 39</td></tr></tbody></table></div><p>RETURN VALUE</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 40<p>ENODEV</p> 41</td><td align="char"> 42<p>Device driver not loaded/available.</p> 43</td></tr><tr><td align="char"> 44<p>EINVAL</p> 45</td><td align="char"> 46<p>Invalid argument.</p> 47</td></tr><tr><td align="char"> 48<p>EMFILE</p> 49</td><td align="char"> 50<p>“Too many open files”, i.e. no more filters available.</p> 51</td></tr><tr><td align="char"> 52<p>ENOMEM</p> 53</td><td align="char"> 54<p>The driver failed to allocate enough memory.</p> 55</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dmx_fclose"></a>close()</h3></div></div></div><p>DESCRIPTION 56</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 57<p>This system call deactivates and deallocates a filter that was previously 58 allocated via the open() call.</p> 59</td></tr></tbody></table></div><p>SYNOPSIS 60</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 61<p>int close(int fd);</p> 62</td></tr></tbody></table></div><p>PARAMETERS 63</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 64<p>int fd</p> 65</td><td align="char"> 66<p>File descriptor returned by a previous call to open().</p> 67</td></tr></tbody></table></div><p>RETURN VALUE</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 68<p>EBADF</p> 69</td><td align="char"> 70<p>fd is not a valid open file descriptor.</p> 71</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dmx_fread"></a>read()</h3></div></div></div><p>DESCRIPTION 72</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 73<p>This system call returns filtered data, which might be section or PES data. The 74 filtered data is transferred from the driver’s internal circular buffer to buf. The 75 maximum amount of data to be transferred is implied by count.</p> 76</td></tr><tr><td align="char"> 77<p>When returning section data the driver always tries to return a complete single 78 section (even though buf would provide buffer space for more data). If the size 79 of the buffer is smaller than the section as much as possible will be returned, 80 and the remaining data will be provided in subsequent calls.</p> 81</td></tr><tr><td align="char"> 82<p>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum 83 sized sections) by default. The size of this buffer may be changed by using the 84 DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if 85 the read operations are not performed fast enough, this may result in a buffer 86 overflow error. In this case EOVERFLOW will be returned, and the circular 87 buffer will be emptied. This call is blocking if there is no data to return, i.e. the 88 process will be put to sleep waiting for data, unless the O_NONBLOCK flag 89 is specified.</p> 90</td></tr><tr><td align="char"> 91<p>Note that in order to be able to read, the filtering process has to be started 92 by defining either a section or a PES filter by means of the ioctl functions, 93 and then starting the filtering process via the DMX_START ioctl function 94 or by setting the DMX_IMMEDIATE_START flag. If the reading is done 95 from a logical DVR demux device, the data will constitute a Transport Stream 96 including the packets from all PES filters in the corresponding demux device 97 /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</p> 98</td></tr></tbody></table></div><p>SYNOPSIS 99</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 100<p>size_t read(int fd, void ⋆buf, size_t count);</p> 101</td></tr></tbody></table></div><p>PARAMETERS 102</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 103<p>int fd</p> 104</td><td align="char"> 105<p>File descriptor returned by a previous call to open().</p> 106</td></tr><tr><td align="char"> 107<p>void *buf</p> 108</td><td align="char"> 109<p>Pointer to the buffer to be used for returned filtered data.</p> 110</td></tr><tr><td align="char"> 111<p>size_t count</p> 112</td><td align="char"> 113<p>Size of buf.</p> 114</td></tr></tbody></table></div><p>RETURN VALUE</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 115<p>EWOULDBLOCK</p> 116</td><td align="char"> 117<p>No data to return and O_NONBLOCK was specified.</p> 118</td></tr><tr><td align="char"> 119<p>EBADF</p> 120</td><td align="char"> 121<p>fd is not a valid open file descriptor.</p> 122</td></tr><tr><td align="char"> 123<p>ECRC</p> 124</td><td align="char"> 125<p>Last section had a CRC error - no data returned. The 126 buffer is flushed.</p> 127</td></tr><tr><td align="char"> 128<p>EOVERFLOW</p> 129</td><td align="char"> 130</td></tr><tr><td align="char"> 131</td><td align="char"> 132<p>The filtered data was not read from the buffer in due 133 time, resulting in non-read data being lost. The buffer is 134 flushed.</p> 135</td></tr><tr><td align="char"> 136<p>ETIMEDOUT</p> 137</td><td align="char"> 138<p>The section was not loaded within the stated timeout 139 period. See ioctl DMX_SET_FILTER for how to set a 140 timeout.</p> 141</td></tr><tr><td align="char"> 142<p>EFAULT</p> 143</td><td align="char"> 144<p>The driver failed to write to the callers buffer due to an 145 invalid *buf pointer.</p> 146</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dmx_fwrite"></a>write()</h3></div></div></div><p>DESCRIPTION 147</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 148<p>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0, 149 associated with the physical demux device that provides the actual DVR 150 functionality. It is used for replay of a digitally recorded Transport Stream. 151 Matching filters have to be defined in the corresponding physical demux 152 device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is 153 implied by count.</p> 154</td></tr></tbody></table></div><p>SYNOPSIS 155</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 156<p>ssize_t write(int fd, const void ⋆buf, size_t 157 count);</p> 158</td></tr></tbody></table></div><p>PARAMETERS 159</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 160<p>int fd</p> 161</td><td align="char"> 162<p>File descriptor returned by a previous call to open().</p> 163</td></tr><tr><td align="char"> 164<p>void *buf</p> 165</td><td align="char"> 166<p>Pointer to the buffer containing the Transport Stream.</p> 167</td></tr><tr><td align="char"> 168<p>size_t count</p> 169</td><td align="char"> 170<p>Size of buf.</p> 171</td></tr></tbody></table></div><p>RETURN VALUE</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 172<p>EWOULDBLOCK</p> 173</td><td align="char"> 174<p>No data was written. This 175 might happen if O_NONBLOCK was specified and there 176 is no more buffer space available (if O_NONBLOCK is 177 not specified the function will block until buffer space is 178 available).</p> 179</td></tr><tr><td align="char"> 180<p>EBUSY</p> 181</td><td align="char"> 182<p>This error code indicates that there are conflicting 183 requests. The corresponding demux device is setup to 184 receive data from the front- end. Make sure that these 185 filters are stopped and that the filters with input set to 186 DMX_IN_DVR are started.</p> 187</td></tr><tr><td align="char"> 188<p>EBADF</p> 189</td><td align="char"> 190<p>fd is not a valid open file descriptor.</p> 191</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_START"></a>DMX_START</h3></div></div></div><p>DESCRIPTION 192</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 193<p>This ioctl call is used to start the actual filtering operation defined via the ioctl 194 calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</p> 195</td></tr></tbody></table></div><p>SYNOPSIS 196</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 197<p>int ioctl( int fd, int request = DMX_START);</p> 198</td></tr></tbody></table></div><p>PARAMETERS 199</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 200<p>int fd</p> 201</td><td align="char"> 202<p>File descriptor returned by a previous call to open().</p> 203</td></tr><tr><td align="char"> 204<p>int request</p> 205</td><td align="char"> 206<p>Equals DMX_START for this command.</p> 207</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 208<p>EINVAL</p> 209</td><td align="char"> 210<p>Invalid argument, i.e. no filtering parameters provided via 211 the DMX_SET_FILTER or DMX_SET_PES_FILTER 212 functions.</p> 213</td></tr><tr><td align="char"> 214<p>EBUSY</p> 215</td><td align="char"> 216<p>This error code indicates that there are conflicting 217 requests. There are active filters filtering data from 218 another input source. Make sure that these filters are 219 stopped before starting this filter.</p> 220</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_STOP"></a>DMX_STOP</h3></div></div></div><p>DESCRIPTION 221</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 222<p>This ioctl call is used to stop the actual filtering operation defined via the 223 ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via 224 the DMX_START command.</p> 225</td></tr></tbody></table></div><p>SYNOPSIS 226</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 227<p>int ioctl( int fd, int request = DMX_STOP);</p> 228</td></tr></tbody></table></div><p>PARAMETERS 229</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 230<p>int fd</p> 231</td><td align="char"> 232<p>File descriptor returned by a previous call to open().</p> 233</td></tr><tr><td align="char"> 234<p>int request</p> 235</td><td align="char"> 236<p>Equals DMX_STOP for this command.</p> 237</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_SET_FILTER"></a>DMX_SET_FILTER</h3></div></div></div><p>DESCRIPTION 238</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 239<p>This ioctl call sets up a filter according to the filter and mask parameters 240 provided. A timeout may be defined stating number of seconds to wait for a 241 section to be loaded. A value of 0 means that no timeout should be applied. 242 Finally there is a flag field where it is possible to state whether a section should 243 be CRC-checked, whether the filter should be a ”one-shot” filter, i.e. if the 244 filtering operation should be stopped after the first section is received, and 245 whether the filtering operation should be started immediately (without waiting 246 for a DMX_START ioctl call). If a filter was previously set-up, this filter will 247 be canceled, and the receive buffer will be flushed.</p> 248</td></tr></tbody></table></div><p>SYNOPSIS 249</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 250<p>int ioctl( int fd, int request = DMX_SET_FILTER, 251 struct dmx_sct_filter_params ⋆params);</p> 252</td></tr></tbody></table></div><p>PARAMETERS 253</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 254<p>int fd</p> 255</td><td align="char"> 256<p>File descriptor returned by a previous call to open().</p> 257</td></tr><tr><td align="char"> 258<p>int request</p> 259</td><td align="char"> 260<p>Equals DMX_SET_FILTER for this command.</p> 261</td></tr><tr><td align="char"> 262<p>struct 263 dmx_sct_filter_params 264 *params</p> 265</td><td align="char"> 266<p>Pointer to structure containing filter parameters.</p> 267</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_SET_PES_FILTER"></a>DMX_SET_PES_FILTER</h3></div></div></div><p>DESCRIPTION 268</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 269<p>This ioctl call sets up a PES filter according to the parameters provided. By a 270 PES filter is meant a filter that is based just on the packet identifier (PID), i.e. 271 no PES header or payload filtering capability is supported.</p> 272</td></tr><tr><td align="char"> 273<p>The transport stream destination for the filtered output may be set. Also the 274 PES type may be stated in order to be able to e.g. direct a video stream directly 275 to the video decoder. Finally there is a flag field where it is possible to state 276 whether the filtering operation should be started immediately (without waiting 277 for a DMX_START ioctl call). If a filter was previously set-up, this filter will 278 be cancelled, and the receive buffer will be flushed.</p> 279</td></tr></tbody></table></div><p>SYNOPSIS 280</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 281<p>int ioctl( int fd, int request = DMX_SET_PES_FILTER, 282 struct dmx_pes_filter_params ⋆params);</p> 283</td></tr></tbody></table></div><p>PARAMETERS 284</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 285<p>int fd</p> 286</td><td align="char"> 287<p>File descriptor returned by a previous call to open().</p> 288</td></tr><tr><td align="char"> 289<p>int request</p> 290</td><td align="char"> 291<p>Equals DMX_SET_PES_FILTER for this command.</p> 292</td></tr><tr><td align="char"> 293<p>struct 294 dmx_pes_filter_params 295 *params</p> 296</td><td align="char"> 297<p>Pointer to structure containing filter parameters.</p> 298</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 299<p>EBUSY</p> 300</td><td align="char"> 301<p>This error code indicates that there are conflicting 302 requests. There are active filters filtering data from 303 another input source. Make sure that these filters are 304 stopped before starting this filter.</p> 305</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_SET_BUFFER_SIZE"></a>DMX_SET_BUFFER_SIZE</h3></div></div></div><p>DESCRIPTION 306</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 307<p>This ioctl call is used to set the size of the circular buffer used for filtered data. 308 The default size is two maximum sized sections, i.e. if this function is not called 309 a buffer size of 2 * 4096 bytes will be used.</p> 310</td></tr></tbody></table></div><p>SYNOPSIS 311</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 312<p>int ioctl( int fd, int request = 313 DMX_SET_BUFFER_SIZE, unsigned long size);</p> 314</td></tr></tbody></table></div><p>PARAMETERS 315</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 316<p>int fd</p> 317</td><td align="char"> 318<p>File descriptor returned by a previous call to open().</p> 319</td></tr><tr><td align="char"> 320<p>int request</p> 321</td><td align="char"> 322<p>Equals DMX_SET_BUFFER_SIZE for this command.</p> 323</td></tr><tr><td align="char"> 324<p>unsigned long size</p> 325</td><td align="char"> 326<p>Size of circular buffer.</p> 327</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_GET_EVENT"></a>DMX_GET_EVENT</h3></div></div></div><p>DESCRIPTION 328</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 329<p>This ioctl call returns an event if available. If an event is not available, 330 the behavior depends on whether the device is in blocking or non-blocking 331 mode. In the latter case, the call fails immediately with errno set to 332 EWOULDBLOCK. In the former case, the call blocks until an event becomes 333 available.</p> 334</td></tr><tr><td align="char"> 335<p>The standard Linux poll() and/or select() system calls can be used with the 336 device file descriptor to watch for new events. For select(), the file descriptor 337 should be included in the exceptfds argument, and for poll(), POLLPRI should 338 be specified as the wake-up condition. Only the latest event for each filter is 339 saved.</p> 340</td></tr></tbody></table></div><p>SYNOPSIS 341</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 342<p>int ioctl( int fd, int request = DMX_GET_EVENT, 343 struct dmx_event ⋆ev);</p> 344</td></tr></tbody></table></div><p>PARAMETERS 345</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 346<p>int fd</p> 347</td><td align="char"> 348<p>File descriptor returned by a previous call to open().</p> 349</td></tr><tr><td align="char"> 350<p>int request</p> 351</td><td align="char"> 352<p>Equals DMX_GET_EVENT for this command.</p> 353</td></tr><tr><td align="char"> 354<p>struct dmx_event *ev</p> 355</td><td align="char"> 356<p>Pointer to the location where the event is to be stored.</p> 357</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 358<p>EWOULDBLOCK</p> 359</td><td align="char"> 360<p>There is no event pending, and the device is in 361 non-blocking mode.</p> 362</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_GET_STC"></a>DMX_GET_STC</h3></div></div></div><p>DESCRIPTION 363</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 364<p>This ioctl call returns the current value of the system time counter (which is driven 365 by a PES filter of type DMX_PES_PCR). Some hardware supports more than one 366 STC, so you must specify which one by setting the num field of stc before the ioctl 367 (range 0...n). The result is returned in form of a ratio with a 64 bit numerator 368 and a 32 bit denominator, so the real 90kHz STC value is stc->stc / 369 stc->base 370 .</p> 371</td></tr></tbody></table></div><p>SYNOPSIS 372</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 373<p>int ioctl( int fd, int request = DMX_GET_STC, struct 374 dmx_stc ⋆stc);</p> 375</td></tr></tbody></table></div><p>PARAMETERS 376</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 377<p>int fd</p> 378</td><td align="char"> 379<p>File descriptor returned by a previous call to open().</p> 380</td></tr><tr><td align="char"> 381<p>int request</p> 382</td><td align="char"> 383<p>Equals DMX_GET_STC for this command.</p> 384</td></tr><tr><td align="char"> 385<p>struct dmx_stc *stc</p> 386</td><td align="char"> 387<p>Pointer to the location where the stc is to be stored.</p> 388</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 389<p>EINVAL</p> 390</td><td align="char"> 391<p>Invalid stc number.</p> 392</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_GET_PES_PIDS"></a>DMX_GET_PES_PIDS</h3></div></div></div><p>DESCRIPTION 393</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 394<p>This ioctl is undocumented. Documentation is welcome.</p> 395</td></tr></tbody></table></div><p>SYNOPSIS 396</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 397<p>int ioctl(fd, int request = DMX_GET_PES_PIDS, 398 __u16[5]);</p> 399</td></tr></tbody></table></div><p>PARAMETERS 400</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 401<p>int fd</p> 402</td><td align="char"> 403<p>File descriptor returned by a previous call to open().</p> 404</td></tr><tr><td align="char"> 405<p>int request</p> 406</td><td align="char"> 407<p>Equals DMX_GET_PES_PIDS for this command.</p> 408</td></tr><tr><td align="char"> 409<p>__u16[5] 410</p> 411</td><td align="char"> 412<p>Undocumented.</p> 413</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_GET_CAPS"></a>DMX_GET_CAPS</h3></div></div></div><p>DESCRIPTION 414</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 415<p>This ioctl is undocumented. Documentation is welcome.</p> 416</td></tr></tbody></table></div><p>SYNOPSIS 417</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 418<p>int ioctl(fd, int request = DMX_GET_CAPS, 419 dmx_caps_t *);</p> 420</td></tr></tbody></table></div><p>PARAMETERS 421</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 422<p>int fd</p> 423</td><td align="char"> 424<p>File descriptor returned by a previous call to open().</p> 425</td></tr><tr><td align="char"> 426<p>int request</p> 427</td><td align="char"> 428<p>Equals DMX_GET_CAPS for this command.</p> 429</td></tr><tr><td align="char"> 430<p>dmx_caps_t * 431</p> 432</td><td align="char"> 433<p>Undocumented.</p> 434</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_SET_SOURCE"></a>DMX_SET_SOURCE</h3></div></div></div><p>DESCRIPTION 435</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 436<p>This ioctl is undocumented. Documentation is welcome.</p> 437</td></tr></tbody></table></div><p>SYNOPSIS 438</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 439<p>int ioctl(fd, int request = DMX_SET_SOURCE, 440 dmx_source_t *);</p> 441</td></tr></tbody></table></div><p>PARAMETERS 442</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 443<p>int fd</p> 444</td><td align="char"> 445<p>File descriptor returned by a previous call to open().</p> 446</td></tr><tr><td align="char"> 447<p>int request</p> 448</td><td align="char"> 449<p>Equals DMX_SET_SOURCE for this command.</p> 450</td></tr><tr><td align="char"> 451<p>dmx_source_t * 452</p> 453</td><td align="char"> 454<p>Undocumented.</p> 455</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_ADD_PID"></a>DMX_ADD_PID</h3></div></div></div><p>DESCRIPTION 456</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 457<p>This ioctl call allows to add multiple PIDs to a transport stream filter 458previously set up with DMX_SET_PES_FILTER and output equal to DMX_OUT_TSDEMUX_TAP. 459</p></td></tr><tr><td align="char"><p> 460It is used by readers of /dev/dvb/adapterX/demuxY. 461</p></td></tr><tr><td align="char"><p> 462It may be called at any time, i.e. before or after the first filter on the 463shared file descriptor was started. It makes it possible to record multiple 464services without the need to de-multiplex or re-multiplex TS packets.</p> 465</td></tr></tbody></table></div><p>SYNOPSIS 466</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 467<p>int ioctl(fd, int request = DMX_ADD_PID, 468 __u16 *);</p> 469</td></tr></tbody></table></div><p>PARAMETERS 470</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 471<p>int fd</p> 472</td><td align="char"> 473<p>File descriptor returned by a previous call to open().</p> 474</td></tr><tr><td align="char"> 475<p>int request</p> 476</td><td align="char"> 477<p>Equals DMX_ADD_PID for this command.</p> 478</td></tr><tr><td align="char"> 479<p>__u16 * 480</p> 481</td><td align="char"> 482<p>PID number to be filtered.</p> 483</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="DMX_REMOVE_PID"></a>DMX_REMOVE_PID</h3></div></div></div><p>DESCRIPTION 484</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 485<p>This ioctl call allows to remove a PID when multiple PIDs are set on a 486transport stream filter, e. g. a filter previously set up with output equal to 487DMX_OUT_TSDEMUX_TAP, created via either DMX_SET_PES_FILTER or DMX_ADD_PID. 488</p></td></tr><tr><td align="char"><p> 489It is used by readers of /dev/dvb/adapterX/demuxY. 490</p></td></tr><tr><td align="char"><p> 491It may be called at any time, i.e. before or after the first filter on the 492shared file descriptor was started. It makes it possible to record multiple 493services without the need to de-multiplex or re-multiplex TS packets.</p> 494</td></tr></tbody></table></div><p>SYNOPSIS 495</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 496<p>int ioctl(fd, int request = DMX_REMOVE_PID, 497 __u16 *);</p> 498</td></tr></tbody></table></div><p>PARAMETERS 499</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 500<p>int fd</p> 501</td><td align="char"> 502<p>File descriptor returned by a previous call to open().</p> 503</td></tr><tr><td align="char"> 504<p>int request</p> 505</td><td align="char"> 506<p>Equals DMX_REMOVE_PID for this command.</p> 507</td></tr><tr><td align="char"> 508<p>__u16 * 509</p> 510</td><td align="char"> 511<p>PID of the PES filter to be removed.</p> 512</td></tr></tbody></table></div><p>RETURN VALUE</p><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dvb_demux.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dvb_demux.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dvb_video.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. DVB Demux Device </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. DVB Video Device</td></tr></table></div></body></html> 513