1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Demux API</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_kdapi.html" title="Chapter 15. Kernel Demux API"><link rel="prev" href="demux_directory_api.html" title="Demux Directory API"><link rel="next" href="demux_callback_api.html" title="Demux Callback API"></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 API</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="demux_directory_api.html">Prev</a> </td><th width="60%" align="center">Chapter 15. Kernel Demux API</th><td width="20%" align="right"> <a accesskey="n" href="demux_callback_api.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="demux_api"></a>Demux API</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="demux_api.html#kdapi_fopen">open()</a></span></dt><dt><span class="section"><a href="demux_api.html#kdapi_fclose">close()</a></span></dt><dt><span class="section"><a href="demux_api.html#kdapi_fwrite">write()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130795524">allocate_ts_feed()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130807564">release_ts_feed()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130816124">allocate_section_feed()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130828540">release_section_feed()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130837164">descramble_mac_address()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130851812">descramble_section_payload()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130868660">add_frontend()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130880988">remove_frontend()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130891156">get_frontends()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130898500">connect_frontend()</a></span></dt><dt><span class="section"><a href="demux_api.html#idp1130909076">disconnect_frontend()</a></span></dt></dl></div><p>The demux API should be implemented for each demux in the system. It is used to select 2the TS source of a demux and to manage the demux resources. When the demux 3client allocates a resource via the demux API, it receives a pointer to the API of that 4resource. 5</p><p>Each demux receives its TS input from a DVB front-end or from memory, as set via the 6demux API. In a system with more than one front-end, the API can be used to select one of 7the DVB front-ends as a TS source for a demux, unless this is fixed in the HW platform. The 8demux API only controls front-ends regarding their connections with demuxes; the APIs 9used to set the other front-end parameters, such as tuning, are not defined in this 10document. 11</p><p>The functions that implement the abstract interface demux should be defined static or 12module private and registered to the Demux Directory for external access. It is not necessary 13to implement every function in the demux_t struct, however (for example, a demux interface 14might support Section filtering, but not TS or PES filtering). The API client is expected to 15check the value of any function pointer before calling the function: the value of NULL means 16“function not available”. 17</p><p>Whenever the functions of the demux API modify shared data, the possibilities of lost 18update and race condition problems should be addressed, e.g. by protecting parts of code with 19mutexes. This is especially important on multi-processor hosts. 20</p><p>Note that functions called from a bottom half context must not sleep, at least in the 2.2.x 21kernels. Even a simple memory allocation can result in a kernel thread being put to sleep if 22swapping is needed. For example, the Linux kernel calls the functions of a network device 23interface from a bottom half context. Thus, if a demux API function is called from network 24device code, the function must not sleep. 25</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="kdapi_fopen"></a>open()</h3></div></div></div><p>DESCRIPTION 26</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 27<p>This function reserves the demux for use by the caller and, if necessary, 28 initializes the demux. When the demux is no longer needed, the function close() 29 should be called. It should be possible for multiple clients to access the demux 30 at the same time. Thus, the function implementation should increment the 31 demux usage count when open() is called and decrement it when close() is 32 called.</p> 33</td></tr></tbody></table></div><p>SYNOPSIS 34</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 35<p>int open ( demux_t⋆ demux );</p> 36</td></tr></tbody></table></div><p>PARAMETERS 37</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 38<p>demux_t* demux</p> 39</td><td align="char"> 40<p>Pointer to the demux API and instance data.</p> 41</td></tr></tbody></table></div><p>RETURNS 42</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 43<p>0</p> 44</td><td align="char"> 45<p>The function was completed without errors.</p> 46</td></tr><tr><td align="char"> 47<p>-EUSERS</p> 48</td><td align="char"> 49<p>Maximum usage count reached.</p> 50</td></tr><tr><td align="char"> 51<p>-EINVAL</p> 52</td><td align="char"> 53<p>Bad parameter.</p> 54</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="kdapi_fclose"></a>close()</h3></div></div></div><p>DESCRIPTION 55</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 56<p>This function reserves the demux for use by the caller and, if necessary, 57 initializes the demux. When the demux is no longer needed, the function close() 58 should be called. It should be possible for multiple clients to access the demux 59 at the same time. Thus, the function implementation should increment the 60 demux usage count when open() is called and decrement it when close() is 61 called.</p> 62</td></tr></tbody></table></div><p>SYNOPSIS 63</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 64<p>int close(demux_t⋆ demux);</p> 65</td></tr></tbody></table></div><p>PARAMETERS 66</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 67<p>demux_t* demux</p> 68</td><td align="char"> 69<p>Pointer to the demux API and instance data.</p> 70</td></tr></tbody></table></div><p>RETURNS 71</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 72<p>0</p> 73</td><td align="char"> 74<p>The function was completed without errors.</p> 75</td></tr><tr><td align="char"> 76<p>-ENODEV</p> 77</td><td align="char"> 78<p>The demux was not in use.</p> 79</td></tr><tr><td align="char"> 80<p>-EINVAL</p> 81</td><td align="char"> 82<p>Bad parameter.</p> 83</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="kdapi_fwrite"></a>write()</h3></div></div></div><p>DESCRIPTION 84</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 85<p>This function provides the demux driver with a memory buffer containing TS 86 packets. Instead of receiving TS packets from the DVB front-end, the demux 87 driver software will read packets from memory. Any clients of this demux 88 with active TS, PES or Section filters will receive filtered data via the Demux 89 callback API (see 0). The function returns when all the data in the buffer has 90 been consumed by the demux. Demux hardware typically cannot read TS from 91 memory. If this is the case, memory-based filtering has to be implemented 92 entirely in software.</p> 93</td></tr></tbody></table></div><p>SYNOPSIS 94</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 95<p>int write(demux_t⋆ demux, const char⋆ buf, size_t 96 count);</p> 97</td></tr></tbody></table></div><p>PARAMETERS 98</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 99<p>demux_t* demux</p> 100</td><td align="char"> 101<p>Pointer to the demux API and instance data.</p> 102</td></tr><tr><td align="char"> 103<p>const char* buf</p> 104</td><td align="char"> 105<p>Pointer to the TS data in kernel-space memory.</p> 106</td></tr><tr><td align="char"> 107<p>size_t length</p> 108</td><td align="char"> 109<p>Length of the TS data.</p> 110</td></tr></tbody></table></div><p>RETURNS 111</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 112<p>0</p> 113</td><td align="char"> 114<p>The function was completed without errors.</p> 115</td></tr><tr><td align="char"> 116<p>-ENOSYS</p> 117</td><td align="char"> 118<p>The command is not implemented.</p> 119</td></tr><tr><td align="char"> 120<p>-EINVAL</p> 121</td><td align="char"> 122<p>Bad parameter.</p> 123</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130795524"></a>allocate_ts_feed()</h3></div></div></div><p>DESCRIPTION 124</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 125<p>Allocates a new TS feed, which is used to filter the TS packets carrying a 126 certain PID. The TS feed normally corresponds to a hardware PID filter on the 127 demux chip.</p> 128</td></tr></tbody></table></div><p>SYNOPSIS 129</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 130<p>int allocate_ts_feed(dmx_demux_t⋆ demux, 131 dmx_ts_feed_t⋆⋆ feed, dmx_ts_cb callback);</p> 132</td></tr></tbody></table></div><p>PARAMETERS 133</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 134<p>demux_t* demux</p> 135</td><td align="char"> 136<p>Pointer to the demux API and instance data.</p> 137</td></tr><tr><td align="char"> 138<p>dmx_ts_feed_t** 139 feed</p> 140</td><td align="char"> 141<p>Pointer to the TS feed API and instance data.</p> 142</td></tr><tr><td align="char"> 143<p>dmx_ts_cb callback</p> 144</td><td align="char"> 145<p>Pointer to the callback function for passing received TS 146 packet</p> 147</td></tr></tbody></table></div><p>RETURNS 148</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 149<p>0</p> 150</td><td align="char"> 151<p>The function was completed without errors.</p> 152</td></tr><tr><td align="char"> 153<p>-EBUSY</p> 154</td><td align="char"> 155<p>No more TS feeds available.</p> 156</td></tr><tr><td align="char"> 157<p>-ENOSYS</p> 158</td><td align="char"> 159<p>The command is not implemented.</p> 160</td></tr><tr><td align="char"> 161<p>-EINVAL</p> 162</td><td align="char"> 163<p>Bad parameter.</p> 164</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130807564"></a>release_ts_feed()</h3></div></div></div><p>DESCRIPTION 165</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 166<p>Releases the resources allocated with allocate_ts_feed(). Any filtering in 167 progress on the TS feed should be stopped before calling this function.</p> 168</td></tr></tbody></table></div><p>SYNOPSIS 169</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 170<p>int release_ts_feed(dmx_demux_t⋆ demux, 171 dmx_ts_feed_t⋆ feed);</p> 172</td></tr></tbody></table></div><p>PARAMETERS 173</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 174<p>demux_t* demux</p> 175</td><td align="char"> 176<p>Pointer to the demux API and instance data.</p> 177</td></tr><tr><td align="char"> 178<p>dmx_ts_feed_t* feed</p> 179</td><td align="char"> 180<p>Pointer to the TS feed API and instance data.</p> 181</td></tr></tbody></table></div><p>RETURNS 182</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 183<p>0</p> 184</td><td align="char"> 185<p>The function was completed without errors.</p> 186</td></tr><tr><td align="char"> 187<p>-EINVAL</p> 188</td><td align="char"> 189<p>Bad parameter.</p> 190</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130816124"></a>allocate_section_feed()</h3></div></div></div><p>DESCRIPTION 191</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 192<p>Allocates a new section feed, i.e. a demux resource for filtering and receiving 193 sections. On platforms with hardware support for section filtering, a section 194 feed is directly mapped to the demux HW. On other platforms, TS packets are 195 first PID filtered in hardware and a hardware section filter then emulated in 196 software. The caller obtains an API pointer of type dmx_section_feed_t as an 197 out parameter. Using this API the caller can set filtering parameters and start 198 receiving sections.</p> 199</td></tr></tbody></table></div><p>SYNOPSIS 200</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 201<p>int allocate_section_feed(dmx_demux_t⋆ demux, 202 dmx_section_feed_t ⋆⋆feed, dmx_section_cb callback);</p> 203</td></tr></tbody></table></div><p>PARAMETERS 204</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 205<p>demux_t *demux</p> 206</td><td align="char"> 207<p>Pointer to the demux API and instance data.</p> 208</td></tr><tr><td align="char"> 209<p>dmx_section_feed_t 210 **feed</p> 211</td><td align="char"> 212<p>Pointer to the section feed API and instance data.</p> 213</td></tr><tr><td align="char"> 214<p>dmx_section_cb 215 callback</p> 216</td><td align="char"> 217<p>Pointer to the callback function for passing received 218 sections.</p> 219</td></tr></tbody></table></div><p>RETURNS 220</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 221<p>0</p> 222</td><td align="char"> 223<p>The function was completed without errors.</p> 224</td></tr><tr><td align="char"> 225<p>-EBUSY</p> 226</td><td align="char"> 227<p>No more section feeds available.</p> 228</td></tr><tr><td align="char"> 229<p>-ENOSYS</p> 230</td><td align="char"> 231<p>The command is not implemented.</p> 232</td></tr><tr><td align="char"> 233<p>-EINVAL</p> 234</td><td align="char"> 235<p>Bad parameter.</p> 236</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130828540"></a>release_section_feed()</h3></div></div></div><p>DESCRIPTION 237</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 238<p>Releases the resources allocated with allocate_section_feed(), including 239 allocated filters. Any filtering in progress on the section feed should be stopped 240 before calling this function.</p> 241</td></tr></tbody></table></div><p>SYNOPSIS 242</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 243<p>int release_section_feed(dmx_demux_t⋆ demux, 244 dmx_section_feed_t ⋆feed);</p> 245</td></tr></tbody></table></div><p>PARAMETERS 246</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 247<p>demux_t *demux</p> 248</td><td align="char"> 249<p>Pointer to the demux API and instance data.</p> 250</td></tr><tr><td align="char"> 251<p>dmx_section_feed_t 252 *feed</p> 253</td><td align="char"> 254<p>Pointer to the section feed API and instance data.</p> 255</td></tr></tbody></table></div><p>RETURNS 256</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 257<p>0</p> 258</td><td align="char"> 259<p>The function was completed without errors.</p> 260</td></tr><tr><td align="char"> 261<p>-EINVAL</p> 262</td><td align="char"> 263<p>Bad parameter.</p> 264</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130837164"></a>descramble_mac_address()</h3></div></div></div><p>DESCRIPTION 265</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 266<p>This function runs a descrambling algorithm on the destination MAC 267 address field of a DVB Datagram Section, replacing the original address 268 with its un-encrypted version. Otherwise, the description on the function 269 descramble_section_payload() applies also to this function.</p> 270</td></tr></tbody></table></div><p>SYNOPSIS 271</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 272<p>int descramble_mac_address(dmx_demux_t⋆ demux, __u8 273 ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, 274 size_t buffer2_length, __u16 pid);</p> 275</td></tr></tbody></table></div><p>PARAMETERS 276</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 277<p>dmx_demux_t 278 *demux</p> 279</td><td align="char"> 280<p>Pointer to the demux API and instance data.</p> 281</td></tr><tr><td align="char"> 282<p>__u8 *buffer1</p> 283</td><td align="char"> 284<p>Pointer to the first byte of the section.</p> 285</td></tr><tr><td align="char"> 286<p>size_t buffer1_length</p> 287</td><td align="char"> 288<p>Length of the section data, including headers and CRC, 289 in buffer1.</p> 290</td></tr><tr><td align="char"> 291<p>__u8* buffer2</p> 292</td><td align="char"> 293<p>Pointer to the tail of the section data, or NULL. The 294 pointer has a non-NULL value if the section wraps past 295 the end of a circular buffer.</p> 296</td></tr><tr><td align="char"> 297<p>size_t buffer2_length</p> 298</td><td align="char"> 299<p>Length of the section data, including headers and CRC, 300 in buffer2.</p> 301</td></tr><tr><td align="char"> 302<p>__u16 pid</p> 303</td><td align="char"> 304<p>The PID on which the section was received. Useful 305 for obtaining the descrambling key, e.g. from a DVB 306 Common Access facility.</p> 307</td></tr></tbody></table></div><p>RETURNS 308</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 309<p>0</p> 310</td><td align="char"> 311<p>The function was completed without errors.</p> 312</td></tr><tr><td align="char"> 313<p>-ENOSYS</p> 314</td><td align="char"> 315<p>No descrambling facility available.</p> 316</td></tr><tr><td align="char"> 317<p>-EINVAL</p> 318</td><td align="char"> 319<p>Bad parameter.</p> 320</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130851812"></a>descramble_section_payload()</h3></div></div></div><p>DESCRIPTION 321</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 322<p>This function runs a descrambling algorithm on the payload of a DVB 323 Datagram Section, replacing the original payload with its un-encrypted 324 version. The function will be called from the demux API implementation; 325 the API client need not call this function directly. Section-level scrambling 326 algorithms are currently standardized only for DVB-RCC (return channel 327 over 2-directional cable TV network) systems. For all other DVB networks, 328 encryption schemes are likely to be proprietary to each data broadcaster. Thus, 329 it is expected that this function pointer will have the value of NULL (i.e., 330 function not available) in most demux API implementations. Nevertheless, it 331 should be possible to use the function pointer as a hook for dynamically adding 332 a “plug-in” descrambling facility to a demux driver.</p> 333</td></tr><tr><td align="char"> 334<p>While this function is not needed with hardware-based section descrambling, 335 the descramble_section_payload function pointer can be used to override the 336 default hardware-based descrambling algorithm: if the function pointer has a 337 non-NULL value, the corresponding function should be used instead of any 338 descrambling hardware.</p> 339</td></tr></tbody></table></div><p>SYNOPSIS 340</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 341<p>int descramble_section_payload(dmx_demux_t⋆ demux, 342 __u8 ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, 343 size_t buffer2_length, __u16 pid);</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>dmx_demux_t 347 *demux</p> 348</td><td align="char"> 349<p>Pointer to the demux API and instance data.</p> 350</td></tr><tr><td align="char"> 351<p>__u8 *buffer1</p> 352</td><td align="char"> 353<p>Pointer to the first byte of the section.</p> 354</td></tr><tr><td align="char"> 355<p>size_t buffer1_length</p> 356</td><td align="char"> 357<p>Length of the section data, including headers and CRC, 358 in buffer1.</p> 359</td></tr><tr><td align="char"> 360<p>__u8 *buffer2</p> 361</td><td align="char"> 362<p>Pointer to the tail of the section data, or NULL. The 363 pointer has a non-NULL value if the section wraps past 364 the end of a circular buffer.</p> 365</td></tr><tr><td align="char"> 366<p>size_t buffer2_length</p> 367</td><td align="char"> 368<p>Length of the section data, including headers and CRC, 369 in buffer2.</p> 370</td></tr><tr><td align="char"> 371<p>__u16 pid</p> 372</td><td align="char"> 373<p>The PID on which the section was received. Useful 374 for obtaining the descrambling key, e.g. from a DVB 375 Common Access facility.</p> 376</td></tr></tbody></table></div><p>RETURNS 377</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 378<p>0</p> 379</td><td align="char"> 380<p>The function was completed without errors.</p> 381</td></tr><tr><td align="char"> 382<p>-ENOSYS</p> 383</td><td align="char"> 384<p>No descrambling facility available.</p> 385</td></tr><tr><td align="char"> 386<p>-EINVAL</p> 387</td><td align="char"> 388<p>Bad parameter.</p> 389</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130868660"></a>add_frontend()</h3></div></div></div><p>DESCRIPTION 390</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 391<p>Registers a connectivity between a demux and a front-end, i.e., indicates that 392 the demux can be connected via a call to connect_frontend() to use the given 393 front-end as a TS source. The client of this function has to allocate dynamic or 394 static memory for the frontend structure and initialize its fields before calling 395 this function. This function is normally called during the driver initialization. 396 The caller must not free the memory of the frontend struct before successfully 397 calling remove_frontend().</p> 398</td></tr></tbody></table></div><p>SYNOPSIS 399</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 400<p>int add_frontend(dmx_demux_t ⋆demux, dmx_frontend_t 401 ⋆frontend);</p> 402</td></tr></tbody></table></div><p>PARAMETERS 403</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 404<p>dmx_demux_t* 405 demux</p> 406</td><td align="char"> 407<p>Pointer to the demux API and instance data.</p> 408</td></tr><tr><td align="char"> 409<p>dmx_frontend_t* 410 frontend</p> 411</td><td align="char"> 412<p>Pointer to the front-end instance data.</p> 413</td></tr></tbody></table></div><p>RETURNS 414</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 415<p>0</p> 416</td><td align="char"> 417<p>The function was completed without errors.</p> 418</td></tr><tr><td align="char"> 419<p>-EEXIST</p> 420</td><td align="char"> 421<p>A front-end with the same value of the id field already 422 registered.</p> 423</td></tr><tr><td align="char"> 424<p>-EINUSE</p> 425</td><td align="char"> 426<p>The demux is in use.</p> 427</td></tr><tr><td align="char"> 428<p>-ENOMEM</p> 429</td><td align="char"> 430<p>No more front-ends can be added.</p> 431</td></tr><tr><td align="char"> 432<p>-EINVAL</p> 433</td><td align="char"> 434<p>Bad parameter.</p> 435</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130880988"></a>remove_frontend()</h3></div></div></div><p>DESCRIPTION 436</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 437<p>Indicates that the given front-end, registered by a call to add_frontend(), can 438 no longer be connected as a TS source by this demux. The function should be 439 called when a front-end driver or a demux driver is removed from the system. 440 If the front-end is in use, the function fails with the return value of -EBUSY. 441 After successfully calling this function, the caller can free the memory of 442 the frontend struct if it was dynamically allocated before the add_frontend() 443 operation.</p> 444</td></tr></tbody></table></div><p>SYNOPSIS 445</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 446<p>int remove_frontend(dmx_demux_t⋆ demux, 447 dmx_frontend_t⋆ frontend);</p> 448</td></tr></tbody></table></div><p>PARAMETERS 449</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 450<p>dmx_demux_t* 451 demux</p> 452</td><td align="char"> 453<p>Pointer to the demux API and instance data.</p> 454</td></tr><tr><td align="char"> 455<p>dmx_frontend_t* 456 frontend</p> 457</td><td align="char"> 458<p>Pointer to the front-end instance data.</p> 459</td></tr></tbody></table></div><p>RETURNS 460</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 461<p>0</p> 462</td><td align="char"> 463<p>The function was completed without errors.</p> 464</td></tr><tr><td align="char"> 465<p>-EINVAL</p> 466</td><td align="char"> 467<p>Bad parameter.</p> 468</td></tr><tr><td align="char"> 469<p>-EBUSY</p> 470</td><td align="char"> 471<p>The front-end is in use, i.e. a call to connect_frontend() 472 has not been followed by a call to disconnect_frontend().</p> 473</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130891156"></a>get_frontends()</h3></div></div></div><p>DESCRIPTION 474</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 475<p>Provides the APIs of the front-ends that have been registered for this demux. 476 Any of the front-ends obtained with this call can be used as a parameter for 477 connect_frontend().</p> 478</td></tr><tr><td align="char"> 479<p>The include file demux.h contains the macro DMX_FE_ENTRY() for 480 converting an element of the generic type struct list_head* to the type 481 dmx_frontend_t*. The caller must not free the memory of any of the elements 482 obtained via this function call.</p> 483</td></tr></tbody></table></div><p>SYNOPSIS 484</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 485<p>struct list_head⋆ get_frontends(dmx_demux_t⋆ demux);</p> 486</td></tr></tbody></table></div><p>PARAMETERS 487</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 488<p>dmx_demux_t* 489 demux</p> 490</td><td align="char"> 491<p>Pointer to the demux API and instance data.</p> 492</td></tr></tbody></table></div><p>RETURNS 493</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 494<p>dmx_demux_t*</p> 495</td><td align="char"> 496<p>A list of front-end interfaces, or NULL in the case of an 497 empty list.</p> 498</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130898500"></a>connect_frontend()</h3></div></div></div><p>DESCRIPTION 499</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 500<p>Connects the TS output of the front-end to the input of the demux. A demux 501 can only be connected to a front-end registered to the demux with the function 502 add_frontend().</p> 503</td></tr><tr><td align="char"> 504<p>It may or may not be possible to connect multiple demuxes to the same 505 front-end, depending on the capabilities of the HW platform. When not used, 506 the front-end should be released by calling disconnect_frontend().</p> 507</td></tr></tbody></table></div><p>SYNOPSIS 508</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 509<p>int connect_frontend(dmx_demux_t⋆ demux, 510 dmx_frontend_t⋆ frontend);</p> 511</td></tr></tbody></table></div><p>PARAMETERS 512</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 513<p>dmx_demux_t* 514 demux</p> 515</td><td align="char"> 516<p>Pointer to the demux API and instance data.</p> 517</td></tr><tr><td align="char"> 518<p>dmx_frontend_t* 519 frontend</p> 520</td><td align="char"> 521<p>Pointer to the front-end instance data.</p> 522</td></tr></tbody></table></div><p>RETURNS 523</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 524<p>0</p> 525</td><td align="char"> 526<p>The function was completed without errors.</p> 527</td></tr><tr><td align="char"> 528<p>-EINVAL</p> 529</td><td align="char"> 530<p>Bad parameter.</p> 531</td></tr><tr><td align="char"> 532<p>-EBUSY</p> 533</td><td align="char"> 534<p>The front-end is in use.</p> 535</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130909076"></a>disconnect_frontend()</h3></div></div></div><p>DESCRIPTION 536</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 537<p>Disconnects the demux and a front-end previously connected by a 538 connect_frontend() call.</p> 539</td></tr></tbody></table></div><p>SYNOPSIS 540</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 541<p>int disconnect_frontend(dmx_demux_t⋆ demux);</p> 542</td></tr></tbody></table></div><p>PARAMETERS 543</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 544<p>dmx_demux_t* 545 demux</p> 546</td><td align="char"> 547<p>Pointer to the demux API and instance data.</p> 548</td></tr></tbody></table></div><p>RETURNS 549</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 550<p>0</p> 551</td><td align="char"> 552<p>The function was completed without errors.</p> 553</td></tr><tr><td align="char"> 554<p>-EINVAL</p> 555</td><td align="char"> 556<p>Bad parameter.</p> 557</td></tr></tbody></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="demux_directory_api.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dvb_kdapi.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="demux_callback_api.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Demux Directory API </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Demux Callback API</td></tr></table></div></body></html> 558