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

51 lines
8.2 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.

<?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 - System Overview - 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_Overview.html" title="The Media Kit" /><link rel="prev" href="TheMediaKit_ExampleNode.html" title="A BMediaEventLooper Example" /><link rel="next" href="BBufferConsumer_Overview.html" title="BBufferConsumer" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheMediaKit_ExampleNode.html" title="A BMediaEventLooper Example"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMediaKit_Overview.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BBufferConsumer_Overview.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 - System Overview - The Media Kit</div></div><div id="headerB">Prev: <a href="TheMediaKit_ExampleNode.html">A BMediaEventLooper Example</a>  Up: <a href="TheMediaKit_Overview.html">The Media Kit</a>  Next: <a href="BBufferConsumer_Overview.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_Overview"></a>BBuffer</h2></div></div></div><a id="id583429" class="indexterm"></a><p>A <a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>
references a chunk of shared memory where media data can be
passed between applications and nodes. The control header for these
buffers is passed through the use of a safer IPC mechanism, but the
actual data these headers represent typically require a high data rate,
and for the sake of maximizing performance, shared memory is the method
by which the buffers are managed.</p><p><a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s
originate at some
<a class="link" href="BBufferProducer.html" title="BBufferProducer"><code class="classname">BBufferProducer</code></a>,
which has a
<a class="link" href="BBufferGroup.html" title="BBufferGroup"><code class="classname">BBufferGroup</code></a>
that acts as a source of
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s (see
<a class="link" href="BBufferConsumer.html#BBufferConsumer_SetOutputBuffersFor" title="SetOutputBuffersFor()"><code class="methodname">BBufferConsumer::SetOutputBuffersFor()</code></a>).
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s are sent through all
participating nodes, possibly being sent down a long chain—much
like a bucket brigade—until finally the node arrives at a node that
chooses not to pass along the
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>
any further, at which the buffer's
<a class="link" href="BBuffer.html#BBuffer_Recycle" title="Recycle()"><code class="methodname">Recycle()</code></a>
function is called to return the buffer to the
<a class="link" href="BBufferGroup.html" title="BBufferGroup"><code class="classname">BBufferGroup</code></a>'s
store, where it gets reused by another batch of data.</p><p>An application or custom node can set up
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>s that reference a
specific area of memory, such as a low-level driver buffer, a
<a class="link" href="BBitmap.html" title="BBitmap"><code class="classname">BBitmap</code></a>, or
a <a class="link" href="BDirectWindow.html" title="BDirectWindow"><code class="classname">BDirectWindow</code></a>'s
area of a frame buffer. This ability can provide for
great optimization by avoiding unnecessary copy operations.</p><p>The <a class="link" href="BSmallBuffer.html" title="BSmallBuffer"><code class="classname">BSmallBuffer</code></a>
class, derived from
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>, is used for very small
buffers; they don't go in
<a class="link" href="BBufferGroup.html" title="BBufferGroup"><code class="classname">BBufferGroup</code></a>s,
and get handled specially to optimize performance.</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><a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>
should never be subclassed, since they're mostly owned and
managed by the Media Server. Even if you create your own
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a>, once
you've called
<a class="link" href="BBufferConsumer.html#BBufferConsumer_SetOutputBuffersFor" title="SetOutputBuffersFor()"><code class="methodname">BBufferConsumer::SetOutputBuffersFor()</code></a>,
the "same" buffer received back by your
<a class="link" href="BBufferConsumer.html" title="BBufferConsumer"><code class="classname">BBufferConsumer</code></a>
may actually be another instance of the
<a class="link" href="BBuffer.html" title="BBuffer"><code class="classname">BBuffer</code></a> class.</p></div></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheMediaKit_ExampleNode.html">A BMediaEventLooper Example</a>  Up: <a href="TheMediaKit_Overview.html">The Media Kit</a>  Next: <a href="BBufferConsumer_Overview.html">BBufferConsumer</a> </div><div id="footerB"><div id="footerBL"><a href="TheMediaKit_ExampleNode.html" title="A BMediaEventLooper Example"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMediaKit_Overview.html" title="The Media Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BBufferConsumer_Overview.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>