1 <chapter id="chapter-buffers">
4 Buffers contain the data that will flow through the pipeline you have
5 created. A source element will typically create a new buffer and pass
6 it through a pad to the next element in the chain. When using the
7 GStreamer infrastructure to create a media pipeline you will not have
8 to deal with buffers yourself; the elements will do that for you.
16 a pointer to a piece of memory.
21 the size of the memory.
26 a timestamp for the buffer.
31 A refcount that indicates how many elements are using this
32 buffer. This refcount will be used to destroy the buffer when no
33 element has a reference to it.
40 <!-- FIXME: this is outdated, there is no GstBufferPool in gst-0.8.X -->
41 GStreamer provides functions to create custom buffer create/destroy algorithms, called
42 a <classname>GstBufferPool</classname>. This makes it possible to efficiently
43 allocate and destroy buffer memory. It also makes it possible to exchange memory between
44 elements by passing the <classname>GstBufferPool</classname>. A video element can,
45 for example, create a custom buffer allocation algorithm that creates buffers with XSHM
46 as the buffer memory. An element can use this algorithm to create and fill the buffer
51 The simple case is that a buffer is created, memory allocated, data put
52 in it, and passed to the next element. That element reads the data, does
53 something (like creating a new buffer and decoding into it), and
54 unreferences the buffer. This causes the data to be freed and the buffer
55 to be destroyed. A typical MPEG audio decoder works like this.
59 A more complex case is when the filter modifies the data in place. It
60 does so and simply passes on the buffer to the next element. This is just
61 as easy to deal with. An element that works in place has to be careful when
62 the buffer is used in more than one element; a copy on write has to made in this