shaka-packager/docs/dc/d41/classshaka_1_1media_1_1Buff...

310 lines
19 KiB
HTML

<!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.6"/>
<title>DASH Media Packaging SDK: shaka::media::BufferWriter 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"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</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 style="padding-left: 0.5em;">
<div id="projectname">DASH Media Packaging SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
<li><a href="../../namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="../../annotated.html"><span>Classes</span></a></li>
<li><a href="../../files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="../../search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="../../annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="../../classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="../../hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="../../functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></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="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html">BufferWriter</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../d2/da9/classshaka_1_1media_1_1BufferWriter-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">shaka::media::BufferWriter Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="../../dd/dd2/buffer__writer_8h_source.html">buffer_writer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a01d91524fd5c5491bafcc1cff16db916"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html#a01d91524fd5c5491bafcc1cff16db916">BufferWriter</a> (size_t reserved_size_in_bytes)</td></tr>
<tr class="separator:a01d91524fd5c5491bafcc1cff16db916"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae44b09c03c9b8f0fbf58deb80355f299"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html#ae44b09c03c9b8f0fbf58deb80355f299">AppendNBytes</a> (uint64_t v, size_t num_bytes)</td></tr>
<tr class="separator:ae44b09c03c9b8f0fbf58deb80355f299"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a697768457da5482cb8fbc5d542985e92"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a697768457da5482cb8fbc5d542985e92"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendVector</b> (const std::vector&lt; uint8_t &gt; &amp;v)</td></tr>
<tr class="separator:a697768457da5482cb8fbc5d542985e92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3e6f1b9982c52c55c86ca8969e74fe7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae3e6f1b9982c52c55c86ca8969e74fe7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendArray</b> (const uint8_t *buf, size_t size)</td></tr>
<tr class="separator:ae3e6f1b9982c52c55c86ca8969e74fe7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4f794dddb2197605629d9ac33836f65"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae4f794dddb2197605629d9ac33836f65"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendBuffer</b> (const <a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html">BufferWriter</a> &amp;buffer)</td></tr>
<tr class="separator:ae4f794dddb2197605629d9ac33836f65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c82a43b9b4381a222cac25aabb71114"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0c82a43b9b4381a222cac25aabb71114"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>Swap</b> (<a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html">BufferWriter</a> *buffer)</td></tr>
<tr class="separator:a0c82a43b9b4381a222cac25aabb71114"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afeb292c178bd21d47dd84710fe274d22"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afeb292c178bd21d47dd84710fe274d22"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>SwapBuffer</b> (std::vector&lt; uint8_t &gt; *buffer)</td></tr>
<tr class="separator:afeb292c178bd21d47dd84710fe274d22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3bcbf8dde71ad8ac98bf6274b847cc83"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bcbf8dde71ad8ac98bf6274b847cc83"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>Clear</b> ()</td></tr>
<tr class="separator:a3bcbf8dde71ad8ac98bf6274b847cc83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ded41268568c25082b80401e75912b4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7ded41268568c25082b80401e75912b4"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><b>Size</b> () const </td></tr>
<tr class="separator:a7ded41268568c25082b80401e75912b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3054a98a4ec27764c65511dc17a916d"><td class="memItemLeft" align="right" valign="top">const uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html#ab3054a98a4ec27764c65511dc17a916d">Buffer</a> () const </td></tr>
<tr class="separator:ab3054a98a4ec27764c65511dc17a916d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a868dba843fcf923dd140fdda859a3a6d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d0/d93/classshaka_1_1media_1_1Status.html">Status</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html#a868dba843fcf923dd140fdda859a3a6d">WriteToFile</a> (<a class="el" href="../../d3/d61/classshaka_1_1media_1_1File.html">File</a> *file)</td></tr>
<tr class="separator:a868dba843fcf923dd140fdda859a3a6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:abd8854feedd8b45146eb04dacf7d5b2f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d41/classshaka_1_1media_1_1BufferWriter.html#abd8854feedd8b45146eb04dacf7d5b2f">AppendInt</a> (uint8_t v)</td></tr>
<tr class="separator:abd8854feedd8b45146eb04dacf7d5b2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abcc99a3ba412a7e67b699fbc3bbe97cd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abcc99a3ba412a7e67b699fbc3bbe97cd"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (uint16_t v)</td></tr>
<tr class="separator:abcc99a3ba412a7e67b699fbc3bbe97cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acccb1ec2840bd2cab8d47b8eb9efe0eb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acccb1ec2840bd2cab8d47b8eb9efe0eb"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (uint32_t v)</td></tr>
<tr class="separator:acccb1ec2840bd2cab8d47b8eb9efe0eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac0416c01d8c887024556b478c606e002"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac0416c01d8c887024556b478c606e002"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (uint64_t v)</td></tr>
<tr class="separator:ac0416c01d8c887024556b478c606e002"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a98426eb6587c144f44e0fd36bbab2d15"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a98426eb6587c144f44e0fd36bbab2d15"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (int16_t v)</td></tr>
<tr class="separator:a98426eb6587c144f44e0fd36bbab2d15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a3d4183a1ff6aca62db4a20af2b84a0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4a3d4183a1ff6aca62db4a20af2b84a0"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (int32_t v)</td></tr>
<tr class="separator:a4a3d4183a1ff6aca62db4a20af2b84a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aad58ece192586d2972c1ef56dde3dec1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aad58ece192586d2972c1ef56dde3dec1"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>AppendInt</b> (int64_t v)</td></tr>
<tr class="separator:aad58ece192586d2972c1ef56dde3dec1"><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 writer implementation which appends various data types to buffer. </p>
<p>Definition at line <a class="el" href="../../dd/dd2/buffer__writer_8h_source.html#l00022">22</a> of file <a class="el" href="../../dd/dd2/buffer__writer_8h_source.html">buffer_writer.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a01d91524fd5c5491bafcc1cff16db916"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">shaka::media::BufferWriter::BufferWriter </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>reserved_size_in_bytes</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct the object with a reserved capacity. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">reserved_size_in_bytes</td><td>is intended for optimization and is not a hard limit. It does not affect the actual size of the buffer, which still starts from zero. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html#l00020">20</a> of file <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html">buffer_writer.cc</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="abd8854feedd8b45146eb04dacf7d5b2f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void shaka::media::BufferWriter::AppendInt </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">
<p>These convenience functions append the integers (in network byte order, i.e. big endian) of various size and signedness to the end of the buffer. </p>
<p>Definition at line <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html#l00025">25</a> of file <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html">buffer_writer.cc</a>.</p>
</div>
</div>
<a class="anchor" id="ae44b09c03c9b8f0fbf58deb80355f299"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void shaka::media::BufferWriter::AppendNBytes </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">
<p>Append the least significant <em>num_bytes</em> of <em>v</em> to buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">num_bytes</td><td>should not be larger than sizeof(<em>v</em>), i.e. 8 on a 64-bit system. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html#l00047">47</a> of file <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html">buffer_writer.cc</a>.</p>
</div>
</div>
<a class="anchor" id="ab3054a98a4ec27764c65511dc17a916d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const uint8_t* shaka::media::BufferWriter::Buffer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</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>Underlying buffer. Behavior is undefined if the buffer size is 0. </dd></dl>
<p>Definition at line <a class="el" href="../../dd/dd2/buffer__writer_8h_source.html#l00059">59</a> of file <a class="el" href="../../dd/dd2/buffer__writer_8h_source.html">buffer_writer.h</a>.</p>
</div>
</div>
<a class="anchor" id="a868dba843fcf923dd140fdda859a3a6d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d0/d93/classshaka_1_1media_1_1Status.html">Status</a> shaka::media::BufferWriter::WriteToFile </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d3/d61/classshaka_1_1media_1_1File.html">File</a> *&#160;</td>
<td class="paramname"><em>file</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Write the buffer to file. The internal buffer will be cleared after writing. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file</td><td>should not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>OK on success. </dd></dl>
<p>Definition at line <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html#l00066">66</a> of file <a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html">buffer_writer.cc</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>media/base/<a class="el" href="../../dd/dd2/buffer__writer_8h_source.html">buffer_writer.h</a></li>
<li>media/base/<a class="el" href="../../dd/dd3/buffer__writer_8cc_source.html">buffer_writer.cc</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Apr 18 2017 21:14:12 for DASH Media Packaging SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>