Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > f0a9f2b9c81d34eadc43f527947c0b70 > files > 96

libgstreamer0.7-devel-0.7.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Buffers</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GStreamer Application Development Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Basic Concepts"
HREF="part-basic-concepts.html"><LINK
REL="PREVIOUS"
TITLE="Bins"
HREF="chapter-bins.html"><LINK
REL="NEXT"
TITLE="Element states"
HREF="chapter-states.html"></HEAD
><BODY
CLASS="chapter"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>GStreamer</SPAN
> Application Development Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="chapter-bins.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chapter-states.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="chapter-buffers"
></A
>Chapter 9. Buffers</H1
><P
> 
    Buffers contain the data that will flow through the pipeline you have
    created. A source element will typically create a new buffer and pass
    it through a pad to the next element in the chain.  When using the
    GStreamer infrastructure to create a media pipeline you will not have
    to deal with buffers yourself; the elements will do that for you.
  </P
><P
> 
    A buffer consists of:

    <P
></P
><UL
><LI
><P
>&#13;          a pointer to a piece of memory.
        </P
></LI
><LI
><P
>&#13;          the size of the memory.
        </P
></LI
><LI
><P
>&#13;          a timestamp for the buffer.
        </P
></LI
><LI
><P
>&#13;          A refcount that indicates how many elements are using this
          buffer. This refcount will be used to destroy the buffer when no
          element has a reference to it.
        </P
></LI
></UL
>
  </P
><P
> 
    GStreamer provides functions to create custom buffer create/destroy algorithms, called
    a <CODE
CLASS="classname"
>GstBufferPool</CODE
>. This makes it possible to efficiently 
    allocate and destroy buffer memory. It also makes it possible to exchange memory between
    elements by passing the <CODE
CLASS="classname"
>GstBufferPool</CODE
>. A video element can, 
    for example, create a custom buffer allocation algorithm that creates buffers with XSHM 
    as the buffer memory. An element can use this algorithm to create and fill the buffer 
    with data.
  </P
><P
> 
    The simple case is that a buffer is created, memory allocated, data put
    in it, and passed to the next element.  That element reads the data, does
    something (like creating a new buffer and decoding into it), and
    unreferences the buffer.  This causes the data to be freed and the buffer
    to be destroyed. A typical MPEG audio decoder works like this.
  </P
><P
> 
    A more complex case is when the filter modifies the data in place.  It
    does so and simply passes on the buffer to the next element.  This is just
    as easy to deal with. An element that works in place has to be careful when
    the buffer is used in more than one element; a copy on write has to made in this
    situation.
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="chapter-bins.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="chapter-states.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Bins</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="part-basic-concepts.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Element states</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>