Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 2673

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API" /><link rel="up" href="ch15.html" title="Chapter&#160;15.&#160;Kernel Demux API" /><link rel="prev" href="ch15s02.html" title="Demux Directory API" /><link rel="next" href="ch15s04.html" title="Demux Callback API" /></head><body><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="ch15s02.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;15.&#160;Kernel Demux API</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch15s04.html">Next</a></td></tr></table><hr /></div><div class="section" title="Demux API"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="demux_api"></a>Demux API</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch15s03.html#kdapi_fopen">open()</a></span></dt><dt><span class="section"><a href="ch15s03.html#kdapi_fclose">close()</a></span></dt><dt><span class="section"><a href="ch15s03.html#kdapi_fwrite">write()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2874357">allocate_ts_feed()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2874557">release_ts_feed()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2874700">allocate_section_feed()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2874907">release_section_feed()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2875051">descramble_mac_address()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2875295">descramble_section_payload()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2875576">add_frontend()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2875781">remove_frontend()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2875951">get_frontends()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2876073">connect_frontend()</a></span></dt><dt><span class="section"><a href="ch15s03.html#id2876249">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
the TS source of a demux and to manage the demux resources. When the demux
client allocates a resource via the demux API, it receives a pointer to the API of that
resource.
</p><p>Each demux receives its TS input from a DVB front-end or from memory, as set via the
demux API. In a system with more than one front-end, the API can be used to select one of
the DVB front-ends as a TS source for a demux, unless this is fixed in the HW platform. The
demux API only controls front-ends regarding their connections with demuxes; the APIs
used to set the other front-end parameters, such as tuning, are not defined in this
document.
</p><p>The functions that implement the abstract interface demux should be defined static or
module private and registered to the Demux Directory for external access. It is not necessary
to implement every function in the demux_t struct, however (for example, a demux interface
might support Section filtering, but not TS or PES filtering). The API client is expected to
check the value of any function pointer before calling the function: the value of NULL means
&#8220;function not available&#8221;.
</p><p>Whenever the functions of the demux API modify shared data, the possibilities of lost
update and race condition problems should be addressed, e.g. by protecting parts of code with
mutexes. This is especially important on multi-processor hosts.
</p><p>Note that functions called from a bottom half context must not sleep, at least in the 2.2.x
kernels. Even a simple memory allocation can result in a kernel thread being put to sleep if
swapping is needed. For example, the Linux kernel calls the functions of a network device
interface from a bottom half context. Thus, if a demux API function is called from network
device code, the function must not sleep.
</p><div class="section" title="open()"><div class="titlepage"><div><div><h3 class="title"><a id="kdapi_fopen"></a>open()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>This function reserves the demux for use by the caller and, if necessary,
 initializes the demux. When the demux is no longer needed, the function close()
 should be called. It should be possible for multiple clients to access the demux
 at the same time. Thus, the function implementation should increment the
 demux usage count when open() is called and decrement it when close() is
 called.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int open ( demux_t&#8902; demux );</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t* demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EUSERS</p>
</td><td align="char">
<p>Maximum usage count reached.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="close()"><div class="titlepage"><div><div><h3 class="title"><a id="kdapi_fclose"></a>close()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>This function reserves the demux for use by the caller and, if necessary,
 initializes the demux. When the demux is no longer needed, the function close()
 should be called. It should be possible for multiple clients to access the demux
 at the same time. Thus, the function implementation should increment the
 demux usage count when open() is called and decrement it when close() is
 called.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int close(demux_t&#8902; demux);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t* demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-ENODEV</p>
</td><td align="char">
<p>The demux was not in use.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="write()"><div class="titlepage"><div><div><h3 class="title"><a id="kdapi_fwrite"></a>write()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>This function provides the demux driver with a memory buffer containing TS
 packets. Instead of receiving TS packets from the DVB front-end, the demux
 driver software will read packets from memory. Any clients of this demux
 with active TS, PES or Section filters will receive filtered data via the Demux
 callback API (see 0). The function returns when all the data in the buffer has
 been consumed by the demux. Demux hardware typically cannot read TS from
 memory. If this is the case, memory-based filtering has to be implemented
 entirely in software.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int write(demux_t&#8902; demux, const char&#8902; buf, size_t
 count);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t* demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>const char* buf</p>
</td><td align="char">
<p>Pointer to the TS data in kernel-space memory.</p>
</td></tr><tr><td align="char">
<p>size_t length</p>
</td><td align="char">
<p>Length of the TS data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-ENOSYS</p>
</td><td align="char">
<p>The command is not implemented.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="allocate_ts_feed()"><div class="titlepage"><div><div><h3 class="title"><a id="id2874357"></a>allocate_ts_feed()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Allocates a new TS feed, which is used to filter the TS packets carrying a
 certain PID. The TS feed normally corresponds to a hardware PID filter on the
 demux chip.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int allocate_ts_feed(dmx_demux_t&#8902; demux,
 dmx_ts_feed_t&#8902;&#8902; feed, dmx_ts_cb callback);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t* demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_ts_feed_t**
 feed</p>
</td><td align="char">
<p>Pointer to the TS feed API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_ts_cb callback</p>
</td><td align="char">
<p>Pointer to the callback function for passing received TS
 packet</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EBUSY</p>
</td><td align="char">
<p>No more TS feeds available.</p>
</td></tr><tr><td align="char">
<p>-ENOSYS</p>
</td><td align="char">
<p>The command is not implemented.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="release_ts_feed()"><div class="titlepage"><div><div><h3 class="title"><a id="id2874557"></a>release_ts_feed()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Releases the resources allocated with allocate_ts_feed(). Any filtering in
 progress on the TS feed should be stopped before calling this function.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int release_ts_feed(dmx_demux_t&#8902; demux,
 dmx_ts_feed_t&#8902; feed);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t* demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_ts_feed_t* feed</p>
</td><td align="char">
<p>Pointer to the TS feed API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="allocate_section_feed()"><div class="titlepage"><div><div><h3 class="title"><a id="id2874700"></a>allocate_section_feed()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Allocates a new section feed, i.e. a demux resource for filtering and receiving
 sections. On platforms with hardware support for section filtering, a section
 feed is directly mapped to the demux HW. On other platforms, TS packets are
 first PID filtered in hardware and a hardware section filter then emulated in
 software. The caller obtains an API pointer of type dmx_section_feed_t as an
 out parameter. Using this API the caller can set filtering parameters and start
 receiving sections.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int allocate_section_feed(dmx_demux_t&#8902; demux,
 dmx_section_feed_t &#8902;&#8902;feed, dmx_section_cb callback);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t *demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_section_feed_t
 **feed</p>
</td><td align="char">
<p>Pointer to the section feed API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_section_cb
 callback</p>
</td><td align="char">
<p>Pointer to the callback function for passing received
 sections.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EBUSY</p>
</td><td align="char">
<p>No more section feeds available.</p>
</td></tr><tr><td align="char">
<p>-ENOSYS</p>
</td><td align="char">
<p>The command is not implemented.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="release_section_feed()"><div class="titlepage"><div><div><h3 class="title"><a id="id2874907"></a>release_section_feed()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Releases the resources allocated with allocate_section_feed(), including
 allocated filters. Any filtering in progress on the section feed should be stopped
 before calling this function.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int release_section_feed(dmx_demux_t&#8902; demux,
 dmx_section_feed_t &#8902;feed);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>demux_t *demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_section_feed_t
 *feed</p>
</td><td align="char">
<p>Pointer to the section feed API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="descramble_mac_address()"><div class="titlepage"><div><div><h3 class="title"><a id="id2875051"></a>descramble_mac_address()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>This function runs a descrambling algorithm on the destination MAC
 address field of a DVB Datagram Section, replacing the original address
 with its un-encrypted version. Otherwise, the description on the function
 descramble_section_payload() applies also to this function.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int descramble_mac_address(dmx_demux_t&#8902; demux, __u8
 &#8902;buffer1, size_t buffer1_length, __u8 &#8902;buffer2,
 size_t buffer2_length, __u16 pid);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t
 *demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>__u8 *buffer1</p>
</td><td align="char">
<p>Pointer to the first byte of the section.</p>
</td></tr><tr><td align="char">
<p>size_t buffer1_length</p>
</td><td align="char">
<p>Length of the section data, including headers and CRC,
 in buffer1.</p>
</td></tr><tr><td align="char">
<p>__u8* buffer2</p>
</td><td align="char">
<p>Pointer to the tail of the section data, or NULL. The
 pointer has a non-NULL value if the section wraps past
 the end of a circular buffer.</p>
</td></tr><tr><td align="char">
<p>size_t buffer2_length</p>
</td><td align="char">
<p>Length of the section data, including headers and CRC,
 in buffer2.</p>
</td></tr><tr><td align="char">
<p>__u16 pid</p>
</td><td align="char">
<p>The PID on which the section was received. Useful
 for obtaining the descrambling key, e.g. from a DVB
 Common Access facility.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-ENOSYS</p>
</td><td align="char">
<p>No descrambling facility available.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="descramble_section_payload()"><div class="titlepage"><div><div><h3 class="title"><a id="id2875295"></a>descramble_section_payload()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>This function runs a descrambling algorithm on the payload of a DVB
 Datagram Section, replacing the original payload with its un-encrypted
 version. The function will be called from the demux API implementation;
 the API client need not call this function directly. Section-level scrambling
 algorithms are currently standardized only for DVB-RCC (return channel
 over 2-directional cable TV network) systems. For all other DVB networks,
 encryption schemes are likely to be proprietary to each data broadcaster. Thus,
 it is expected that this function pointer will have the value of NULL (i.e.,
 function not available) in most demux API implementations. Nevertheless, it
 should be possible to use the function pointer as a hook for dynamically adding
 a &#8220;plug-in&#8221; descrambling facility to a demux driver.</p>
</td></tr><tr><td align="char">
<p>While this function is not needed with hardware-based section descrambling,
 the descramble_section_payload function pointer can be used to override the
 default hardware-based descrambling algorithm: if the function pointer has a
 non-NULL value, the corresponding function should be used instead of any
 descrambling hardware.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int descramble_section_payload(dmx_demux_t&#8902; demux,
 __u8 &#8902;buffer1, size_t buffer1_length, __u8 &#8902;buffer2,
 size_t buffer2_length, __u16 pid);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t
 *demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>__u8 *buffer1</p>
</td><td align="char">
<p>Pointer to the first byte of the section.</p>
</td></tr><tr><td align="char">
<p>size_t buffer1_length</p>
</td><td align="char">
<p>Length of the section data, including headers and CRC,
 in buffer1.</p>
</td></tr><tr><td align="char">
<p>__u8 *buffer2</p>
</td><td align="char">
<p>Pointer to the tail of the section data, or NULL. The
 pointer has a non-NULL value if the section wraps past
 the end of a circular buffer.</p>
</td></tr><tr><td align="char">
<p>size_t buffer2_length</p>
</td><td align="char">
<p>Length of the section data, including headers and CRC,
 in buffer2.</p>
</td></tr><tr><td align="char">
<p>__u16 pid</p>
</td><td align="char">
<p>The PID on which the section was received. Useful
 for obtaining the descrambling key, e.g. from a DVB
 Common Access facility.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-ENOSYS</p>
</td><td align="char">
<p>No descrambling facility available.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="add_frontend()"><div class="titlepage"><div><div><h3 class="title"><a id="id2875576"></a>add_frontend()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Registers a connectivity between a demux and a front-end, i.e., indicates that
 the demux can be connected via a call to connect_frontend() to use the given
 front-end as a TS source. The client of this function has to allocate dynamic or
 static memory for the frontend structure and initialize its fields before calling
 this function. This function is normally called during the driver initialization.
 The caller must not free the memory of the frontend struct before successfully
 calling remove_frontend().</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int add_frontend(dmx_demux_t &#8902;demux, dmx_frontend_t
 &#8902;frontend);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*
 demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_frontend_t*
 frontend</p>
</td><td align="char">
<p>Pointer to the front-end instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EEXIST</p>
</td><td align="char">
<p>A front-end with the same value of the id field already
 registered.</p>
</td></tr><tr><td align="char">
<p>-EINUSE</p>
</td><td align="char">
<p>The demux is in use.</p>
</td></tr><tr><td align="char">
<p>-ENOMEM</p>
</td><td align="char">
<p>No more front-ends can be added.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr></tbody></table></div></div><div class="section" title="remove_frontend()"><div class="titlepage"><div><div><h3 class="title"><a id="id2875781"></a>remove_frontend()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Indicates that the given front-end, registered by a call to add_frontend(), can
 no longer be connected as a TS source by this demux. The function should be
 called when a front-end driver or a demux driver is removed from the system.
 If the front-end is in use, the function fails with the return value of -EBUSY.
 After successfully calling this function, the caller can free the memory of
 the frontend struct if it was dynamically allocated before the add_frontend()
 operation.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int remove_frontend(dmx_demux_t&#8902; demux,
 dmx_frontend_t&#8902; frontend);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*
 demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_frontend_t*
 frontend</p>
</td><td align="char">
<p>Pointer to the front-end instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr><tr><td align="char">
<p>-EBUSY</p>
</td><td align="char">
<p>The front-end is in use, i.e. a call to connect_frontend()
 has not been followed by a call to disconnect_frontend().</p>
</td></tr></tbody></table></div></div><div class="section" title="get_frontends()"><div class="titlepage"><div><div><h3 class="title"><a id="id2875951"></a>get_frontends()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Provides the APIs of the front-ends that have been registered for this demux.
 Any of the front-ends obtained with this call can be used as a parameter for
 connect_frontend().</p>
</td></tr><tr><td align="char">
<p>The include file demux.h contains the macro DMX_FE_ENTRY() for
 converting an element of the generic type struct list_head* to the type
 dmx_frontend_t*. The caller must not free the memory of any of the elements
 obtained via this function call.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>struct list_head&#8902; get_frontends(dmx_demux_t&#8902; demux);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*
 demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*</p>
</td><td align="char">
<p>A list of front-end interfaces, or NULL in the case of an
 empty list.</p>
</td></tr></tbody></table></div></div><div class="section" title="connect_frontend()"><div class="titlepage"><div><div><h3 class="title"><a id="id2876073"></a>connect_frontend()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Connects the TS output of the front-end to the input of the demux. A demux
 can only be connected to a front-end registered to the demux with the function
 add_frontend().</p>
</td></tr><tr><td align="char">
<p>It may or may not be possible to connect multiple demuxes to the same
 front-end, depending on the capabilities of the HW platform. When not used,
 the front-end should be released by calling disconnect_frontend().</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int connect_frontend(dmx_demux_t&#8902; demux,
 dmx_frontend_t&#8902; frontend);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*
 demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr><tr><td align="char">
<p>dmx_frontend_t*
 frontend</p>
</td><td align="char">
<p>Pointer to the front-end instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</td></tr><tr><td align="char">
<p>-EBUSY</p>
</td><td align="char">
<p>The front-end is in use.</p>
</td></tr></tbody></table></div></div><div class="section" title="disconnect_frontend()"><div class="titlepage"><div><div><h3 class="title"><a id="id2876249"></a>disconnect_frontend()</h3></div></div></div><p>DESCRIPTION
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>Disconnects the demux and a front-end previously connected by a
 connect_frontend() call.</p>
</td></tr></tbody></table></div><p>SYNOPSIS
</p><div class="informaltable"><table border="1"><colgroup><col /></colgroup><tbody><tr><td align="char">
<p>int disconnect_frontend(dmx_demux_t&#8902; demux);</p>
</td></tr></tbody></table></div><p>PARAMETERS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>dmx_demux_t*
 demux</p>
</td><td align="char">
<p>Pointer to the demux API and instance data.</p>
</td></tr></tbody></table></div><p>RETURNS
</p><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="char">
<p>0</p>
</td><td align="char">
<p>The function was completed without errors.</p>
</td></tr><tr><td align="char">
<p>-EINVAL</p>
</td><td align="char">
<p>Bad parameter.</p>
</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="ch15s02.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch15.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch15s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Demux Directory API&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Demux Callback API</td></tr></table></div></body></html>