Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 1d7e4a84435f8a9172037d395187297e > files > 25

libkate-devel-0.4.1-13.mga7.armv7hl.rpm

<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libkate: decoding.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libkate
   &#160;<span id="projectnumber">0.4.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">decoding.c</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  This shows the steps necessary to encode a Kate stream.</span></div><div class="line"><span class="comment">  For clarity, error checking is omitted.</span></div><div class="line"><span class="comment">  For simplicity, the input is assumed to be a single Kate stream.</span></div><div class="line"><span class="comment">  Usually, Kate streams will be multiplexed with other streams (either</span></div><div class="line"><span class="comment">  other Kate streams, or audio, or video). In these cases, the Ogg</span></div><div class="line"><span class="comment">  part will have to be more complex, but the Kate specific code will</span></div><div class="line"><span class="comment">  be the same.</span></div><div class="line"><span class="comment">  */</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;common.h&quot;</span></div><div class="line"></div><div class="line"><span class="comment">/* All the libkate API is available from the main kate header file: */</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="oggkate_8h.html">kate/oggkate.h</a>&gt;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  ogg_sync_state oy;</div><div class="line">  ogg_stream_state os;</div><div class="line">  <span class="keywordtype">int</span> init=0;</div><div class="line">  ogg_packet op;</div><div class="line">  <a name="_a0"></a><a class="code" href="structkate__state.html">kate_state</a> k;</div><div class="line">  <a name="_a1"></a><a class="code" href="structkate__info.html">kate_info</a> ki;</div><div class="line">  <a name="_a2"></a><a class="code" href="structkate__comment.html">kate_comment</a> kc;</div><div class="line">  <span class="keyword">const</span> <a name="_a3"></a><a class="code" href="structkate__event.html">kate_event</a> *ev;</div><div class="line"></div><div class="line">  <span class="comment">/* for the benefit of windows, which mangles data otherwise */</span></div><div class="line">  set_binary_file(stdin);</div><div class="line"></div><div class="line">  <span class="comment">/* we initialize ogg and kate info/comment structures */</span></div><div class="line">  ogg_sync_init(&amp;oy);</div><div class="line">  <a name="a4"></a><a class="code" href="group__info.html#gab9031b2c167954bc7d754b30774f0241">kate_info_init</a>(&amp;ki);</div><div class="line">  <a name="a5"></a><a class="code" href="group__comments.html#ga4f717746ed53e557e57bb1e2b40dbd84">kate_comment_init</a>(&amp;kc);</div><div class="line"></div><div class="line">  <span class="comment">/*</span></div><div class="line"><span class="comment">    First, read the headers, which must appear first in a Kate stream. When</span></div><div class="line"><span class="comment">    kate_decode_header returns a positive number, all headers have been seen</span></div><div class="line"><span class="comment">    and we&#39;re ready to decode data.</span></div><div class="line"><span class="comment">    */</span></div><div class="line">  <span class="keywordflow">do</span> {</div><div class="line">    get_packet(&amp;oy,&amp;os,&amp;init,&amp;op);</div><div class="line">  } <span class="keywordflow">while</span> (<a name="a6"></a><a class="code" href="oggkate_8h.html#ad9a723eff7f66cadae79719d09aebd4d">kate_ogg_decode_headerin</a>(&amp;ki,&amp;kc,&amp;op)==0);</div><div class="line"></div><div class="line">  <span class="comment">/*</span></div><div class="line"><span class="comment">    We now have all the information we need from the headers, so we can</span></div><div class="line"><span class="comment">    initialize kate for decoding</span></div><div class="line"><span class="comment">    */</span></div><div class="line">  <a name="a7"></a><a class="code" href="group__decoding.html#gaecc12ec59e4b3256f50b5c135d4fe90f">kate_decode_init</a>(&amp;k,&amp;ki);</div><div class="line"></div><div class="line">  <span class="comment">/*</span></div><div class="line"><span class="comment">    We can now read data, until kate_decode_packetin returns a positive</span></div><div class="line"><span class="comment">    number, signaling the end of the stream</span></div><div class="line"><span class="comment">    */</span></div><div class="line">  <span class="keywordflow">while</span> (1) {</div><div class="line">    <span class="keywordflow">if</span> (get_packet(&amp;oy,&amp;os,&amp;init,&amp;op)) <span class="keywordflow">break</span>;</div><div class="line">    <span class="keywordflow">if</span> (<a name="a8"></a><a class="code" href="oggkate_8h.html#a66a5a414cf4ad9b094b27a78c00e83a7">kate_ogg_decode_packetin</a>(&amp;k,&amp;op)&gt;0) <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line">    <span class="comment">/* we may have an event (eg, text) */</span></div><div class="line">    <span class="keywordflow">if</span> (<a name="a9"></a><a class="code" href="group__decoding.html#gacdc7b2786e9fb2c8c685ebe3f483852c">kate_decode_eventout</a>(&amp;k,&amp;ev)==0) {</div><div class="line">      printf(<span class="stringliteral">&quot;Kate stream has text: %s\n&quot;</span>,ev-&gt;<a name="a10"></a><a class="code" href="structkate__event.html#ae10745a5078521816cc07a09654fbfd4">text</a>);</div><div class="line">    }</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">/* That&#39;s it, we can now cleanup */</span></div><div class="line">  ogg_stream_clear(&amp;os);</div><div class="line">  ogg_sync_clear(&amp;oy);</div><div class="line"></div><div class="line">  <a name="a11"></a><a class="code" href="kate_8h.html#a8617b44c49f19262a9e03c0dcb45d971">kate_clear</a>(&amp;k);</div><div class="line">  <a name="a12"></a><a class="code" href="group__info.html#gaa8ba295f7925e8926ed46510c28be60d">kate_info_clear</a>(&amp;ki);</div><div class="line">  <a name="a13"></a><a class="code" href="group__comments.html#ga92e532be93459a5b1d6835b64c1129da">kate_comment_clear</a>(&amp;kc);</div><div class="line"></div><div class="line">  <span class="keywordflow">return</span> 0;</div><div class="line">}</div><div class="line"></div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>