1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct dmx_demux</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch06s02.html" title="Digital TV (DVB) devices"><link rel="prev" href="API-enum-dmx-demux-caps.html" title="enum dmx_demux_caps"><link rel="next" href="ch06s03.html" title="Remote Controller devices"></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"><span class="phrase">struct dmx_demux</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-enum-dmx-demux-caps.html">Prev</a> </td><th width="60%" align="center">Digital TV (DVB) devices</th><td width="20%" align="right"> <a accesskey="n" href="ch06s03.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-dmx-demux"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct dmx_demux — 2 Structure that contains the demux capabilities and callbacks. 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct dmx_demux { 5 enum dmx_demux_caps capabilities; 6 struct dmx_frontend * frontend; 7 void * priv; 8 int (* open) (struct dmx_demux *demux); 9 int (* close) (struct dmx_demux *demux); 10 int (* write) (struct dmx_demux *demux, const char __user *buf,size_t count); 11 int (* allocate_ts_feed) (struct dmx_demux *demux,struct dmx_ts_feed **feed,dmx_ts_cb callback); 12 int (* release_ts_feed) (struct dmx_demux *demux,struct dmx_ts_feed *feed); 13 int (* allocate_section_feed) (struct dmx_demux *demux,struct dmx_section_feed **feed,dmx_section_cb callback); 14 int (* release_section_feed) (struct dmx_demux *demux,struct dmx_section_feed *feed); 15 int (* add_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend); 16 int (* remove_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend); 17 struct list_head *(* get_frontends) (struct dmx_demux *demux); 18 int (* connect_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend); 19 int (* disconnect_frontend) (struct dmx_demux *demux); 20 int (* get_pes_pids) (struct dmx_demux *demux, u16 *pids); 21}; </pre></div><div class="refsect1"><a name="id-1.8.3.43.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">capabilities</span></dt><dd><p> 22 Bitfield of capability flags. 23 </p></dd><dt><span class="term">frontend</span></dt><dd><p> 24 Front-end connected to the demux 25 </p></dd><dt><span class="term">priv</span></dt><dd><p> 26 Pointer to private data of the API client 27 </p></dd><dt><span class="term">open</span></dt><dd><p> 28 This function reserves the demux for use by the caller and, if 29 necessary, initializes the demux. When the demux is no longer needed, 30 the function <em class="parameter"><code>close</code></em> should be called. It should be possible for 31 multiple clients to access the demux at the same time. Thus, the 32 function implementation should increment the demux usage count when 33 <em class="parameter"><code>open</code></em> is called and decrement it when <em class="parameter"><code>close</code></em> is called. 34 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 35 instance data. 36 It returns 37 0 on success; 38 -EUSERS, if maximum usage count was reached; 39 -EINVAL, on bad parameter. 40 </p></dd><dt><span class="term">close</span></dt><dd><p> 41 This function reserves the demux for use by the caller and, if 42 necessary, initializes the demux. When the demux is no longer needed, 43 the function <em class="parameter"><code>close</code></em> should be called. It should be possible for 44 multiple clients to access the demux at the same time. Thus, the 45 function implementation should increment the demux usage count when 46 <em class="parameter"><code>open</code></em> is called and decrement it when <em class="parameter"><code>close</code></em> is called. 47 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 48 instance data. 49 It returns 50 0 on success; 51 -ENODEV, if demux was not in use (e. g. no users); 52 -EINVAL, on bad parameter. 53 </p></dd><dt><span class="term">write</span></dt><dd><p> 54 This function provides the demux driver with a memory buffer 55 containing TS packets. Instead of receiving TS packets from the DVB 56 front-end, the demux driver software will read packets from memory. 57 Any clients of this demux with active TS, PES or Section filters will 58 receive filtered data via the Demux callback API (see 0). The function 59 returns when all the data in the buffer has been consumed by the demux. 60 Demux hardware typically cannot read TS from memory. If this is the 61 case, memory-based filtering has to be implemented entirely in software. 62 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 63 instance data. 64 The <em class="parameter"><code>buf</code></em> function parameter contains a pointer to the TS data in 65 kernel-space memory. 66 The <em class="parameter"><code>count</code></em> function parameter contains the length of the TS data. 67 It returns 68 0 on success; 69 -ERESTARTSYS, if mutex lock was interrupted; 70 -EINTR, if a signal handling is pending; 71 -ENODEV, if demux was removed; 72 -EINVAL, on bad parameter. 73 </p></dd><dt><span class="term">allocate_ts_feed</span></dt><dd><p> 74 Allocates a new TS feed, which is used to filter the TS 75 packets carrying a certain PID. The TS feed normally corresponds to a 76 hardware PID filter on the demux chip. 77 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 78 instance data. 79 The <em class="parameter"><code>feed</code></em> function parameter contains a pointer to the TS feed API and 80 instance data. 81 The <em class="parameter"><code>callback</code></em> function parameter contains a pointer to the callback 82 function for passing received TS packet. 83 It returns 84 0 on success; 85 -ERESTARTSYS, if mutex lock was interrupted; 86 -EBUSY, if no more TS feeds is available; 87 -EINVAL, on bad parameter. 88 </p></dd><dt><span class="term">release_ts_feed</span></dt><dd><p> 89 Releases the resources allocated with <em class="parameter"><code>allocate_ts_feed</code></em>. 90 Any filtering in progress on the TS feed should be stopped before 91 calling this function. 92 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 93 instance data. 94 The <em class="parameter"><code>feed</code></em> function parameter contains a pointer to the TS feed API and 95 instance data. 96 It returns 97 0 on success; 98 -EINVAL on bad parameter. 99 </p></dd><dt><span class="term">allocate_section_feed</span></dt><dd><p> 100 Allocates a new section feed, i.e. a demux resource 101 for filtering and receiving sections. On platforms with hardware 102 support for section filtering, a section feed is directly mapped to 103 the demux HW. On other platforms, TS packets are first PID filtered in 104 hardware and a hardware section filter then emulated in software. The 105 caller obtains an API pointer of type dmx_section_feed_t as an out 106 parameter. Using this API the caller can set filtering parameters and 107 start receiving sections. 108 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 109 instance data. 110 The <em class="parameter"><code>feed</code></em> function parameter contains a pointer to the TS feed API and 111 instance data. 112 The <em class="parameter"><code>callback</code></em> function parameter contains a pointer to the callback 113 function for passing received TS packet. 114 It returns 115 0 on success; 116 -EBUSY, if no more TS feeds is available; 117 -EINVAL, on bad parameter. 118 </p></dd><dt><span class="term">release_section_feed</span></dt><dd><p> 119 Releases the resources allocated with 120 <em class="parameter"><code>allocate_section_feed</code></em>, including allocated filters. Any filtering in 121 progress on the section feed should be stopped before calling this 122 function. 123 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 124 instance data. 125 The <em class="parameter"><code>feed</code></em> function parameter contains a pointer to the TS feed API and 126 instance data. 127 It returns 128 0 on success; 129 -EINVAL, on bad parameter. 130 </p></dd><dt><span class="term">add_frontend</span></dt><dd><p> 131 Registers a connectivity between a demux and a front-end, 132 i.e., indicates that the demux can be connected via a call to 133 <em class="parameter"><code>connect_frontend</code></em> to use the given front-end as a TS source. The 134 client of this function has to allocate dynamic or static memory for 135 the frontend structure and initialize its fields before calling this 136 function. This function is normally called during the driver 137 initialization. The caller must not free the memory of the frontend 138 struct before successfully calling <em class="parameter"><code>remove_frontend</code></em>. 139 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 140 instance data. 141 The <em class="parameter"><code>frontend</code></em> function parameter contains a pointer to the front-end 142 instance data. 143 It returns 144 0 on success; 145 -EINVAL, on bad parameter. 146 </p></dd><dt><span class="term">remove_frontend</span></dt><dd><p> 147 Indicates that the given front-end, registered by a call 148 to <em class="parameter"><code>add_frontend</code></em>, can no longer be connected as a TS source by this 149 demux. The function should be called when a front-end driver or a demux 150 driver is removed from the system. If the front-end is in use, the 151 function fails with the return value of -EBUSY. After successfully 152 calling this function, the caller can free the memory of the frontend 153 struct if it was dynamically allocated before the <em class="parameter"><code>add_frontend</code></em> 154 operation. 155 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 156 instance data. 157 The <em class="parameter"><code>frontend</code></em> function parameter contains a pointer to the front-end 158 instance data. 159 It returns 160 0 on success; 161 -ENODEV, if the front-end was not found, 162 -EINVAL, on bad parameter. 163 </p></dd><dt><span class="term">get_frontends</span></dt><dd><p> 164 Provides the APIs of the front-ends that have been 165 registered for this demux. Any of the front-ends obtained with this 166 call can be used as a parameter for <em class="parameter"><code>connect_frontend</code></em>. The include 167 file demux.h contains the macro <code class="function">DMX_FE_ENTRY</code> for converting an 168 element of the generic type struct <span class="structname">list_head</span> * to the type 169 struct <span class="structname"><a class="link" href="API-struct-dmx-frontend.html" title="struct dmx_frontend">dmx_frontend</a></span> *. The caller must not free the memory of any of 170 the elements obtained via this function call. 171 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 172 instance data. 173 It returns a struct list_head pointer to the list of front-end 174 interfaces, or NULL in the case of an empty list. 175 </p></dd><dt><span class="term">connect_frontend</span></dt><dd><p> 176 Connects the TS output of the front-end to the input of 177 the demux. A demux can only be connected to a front-end registered to 178 the demux with the function <em class="parameter"><code>add_frontend</code></em>. It may or may not be 179 possible to connect multiple demuxes to the same front-end, depending 180 on the capabilities of the HW platform. When not used, the front-end 181 should be released by calling <em class="parameter"><code>disconnect_frontend</code></em>. 182 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 183 instance data. 184 The <em class="parameter"><code>frontend</code></em> function parameter contains a pointer to the front-end 185 instance data. 186 It returns 187 0 on success; 188 -EINVAL, on bad parameter. 189 </p></dd><dt><span class="term">disconnect_frontend</span></dt><dd><p> 190 Disconnects the demux and a front-end previously 191 connected by a <em class="parameter"><code>connect_frontend</code></em> call. 192 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 193 instance data. 194 It returns 195 0 on success; 196 -EINVAL on bad parameter. 197 </p></dd><dt><span class="term">get_pes_pids</span></dt><dd><p> 198 Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0, 199 DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0. 200 The <em class="parameter"><code>demux</code></em> function parameter contains a pointer to the demux API and 201 instance data. 202 The <em class="parameter"><code>pids</code></em> function parameter contains an array with five u16 elements 203 where the PIDs will be stored. 204 It returns 205 0 on success; 206 -EINVAL on bad parameter. 207 </p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-enum-dmx-demux-caps.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">enum dmx_demux_caps</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Remote Controller devices</td></tr></table></div></body></html> 208