1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>allocate_filter()</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="kdapi_set.html" title="set()"><link rel="next" href="ch15s09.html" title="release_filter()"></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">allocate_filter()</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="kdapi_set.html">Prev</a> </td><th width="60%" align="center">Chapter 15. Kernel Demux API</th><td width="20%" align="right"> <a accesskey="n" href="ch15s09.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1131003172"></a>allocate_filter()</h2></div></div></div><p>DESCRIPTION 2</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 3<p>This function is used to allocate a section filter on the demux. It should only be 4 called when no filtering is in progress on this section feed. If a filter cannot be 5 allocated, the function fails with -ENOSPC. See in section ?? for the format of 6 the section filter.</p> 7</td></tr><tr><td align="char"> 8<p>The bitfields filter_mask and filter_value should only be modified when no 9 filtering is in progress on this section feed. filter_mask controls which bits of 10 filter_value are compared with the section headers/payload. On a binary value 11 of 1 in filter_mask, the corresponding bits are compared. The filter only accepts 12 sections that are equal to filter_value in all the tested bit positions. Any changes 13 to the values of filter_mask and filter_value are guaranteed to take effect only 14 when the start_filtering() function is called next time. The parent pointer in 15 the struct is initialized by the API implementation to the value of the feed 16 parameter. The priv pointer is not used by the API implementation, and can 17 thus be freely utilized by the caller of this function. Any data pointed to by the 18 priv pointer is available to the recipient of the dmx_section_cb() function call.</p> 19</td></tr><tr><td align="char"> 20<p>While the maximum section filter length (DMX_MAX_FILTER_SIZE) is 21 currently set at 16 bytes, hardware filters of that size are not available on all 22 platforms. Therefore, section filtering will often take place first in hardware, 23 followed by filtering in software for the header bytes that were not covered 24 by a hardware filter. The filter_mask field can be checked to determine how 25 many bytes of the section filter are actually used, and if the hardware filter will 26 suffice. Additionally, software-only section filters can optionally be allocated 27 to clients when all hardware section filters are in use. Note that on most demux 28 hardware it is not possible to filter on the section_length field of the section 29 header – thus this field is ignored, even though it is included in filter_value and 30 filter_mask fields.</p> 31</td></tr></tbody></table></div><p>SYNOPSIS 32</p><div class="informaltable"><table border="1"><colgroup><col></colgroup><tbody><tr><td align="char"> 33<p>int allocate_filter(dmx_section_feed_t⋆ feed, 34 dmx_section_filter_t⋆⋆ filter);</p> 35</td></tr></tbody></table></div><p>PARAMETERS 36</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 37<p>dmx_section_feed_t* 38 feed</p> 39</td><td align="char"> 40<p>Pointer to the section feed API and instance data.</p> 41</td></tr><tr><td align="char"> 42<p>dmx_section_filter_t** 43 filter</p> 44</td><td align="char"> 45<p>Pointer to the allocated filter.</p> 46</td></tr></tbody></table></div><p>RETURNS 47</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td align="char"> 48<p>0</p> 49</td><td align="char"> 50<p>The function was completed without errors.</p> 51</td></tr><tr><td align="char"> 52<p>-ENOSPC</p> 53</td><td align="char"> 54<p>No filters of given type and length available.</p> 55</td></tr><tr><td align="char"> 56<p>-EINVAL</p> 57</td><td align="char"> 58<p>Bad parameters.</p> 59</td></tr></tbody></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="kdapi_set.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="ch15s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">set() </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> release_filter()</td></tr></table></div></body></html> 60