| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 |
<meta http-equiv="X-UA-Compatible" content="IE=11"/> |
| 6 |
<meta name="generator" content="Doxygen 1.9.4"/> |
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 8 |
<title>libkate: high.c</title> |
| 9 |
<link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 10 |
<script type="text/javascript" src="jquery.js"></script> |
| 11 |
<script type="text/javascript" src="dynsections.js"></script> |
| 12 |
<link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 13 |
</head> |
| 14 |
<body> |
| 15 |
<div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 16 |
<div id="titlearea"> |
| 17 |
<table cellspacing="0" cellpadding="0"> |
| 18 |
<tbody> |
| 19 |
<tr id="projectrow"> |
| 20 |
<td id="projectalign"> |
| 21 |
<div id="projectname">libkate<span id="projectnumber"> 0.4.3</span> |
| 22 |
</div> |
| 23 |
</td> |
| 24 |
</tr> |
| 25 |
</tbody> |
| 26 |
</table> |
| 27 |
</div> |
| 28 |
<!-- end header part --> |
| 29 |
<!-- Generated by Doxygen 1.9.4 --> |
| 30 |
<script type="text/javascript" src="menudata.js"></script> |
| 31 |
<script type="text/javascript" src="menu.js"></script> |
| 32 |
<script type="text/javascript"> |
| 33 |
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ |
| 34 |
$(function() { |
| 35 |
initMenu('',false,false,'search.php','Search'); |
| 36 |
}); |
| 37 |
/* @license-end */ |
| 38 |
</script> |
| 39 |
<div id="main-nav"></div> |
| 40 |
</div><!-- top --> |
| 41 |
<div class="header"> |
| 42 |
<div class="headertitle"><div class="title">high.c</div></div> |
| 43 |
</div><!--header--> |
| 44 |
<div class="contents"> |
| 45 |
<div class="fragment"><div class="line"><span class="comment">/*</span></div> |
| 46 |
<div class="line"><span class="comment"> This shows how to use the high level decoding API to easily decode</span></div> |
| 47 |
<div class="line"><span class="comment"> a Kate stream.</span></div> |
| 48 |
<div class="line"><span class="comment"> For clarity, error checking is omitted.</span></div> |
| 49 |
<div class="line"><span class="comment"> For simplicity, the input is assumed to be a single Kate stream.</span></div> |
| 50 |
<div class="line"><span class="comment"> Usually, Kate streams will be multiplexed with other streams (either</span></div> |
| 51 |
<div class="line"><span class="comment"> other Kate streams, or audio, or video). In these cases, the Ogg</span></div> |
| 52 |
<div class="line"><span class="comment"> part will have to be more complex, but the Kate specific code will</span></div> |
| 53 |
<div class="line"><span class="comment"> be the same.</span></div> |
| 54 |
<div class="line"><span class="comment"> */</span></div> |
| 55 |
<div class="line"> </div> |
| 56 |
<div class="line"><span class="preprocessor">#include <stdio.h></span></div> |
| 57 |
<div class="line"><span class="preprocessor">#include <string.h></span></div> |
| 58 |
<div class="line"><span class="preprocessor">#include <ogg/ogg.h></span></div> |
| 59 |
<div class="line"><span class="preprocessor">#include "common.h"</span></div> |
| 60 |
<div class="line"> </div> |
| 61 |
<div class="line"><span class="comment">/* All the libkate API is available from the main kate header file: */</span></div> |
| 62 |
<div class="line"> </div> |
| 63 |
<div class="line"><span class="preprocessor">#include <<a class="code" href="kate_8h.html">kate/kate.h</a>></span></div> |
| 64 |
<div class="line"> </div> |
| 65 |
<div class="line"><span class="keywordtype">int</span> main()</div> |
| 66 |
<div class="line">{</div> |
| 67 |
<div class="line"> ogg_sync_state oy;</div> |
| 68 |
<div class="line"> ogg_stream_state os;</div> |
| 69 |
<div class="line"> <span class="keywordtype">int</span> init=0;</div> |
| 70 |
<div class="line"> ogg_packet op;</div> |
| 71 |
<div class="line"> <a id="_a0" name="_a0"></a><a class="code hl_struct" href="structkate__state.html">kate_state</a> k;</div> |
| 72 |
<div class="line"> <span class="keyword">const</span> <a id="_a1" name="_a1"></a><a class="code hl_struct" href="structkate__event.html">kate_event</a> *ev;</div> |
| 73 |
<div class="line"> <a id="_a2" name="_a2"></a><a class="code hl_struct" href="structkate__packet.html">kate_packet</a> kp;</div> |
| 74 |
<div class="line"> </div> |
| 75 |
<div class="line"> <span class="comment">/* for the benefit of windows, which mangles data otherwise */</span></div> |
| 76 |
<div class="line"> set_binary_file(stdin);</div> |
| 77 |
<div class="line"> </div> |
| 78 |
<div class="line"> <span class="comment">/* we initialize ogg and the kate state */</span></div> |
| 79 |
<div class="line"> ogg_sync_init(&oy);</div> |
| 80 |
<div class="line"> <span class="keywordtype">int</span> ret=<a id="a3" name="a3"></a><a class="code hl_function" href="group__high.html#ga810984fb4ec910632c250672d39feee4">kate_high_decode_init</a>(&k);</div> |
| 81 |
<div class="line"> </div> |
| 82 |
<div class="line"> <span class="comment">/*</span></div> |
| 83 |
<div class="line"><span class="comment"> We then read packets and feed them to the libkate high level API. When</span></div> |
| 84 |
<div class="line"><span class="comment"> kate_high_decode_packetin returns a positive number, this signals the</span></div> |
| 85 |
<div class="line"><span class="comment"> end of the stream.</span></div> |
| 86 |
<div class="line"><span class="comment"> */</span></div> |
| 87 |
<div class="line"> <span class="keywordflow">while</span> (1) {</div> |
| 88 |
<div class="line"> <span class="keywordflow">if</span> (get_packet(&oy,&os,&init,&op)) <span class="keywordflow">break</span>;</div> |
| 89 |
<div class="line"> <a id="a4" name="a4"></a><a class="code hl_function" href="group__packet.html#ga7c0c2af28df8ea89f5f62e830dc916b1">kate_packet_wrap</a>(&kp,op.bytes,op.packet);</div> |
| 90 |
<div class="line"> <span class="keywordflow">if</span> (<a id="a5" name="a5"></a><a class="code hl_function" href="group__high.html#ga4c9bac57e090c34e778b6f080cd4df82">kate_high_decode_packetin</a>(&k,&kp,&ev)>0) <span class="keywordflow">break</span>;</div> |
| 91 |
<div class="line"> <span class="comment">/* if the event is non NULL, we have an event */</span></div> |
| 92 |
<div class="line"> <span class="keywordflow">if</span> (ev) {</div> |
| 93 |
<div class="line"> printf(<span class="stringliteral">"Kate stream has text: %s\n"</span>,ev-><a id="a6" name="a6"></a><a class="code hl_variable" href="structkate__event.html#ae10745a5078521816cc07a09654fbfd4">text</a>);</div> |
| 94 |
<div class="line"> }</div> |
| 95 |
<div class="line"> }</div> |
| 96 |
<div class="line"> </div> |
| 97 |
<div class="line"> <span class="comment">/* That's it, we can now cleanup */</span></div> |
| 98 |
<div class="line"> ogg_stream_clear(&os);</div> |
| 99 |
<div class="line"> ogg_sync_clear(&oy);</div> |
| 100 |
<div class="line"> </div> |
| 101 |
<div class="line"> <a id="a7" name="a7"></a><a class="code hl_function" href="group__high.html#ga8faebcd4839fb5a2bced259f8560f47f">kate_high_decode_clear</a>(&k);</div> |
| 102 |
<div class="line"> </div> |
| 103 |
<div class="line"> <span class="keywordflow">return</span> 0;</div> |
| 104 |
<div class="line">}</div> |
| 105 |
<div class="line"> </div> |
| 106 |
<div class="ttc" id="agroup__high_html_ga4c9bac57e090c34e778b6f080cd4df82"><div class="ttname"><a href="group__high.html#ga4c9bac57e090c34e778b6f080cd4df82">kate_high_decode_packetin</a></div><div class="ttdeci">int kate_high_decode_packetin(kate_state *k, kate_packet *kp, kate_const kate_event **ev)</div><div class="ttdef"><b>Definition:</b> kate_high.c:85</div></div> |
| 107 |
<div class="ttc" id="agroup__high_html_ga810984fb4ec910632c250672d39feee4"><div class="ttname"><a href="group__high.html#ga810984fb4ec910632c250672d39feee4">kate_high_decode_init</a></div><div class="ttdeci">int kate_high_decode_init(kate_state *k)</div><div class="ttdef"><b>Definition:</b> kate_high.c:27</div></div> |
| 108 |
<div class="ttc" id="agroup__high_html_ga8faebcd4839fb5a2bced259f8560f47f"><div class="ttname"><a href="group__high.html#ga8faebcd4839fb5a2bced259f8560f47f">kate_high_decode_clear</a></div><div class="ttdeci">int kate_high_decode_clear(kate_state *k)</div><div class="ttdef"><b>Definition:</b> kate_high.c:123</div></div> |
| 109 |
<div class="ttc" id="agroup__packet_html_ga7c0c2af28df8ea89f5f62e830dc916b1"><div class="ttname"><a href="group__packet.html#ga7c0c2af28df8ea89f5f62e830dc916b1">kate_packet_wrap</a></div><div class="ttdeci">int kate_packet_wrap(kate_packet *kp, size_t nbytes, const void *data)</div><div class="ttdef"><b>Definition:</b> kate_packet.c:30</div></div> |
| 110 |
<div class="ttc" id="akate_8h_html"><div class="ttname"><a href="kate_8h.html">kate.h</a></div></div> |
| 111 |
<div class="ttc" id="astructkate__event_html"><div class="ttname"><a href="structkate__event.html">kate_event</a></div><div class="ttdef"><b>Definition:</b> kate.h:358</div></div> |
| 112 |
<div class="ttc" id="astructkate__event_html_ae10745a5078521816cc07a09654fbfd4"><div class="ttname"><a href="structkate__event.html#ae10745a5078521816cc07a09654fbfd4">kate_event::text</a></div><div class="ttdeci">kate_const char * text</div><div class="ttdef"><b>Definition:</b> kate.h:371</div></div> |
| 113 |
<div class="ttc" id="astructkate__packet_html"><div class="ttname"><a href="structkate__packet.html">kate_packet</a></div><div class="ttdef"><b>Definition:</b> kate.h:526</div></div> |
| 114 |
<div class="ttc" id="astructkate__state_html"><div class="ttname"><a href="structkate__state.html">kate_state</a></div><div class="ttdef"><b>Definition:</b> kate.h:336</div></div> |
| 115 |
</div><!-- fragment --> </div><!-- contents --> |
| 116 |
<!-- start footer part --> |
| 117 |
<hr class="footer"/><address class="footer"><small> |
| 118 |
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4 |
| 119 |
</small></address> |
| 120 |
</body> |
| 121 |
</html> |