haiku-website/static/legacy-docs/bebook/BBuffer.html

78 lines
18 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Media Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheMediaKit.html" title="The Media Kit" /><link rel="prev" href="TheMediaKit.html" title="The Media Kit" /><link rel="next" href="BBufferConsumer.html" title="BBufferConsumer" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BBufferConsumer.html" title="BBufferConsumer"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Media Kit</div></div><div id="headerB">Prev: <a href="TheMediaKit.html">The Media Kit</a>  Up: <a href="TheMediaKit.html">The Media Kit</a>  Next: <a href="BBufferConsumer.html">BBufferConsumer</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer"></a>BBuffer</h2></div></div></div><a id="id1117429" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">media/Buffer.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libmedia.so</code></td></tr><tr><td>Allocation:</td><td>Constructor only</td></tr></tbody></table></td><td>
<a class="link overview" href="BBuffer_Overview.html" title="BBuffer">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BBuffer.html#BBuffer_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BBuffer.html#BBuffer_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BBuffer.html#BBuffer_Constants">Constants</a></span></li><li><span class="section"><a href="BBuffer.html#BBuffer_DefinedTypes">DefinedTypes</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><p>The <code class="classname">BBuffer</code> constructor and destructor
are private; use the appropriate functions in the
<a class="link" href="BBufferGroup.html" title="BBufferGroup"><code class="classname">BBufferGroup</code></a>
class to create and destroy <code class="classname">BBuffers</code>.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_AudioHeader"></a>AudioHeader()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="TheMediaKit_DefinedTypes.html#media_audio_header" title="media_audio_header">media_audio_header</a>* </span><span class="methodname">AudioHeader</span>();</code><p>Returns a pointer to an audio buffer's header; this is just an alias for:</p><pre class="programlisting cpp">&amp;<code class="classname">BBuffer</code>::<code class="methodname">Header</code>()-&gt;<code class="varname">u</code>.<code class="varname">raw_audio</code>;</pre></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_CloneInfo"></a>CloneInfo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">buffer_clone_info </span><span class="methodname">CloneInfo</span>() <span class="modifier">const</span>;</code><p>Returns a
<a class="link" href="BBuffer.html#buffer_clone_info" title="buffer_clone_info"><span class="type">buffer_clone_info</span></a>
structure describing a buffer. This information is primarily for debugging purposes; don't use this
<a class="link" href="BBuffer.html#buffer_clone_info" title="buffer_clone_info"><span class="type">buffer_clone_info</span></a>
structure to add a buffer to a buffer group, because
it'll just alias an existing buffer.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Data"></a>Data()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Data</span>();</code><p>The <code class="methodname">Data()</code> function returns a
pointer to the first byte of the buffer, or
<code class="constant">NULL</code> if the buffer somehow couldn't be properly initialized (in which
case the buffer can't be used).</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Flags"></a>Flags()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">Flags</span>();</code><p>Returns the buffer's flags. The flags let you specify options for the
buffer. For example, you might create a
<a class="link" href="BBufferGroup.html" title="BBufferGroup"><code class="classname">BBufferGroup</code></a>
in which some buffers are intended for odd video fields
(<code class="constant">B_F1_BUFFER</code>), and other buffers are intended for
even video fields (<code class="constant">B_F2_BUFFER</code>), thereby letting
you handle interlaced video much more easily by having each buffer know
where the video should be displayed.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Header"></a>Header()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">media_header* </span><span class="methodname">Header</span>();</code><p>Returns a pointer to the buffer's header. This header describes the media
data contained therein. The result is only valid for a buffer received
from either
<a class="link" href="BBufferGroup.html#BBufferGroup_RequestBuffer" title="RequestBuffer()"><code class="methodname">BBufferGroup::RequestBuffer()</code></a> or
<a class="link" href="BBufferConsumer.html#BBufferConsumer_BufferReceived" title="BufferReceived()"><code class="methodname">BBufferConsumer::BufferReceived()</code></a>.</p><p>If you put data into a buffer, you should call
<code class="methodname">Header()</code> to obtain a
pointer to the buffer's header, then fill out the
<a class="link" href="TheMediaKit_DefinedTypes.html#media_header" title="media_header"><span class="type">media_header</span></a>
structure with information describing the buffer's contents.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_ID"></a>ID()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">media_buffer_id </span><span class="methodname">ID</span>();</code><p>If the buffer has been successfully registered with the Media Server, and
is available for use by other clients, <code class="methodname">ID()</code> returns a positive buffer ID.
Otherwise, a negative number is returned.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Recycle"></a>Recycle()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Recycle</span>();</code><p>Sends the buffer back to the BBufferGroup that owns it so the buffer can
be reused. You can only call Recycle() on a buffer that you received from
either the
<a class="link" href="BBufferGroup.html#BBufferGroup_RequestBuffer" title="RequestBuffer()"><code class="methodname">BBufferGroup::RequestBuffer()</code></a>
call or the
<a class="link" href="BBufferConsumer.html#BBufferConsumer_BufferReceived" title="BufferReceived()"><code class="methodname">BBufferConsumer::BufferReceived()</code></a>
call.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>Don't call both
<span class="deprecated"><code class="methodname">BroadcastBuffer()</code></span>
and <code class="methodname">Recycle()</code> on the same buffer.</p></div></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_SizeAvailable"></a>SizeAvailable()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">size_t </span><span class="methodname">SizeAvailable</span>();</code><p>Returns the size, in bytes, of the buffer. The actual number of bytes
used might be less than this value, and is stored in the buffer's header,
which can be obtained by calling the
<a class="link" href="BBuffer.html#BBuffer_Header" title="Header()"><code class="methodname">Header()</code></a>
function.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_SizeUsed"></a><a id="BBuffer_SetSizeUsed"></a>
SizeUsed(), SetSizeUsed()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">size_t </span><span class="methodname">SizeUsed</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetSizeUsed</span>(<span class="methodparam"><span class="type">ssize_t </span><span class="parameter">sizeUsed</span></span>);</code><p><code class="methodname">SizeUsed()</code> returns the number of
bytes in the buffer that are currently in use.</p><p><code class="methodname">SetSizeUsed()</code> sets this value. This should be called after writing data
into the buffer in order to indicate the size of the written data.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Type"></a>Type()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">media_type </span><span class="methodname">Type</span>();</code><p>Returns the media type of the data contained within the buffer, as
specified by the
<a class="link" href="BBufferProducer.html" title="BBufferProducer"><code class="classname">BBufferProducer</code></a>
from which the buffer originated. This
value is only valid if you received the buffer from either the
<a class="link" href="BBufferGroup.html#BBufferGroup_RequestBuffer" title="RequestBuffer()"><code class="methodname">BBufferGroup::RequestBuffer()</code></a>
call or the
<a class="link" href="BBufferConsumer.html#BBufferConsumer_BufferReceived" title="BufferReceived()"><code class="methodname">BBufferConsumer::BufferReceived()</code></a>
call.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_VideoHeader"></a>VideoHeader()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">media_video_header* </span><span class="methodname">VideoHeader</span>();</code><p>Returns a pointer to a video buffer's header; this is just an alias for:</p><pre class="programlisting example cpp">&amp;<code class="classname">BBuffer</code>::<code class="methodname">Header</code>()-&gt;<code class="varname">u</code>.<code class="varname">raw_video</code>;</pre></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_Constants"></a>Constants</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="Constants_Flags"></a>Flags</h4></div></div></div><p>Declared in: <code class="filename">media/Buffer.h</code></p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_F1_BUFFER</code>.</span></p></td><td><p>Buffer is for odd fields.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_F2_BUFFER</code>.</span></p></td><td><p>Buffer is for even fields.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_SMALL_BUFFER</code>.</span></p></td><td><p>The buffer is a small buffer.</p></td></tr></tbody></table><p>These flags can be assigned to a buffer; the current possible values let
you specify whether the buffer should be used for even video fields or
odd video fields; if <code class="constant">B_SMALL_BUFFER</code> is set, the buffer is a
<a class="link" href="BSmallBuffer.html" title="BSmallBuffer"><code class="classname">BSmallBuffer</code></a>.</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBuffer_DefinedTypes"></a>DefinedTypes</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="buffer_clone_info"></a>buffer_clone_info</h4></div></div></div><a id="id1118600" class="indexterm"></a><p>Declared in: <code class="filename">media/Buffer.h</code></p><pre class="programlisting definition cpp"><span class="type">struct buffer_clone_info</span> {
<code class="methodname">buffer_clone_info</code>();
<code class="methodname">~buffer_clone_info</code>();
<span class="type">media_buffer_id</span> <code class="varname">buffer</code>;
<span class="type">area_id</span> <code class="varname">area</code>;
<span class="type">size_t</span> <code class="varname">offset</code>;
<span class="type">size_t</span> <code class="varname">size</code>;
<span class="type">int32</span> <code class="varname">flags</code>;
private:
<code class="varname">_reserved_</code>[4];
};</pre><p>Describes where in memory a <code class="classname">BBuffer</code>
resides (in terms of the memory area
and offset into the area at which the buffer is located, and the size of
the buffer), as well as the buffer's flags.</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheMediaKit.html">The Media Kit</a>  Up: <a href="TheMediaKit.html">The Media Kit</a>  Next: <a href="BBufferConsumer.html">BBufferConsumer</a> </div><div id="footerB"><div id="footerBL"><a href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMediaKit.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BBufferConsumer.html" title="BBufferConsumer"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>