1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>dmx_ts_cb</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-struct-dmx-section-feed.html" title="struct dmx_section_feed"><link rel="next" href="API-dmx-section-cb.html" title="dmx_section_cb"></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">dmx_ts_cb</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-dmx-section-feed.html">Prev</a> </td><th width="60%" align="center">Digital TV (DVB) devices</th><td width="20%" align="right"> <a accesskey="n" href="API-dmx-section-cb.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-dmx-ts-cb"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>dmx_ts_cb — 2 DVB demux TS filter callback function prototype 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">dmx_ts_cb </b>(</code></td><td>const u8 * <var class="pdparam">buffer1</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">buffer1_length</var>, </td></tr><tr><td> </td><td>const u8 * <var class="pdparam">buffer2</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">buffer2_length</var>, </td></tr><tr><td> </td><td><a class="link" href="API-struct-dmx-ts-feed.html" title="struct dmx_ts_feed">struct dmx_ts_feed</a> * <var class="pdparam">source</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.8.3.38.5"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>buffer1</code></em></span></dt><dd><p> 4 Pointer to the start of the filtered TS packets. 5 </p></dd><dt><span class="term"><em class="parameter"><code>buffer1_length</code></em></span></dt><dd><p> 6 Length of the TS data in buffer1. 7 </p></dd><dt><span class="term"><em class="parameter"><code>buffer2</code></em></span></dt><dd><p> 8 Pointer to the tail of the filtered TS packets, or NULL. 9 </p></dd><dt><span class="term"><em class="parameter"><code>buffer2_length</code></em></span></dt><dd><p> 10 Length of the TS data in buffer2. 11 </p></dd><dt><span class="term"><em class="parameter"><code>source</code></em></span></dt><dd><p> 12 Indicates which TS feed is the source of the callback. 13 </p></dd></dl></div></div><div class="refsect1"><a name="id-1.8.3.38.6"></a><h2>Description</h2><p> 14 This function callback prototype, provided by the client of the demux API, 15 is called from the demux code. The function is only called when filtering 16 on ae TS feed has been enabled using the <code class="function">start_filtering</code> function at 17 the <span class="structname"><a class="link" href="API-struct-dmx-demux.html" title="struct dmx_demux">dmx_demux</a></span>. 18 Any TS packets that match the filter settings are copied to a circular 19 buffer. The filtered TS packets are delivered to the client using this 20 callback function. The size of the circular buffer is controlled by the 21 circular_buffer_size parameter of the <span class="structname"><a class="link" href="API-struct-dmx-ts-feed.html" title="struct dmx_ts_feed">dmx_ts_feed</a></span>.<em class="parameter"><code>set</code></em> function. 22 It is expected that the <em class="parameter"><code>buffer1</code></em> and <em class="parameter"><code>buffer2</code></em> callback parameters point to 23 addresses within the circular buffer, but other implementations are also 24 possible. Note that the called party should not try to free the memory 25 the <em class="parameter"><code>buffer1</code></em> and <em class="parameter"><code>buffer2</code></em> parameters point to. 26 </p><p> 27 28 When this function is called, the <em class="parameter"><code>buffer1</code></em> parameter typically points to 29 the start of the first undelivered TS packet within a circular buffer. 30 The <em class="parameter"><code>buffer2</code></em> buffer parameter is normally NULL, except when the received 31 TS packets have crossed the last address of the circular buffer and 32 ”wrapped” to the beginning of the buffer. In the latter case the <em class="parameter"><code>buffer1</code></em> 33 parameter would contain an address within the circular buffer, while the 34 <em class="parameter"><code>buffer2</code></em> parameter would contain the first address of the circular buffer. 35 The number of bytes delivered with this function (i.e. <em class="parameter"><code>buffer1_length</code></em> + 36 <em class="parameter"><code>buffer2_length</code></em>) is usually equal to the value of callback_length parameter 37 given in the <code class="function">set</code> function, with one exception: if a timeout occurs before 38 receiving callback_length bytes of TS data, any undelivered packets are 39 immediately delivered to the client by calling this function. The timeout 40 duration is controlled by the <code class="function">set</code> function in the TS Feed API. 41 </p><p> 42 43 If a TS packet is received with errors that could not be fixed by the 44 TS-level forward error correction (FEC), the Transport_error_indicator 45 flag of the TS packet header should be set. The TS packet should not be 46 discarded, as the error can possibly be corrected by a higher layer 47 protocol. If the called party is slow in processing the callback, it 48 is possible that the circular buffer eventually fills up. If this happens, 49 the demux driver should discard any TS packets received while the buffer 50 is full and return -EOVERFLOW. 51 </p><p> 52 53 The type of data returned to the callback can be selected by the 54 <span class="structname"><a class="link" href="API-struct-dmx-ts-feed.html" title="struct dmx_ts_feed">dmx_ts_feed</a></span>.<em class="parameter"><code>set</code></em> function. The type parameter decides if the raw 55 TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY) 56 should be returned. If additionally the TS_DECODER bit is set the stream 57 will also be sent to the hardware MPEG decoder. 58</p></div><div class="refsect1"><a name="id-1.8.3.38.7"></a><h2>Return</h2><p> 59 0, on success; 60 -EOVERFLOW, on buffer overflow. 61</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-dmx-section-feed.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="API-dmx-section-cb.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct dmx_section_feed</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">dmx_section_cb</span></td></tr></table></div></body></html> 62