1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Demux Directory 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="dvb_kdapi.html" title="Chapter 15. Kernel Demux API"><link rel="next" href="demux_api.html" title="Demux 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 Directory API</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dvb_kdapi.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_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_directory_api"></a>Demux Directory API</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="demux_directory_api.html#idp1130738388">dmx_register_demux()</a></span></dt><dt><span class="section"><a href="demux_directory_api.html#idp1130747228">dmx_unregister_demux()</a></span></dt><dt><span class="section"><a href="demux_directory_api.html#idp1130756212">dmx_get_demuxes()</a></span></dt></dl></div><p>The demux directory is a Linux kernel-wide facility for registering and accessing the 2MPEG-2 TS demuxes in the system. Run-time registering and unregistering of demux drivers 3is possible using this API. 4</p><p>All demux drivers in the directory implement the abstract interface dmx_demux_t. 5</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130738388"></a>dmx_register_demux()</h3></div></div></div><p>DESCRIPTION 6</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 7<p>This function makes a demux driver interface available to the Linux kernel. It is 8 usually called by the init_module() function of the kernel module that contains 9 the demux driver. The caller of this function is responsible for allocating 10 dynamic or static memory for the demux structure and for initializing its fields 11 before calling this function. The memory allocated for the demux structure 12 must not be freed before calling dmx_unregister_demux(),</p> 13</td></tr></tbody></table></div><p>SYNOPSIS 14</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 15<p>int dmx_register_demux ( dmx_demux_t ⋆demux )</p> 16</td></tr></tbody></table></div><p>PARAMETERS 17</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 18<p>dmx_demux_t* 19 demux</p> 20</td><td align="char"> 21<p>Pointer to the demux structure.</p> 22</td></tr></tbody></table></div><p>RETURNS 23</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 24<p>0</p> 25</td><td align="char"> 26<p>The function was completed without errors.</p> 27</td></tr><tr><td align="char"> 28<p>-EEXIST</p> 29</td><td align="char"> 30<p>A demux with the same value of the id field already stored 31 in the directory.</p> 32</td></tr><tr><td align="char"> 33<p>-ENOSPC</p> 34</td><td align="char"> 35<p>No space left in the directory.</p> 36</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130747228"></a>dmx_unregister_demux()</h3></div></div></div><p>DESCRIPTION 37</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 38<p>This function is called to indicate that the given demux interface is no 39 longer available. The caller of this function is responsible for freeing the 40 memory of the demux structure, if it was dynamically allocated before calling 41 dmx_register_demux(). The cleanup_module() function of the kernel module 42 that contains the demux driver should call this function. Note that this function 43 fails if the demux is currently in use, i.e., release_demux() has not been called 44 for the interface.</p> 45</td></tr></tbody></table></div><p>SYNOPSIS 46</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 47<p>int dmx_unregister_demux ( dmx_demux_t ⋆demux )</p> 48</td></tr></tbody></table></div><p>PARAMETERS 49</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 50<p>dmx_demux_t* 51 demux</p> 52</td><td align="char"> 53<p>Pointer to the demux structure which is to be 54 unregistered.</p> 55</td></tr></tbody></table></div><p>RETURNS 56</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 57<p>0</p> 58</td><td align="char"> 59<p>The function was completed without errors.</p> 60</td></tr><tr><td align="char"> 61<p>ENODEV</p> 62</td><td align="char"> 63<p>The specified demux is not registered in the demux 64 directory.</p> 65</td></tr><tr><td align="char"> 66<p>EBUSY</p> 67</td><td align="char"> 68<p>The specified demux is currently in use.</p> 69</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1130756212"></a>dmx_get_demuxes()</h3></div></div></div><p>DESCRIPTION 70</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 71<p>Provides the caller with the list of registered demux interfaces, using the 72 standard list structure defined in the include file linux/list.h. The include file 73 demux.h defines the macro DMX_DIR_ENTRY() for converting an element of 74 the generic type struct list_head* to the type dmx_demux_t*. The caller must 75 not free the memory of any of the elements obtained via this function call.</p> 76</td></tr></tbody></table></div><p>SYNOPSIS 77</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 78<p>struct list_head ⋆dmx_get_demuxes ()</p> 79</td></tr></tbody></table></div><p>PARAMETERS 80</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 81<p>none</p> 82</td><td class="auto-generated"> </td></tr></tbody></table></div><p>RETURNS 83</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 84<p>struct list_head *</p> 85</td><td align="char"> 86<p>A list of demux interfaces, or NULL in the case of an 87 empty list.</p> 88</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="dvb_kdapi.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_api.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 15. Kernel Demux API </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Demux API</td></tr></table></div></body></html> 89