shaka-packager/docs/d9/d13/classshaka_1_1media_1_1Buff...

273 lines
17 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
2021-06-22 00:16:40 +00:00
<meta name="generator" content="Doxygen 1.8.17"/>
2018-02-10 23:37:42 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Shaka Packager SDK: shaka::media::BufferReader Class Reference</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="../../search/search.css" rel="stylesheet" type="text/css"/>
2018-02-10 23:37:42 +00:00
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.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;">
2018-02-10 23:37:42 +00:00
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Shaka Packager SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
2021-06-22 00:16:40 +00:00
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2021-06-22 00:16:40 +00:00
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
2018-02-10 23:37:42 +00:00
<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 */
2018-02-10 23:37:42 +00:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
2018-02-10 23:37:42 +00:00
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
2018-02-10 23:37:42 +00:00
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="../../d8/daf/namespaceshaka.html">shaka</a></li><li class="navelem"><b>media</b></li><li class="navelem"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html">BufferReader</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../d9/dc4/classshaka_1_1media_1_1BufferReader-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">shaka::media::BufferReader Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="../../de/d3e/buffer__reader_8h_source.html">buffer_reader.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for shaka::media::BufferReader:</div>
<div class="dyncontent">
<div class="center">
<img src="../../d9/d13/classshaka_1_1media_1_1BufferReader.png" usemap="#shaka::media::BufferReader_map" alt=""/>
<map id="shaka::media::BufferReader_map" name="shaka::media::BufferReader_map">
<area href="../../d1/dee/classshaka_1_1media_1_1mp4_1_1BoxReader.html" title="Class for reading MP4 boxes." alt="shaka::media::mp4::BoxReader" shape="rect" coords="0,56,181,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a94771befc54d444630ade726689b7bf7"><td class="memItemLeft" align="right" valign="top"><a id="a94771befc54d444630ade726689b7bf7"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#a94771befc54d444630ade726689b7bf7">BufferReader</a> (const uint8_t *buf, size_t size)</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memdesc:a94771befc54d444630ade726689b7bf7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a <a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html">BufferReader</a> from a raw buffer. <br /></td></tr>
<tr class="separator:a94771befc54d444630ade726689b7bf7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a208f2fda9ea3e79583284c951642c356"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#a208f2fda9ea3e79583284c951642c356">HasBytes</a> (size_t count)</td></tr>
<tr class="separator:a208f2fda9ea3e79583284c951642c356"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a8b4d02b2edaa39f8fc096b6f149764e0"><td class="memItemLeft" align="right" valign="top"><a id="a8b4d02b2edaa39f8fc096b6f149764e0"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>ReadToVector</b> (std::vector&lt; uint8_t &gt; *t, size_t count) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a8b4d02b2edaa39f8fc096b6f149764e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a888127e78a76a19d0749c5b01451b493"><td class="memItemLeft" align="right" valign="top"><a id="a888127e78a76a19d0749c5b01451b493"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>ReadToString</b> (std::string *str, size_t size) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a888127e78a76a19d0749c5b01451b493"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae2e74844020e15fb3c2d2a7b5bfb31f5"><td class="memItemLeft" align="right" valign="top"><a id="ae2e74844020e15fb3c2d2a7b5bfb31f5"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#ae2e74844020e15fb3c2d2a7b5bfb31f5">ReadCString</a> (std::string *str) WARN_UNUSED_RESULT</td></tr>
<tr class="memdesc:ae2e74844020e15fb3c2d2a7b5bfb31f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a null-terminated string. <br /></td></tr>
<tr class="separator:ae2e74844020e15fb3c2d2a7b5bfb31f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b15dfcd6ff891a9cb7b76f48d91d15d"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#a2b15dfcd6ff891a9cb7b76f48d91d15d">SkipBytes</a> (size_t num_bytes) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a2b15dfcd6ff891a9cb7b76f48d91d15d"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a75456499498bef53caecc9166bce6a33"><td class="memItemLeft" align="right" valign="top"><a id="a75456499498bef53caecc9166bce6a33"></a>
const uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><b>data</b> () const</td></tr>
<tr class="separator:a75456499498bef53caecc9166bce6a33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab57b2f4f88109f31961c4bbe5c1c5fcc"><td class="memItemLeft" align="right" valign="top"><a id="ab57b2f4f88109f31961c4bbe5c1c5fcc"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><b>size</b> () const</td></tr>
<tr class="separator:ab57b2f4f88109f31961c4bbe5c1c5fcc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1655078d96e5f7a03428020424e030b7"><td class="memItemLeft" align="right" valign="top"><a id="a1655078d96e5f7a03428020424e030b7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>set_size</b> (size_t size)</td></tr>
<tr class="separator:a1655078d96e5f7a03428020424e030b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a82af61ddda36780d484bccbbb81a7616"><td class="memItemLeft" align="right" valign="top"><a id="a82af61ddda36780d484bccbbb81a7616"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><b>pos</b> () const</td></tr>
<tr class="separator:a82af61ddda36780d484bccbbb81a7616"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:a65b65ad5a5ebc9d66182c38ec9876c05"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#a65b65ad5a5ebc9d66182c38ec9876c05">Read1</a> (uint8_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a65b65ad5a5ebc9d66182c38ec9876c05"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a0c0cd94e66518ac4bab45de8d9925339"><td class="memItemLeft" align="right" valign="top"><a id="a0c0cd94e66518ac4bab45de8d9925339"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read2</b> (uint16_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a0c0cd94e66518ac4bab45de8d9925339"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a19eb7704f5ddbed3157c2e5ac8c7ef90"><td class="memItemLeft" align="right" valign="top"><a id="a19eb7704f5ddbed3157c2e5ac8c7ef90"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read2s</b> (int16_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a19eb7704f5ddbed3157c2e5ac8c7ef90"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:ab96a57f54c9b6133f6d3e8e286c8e344"><td class="memItemLeft" align="right" valign="top"><a id="ab96a57f54c9b6133f6d3e8e286c8e344"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read4</b> (uint32_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:ab96a57f54c9b6133f6d3e8e286c8e344"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:aee877a7aaed1d54d0d27926535b510c8"><td class="memItemLeft" align="right" valign="top"><a id="aee877a7aaed1d54d0d27926535b510c8"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read4s</b> (int32_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:aee877a7aaed1d54d0d27926535b510c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:af35eef03acef17082419d761019422ca"><td class="memItemLeft" align="right" valign="top"><a id="af35eef03acef17082419d761019422ca"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read8</b> (uint64_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:af35eef03acef17082419d761019422ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a85912ce8cb834cda8ab3c462eaa612e8"><td class="memItemLeft" align="right" valign="top"><a id="a85912ce8cb834cda8ab3c462eaa612e8"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>Read8s</b> (int64_t *v) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a85912ce8cb834cda8ab3c462eaa612e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:ac98c6631c07300a6b78ec58bfd4ced30"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d13/classshaka_1_1media_1_1BufferReader.html#ac98c6631c07300a6b78ec58bfd4ced30">ReadNBytesInto8</a> (uint64_t *v, size_t num_bytes) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:ac98c6631c07300a6b78ec58bfd4ced30"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a2e3aa35e13ae225dc1159e159ca086a1"><td class="memItemLeft" align="right" valign="top"><a id="a2e3aa35e13ae225dc1159e159ca086a1"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>ReadNBytesInto8s</b> (int64_t *v, size_t num_bytes) WARN_UNUSED_RESULT</td></tr>
<tr class="separator:a2e3aa35e13ae225dc1159e159ca086a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A simple buffer reader implementation, which reads data of various types from a fixed byte array. </p>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../de/d3e/buffer__reader_8h_source.html#l00023">23</a> of file <a class="el" href="../../de/d3e/buffer__reader_8h_source.html">buffer_reader.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
2018-02-10 23:37:42 +00:00
<a id="a208f2fda9ea3e79583284c951642c356"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a208f2fda9ea3e79583284c951642c356">&#9670;&nbsp;</a></span>HasBytes()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::media::BufferReader::HasBytes </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>count</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>true if there are more than <em>count</em> bytes in the stream, false otherwise. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../de/d3e/buffer__reader_8h_source.html#l00032">32</a> of file <a class="el" href="../../de/d3e/buffer__reader_8h_source.html">buffer_reader.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a65b65ad5a5ebc9d66182c38ec9876c05"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65b65ad5a5ebc9d66182c38ec9876c05">&#9670;&nbsp;</a></span>Read1()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool shaka::media::BufferReader::Read1 </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>v</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Read a value from the stream, performing endian correction, and advance the stream pointer. </p><dl class="section return"><dt>Returns</dt><dd>false if there are not enough bytes in the buffer. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html#l00014">14</a> of file <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html">buffer_reader.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ac98c6631c07300a6b78ec58bfd4ced30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac98c6631c07300a6b78ec58bfd4ced30">&#9670;&nbsp;</a></span>ReadNBytesInto8()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool shaka::media::BufferReader::ReadNBytesInto8 </td>
<td>(</td>
<td class="paramtype">uint64_t *&#160;</td>
<td class="paramname"><em>v</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>num_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Read N-byte integer of the corresponding signedness and store it in the 8-byte return type. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">num_bytes</td><td>should not be larger than 8 bytes. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>false if there are not enough bytes in the buffer, true otherwise. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html#l00040">40</a> of file <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html">buffer_reader.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a2b15dfcd6ff891a9cb7b76f48d91d15d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b15dfcd6ff891a9cb7b76f48d91d15d">&#9670;&nbsp;</a></span>SkipBytes()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool shaka::media::BufferReader::SkipBytes </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>num_bytes</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Advance the stream by this many bytes. </p><dl class="section return"><dt>Returns</dt><dd>false if there are not enough bytes in the buffer, true otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html#l00077">77</a> of file <a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html">buffer_reader.cc</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>packager/media/base/<a class="el" href="../../de/d3e/buffer__reader_8h_source.html">buffer_reader.h</a></li>
<li>packager/media/base/<a class="el" href="../../dd/dbc/buffer__reader_8cc_source.html">buffer_reader.cc</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
2021-06-22 00:16:40 +00:00
Generated on Tue Jun 22 2021 00:16:05 for Shaka Packager SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>