[gst-devel] What are buffers?

Benjamin Otte in7y118 at public.uni-hamburg.de
Wed Mar 13 16:50:06 CET 2002

Buffers are the way that is used to exchange data between elements.
In addition to the data they carry important additional information that
is needed by elements processing theses buffers.

This additional information is:
- The position inside the stream.
This is currently represented by a timestamp and an offset. The events
branch uses an offset array including three fields: BYTE/TIME/FRAME
- A reference count and automatic destruction
The refcount is MT safe. The "free" and "dispose" function in the data
struct do this in the events branch.
(In the events branch I moved reference count and position from GstBuffer
to GstData because events need them, too.)
- The data
represented by the data and size field.
- The parent
An optional field.
- The bufferpool
bufferpool and bufferpool_private fields.
- flags
I'm not quite clear what the _ORIGINAL and _DONTFREE flags are used
for, but _READONLY is necessary. (DONTFREE should be implemented in the
bufferpool, no?)

If I am right with those two paragraphs there are some things I'd like to

a) The "maxsize" and "maxage" fields should go away
They are not handled at all by many plugins and are IMO quite useless.
b) The "free" and "copy" functions belong into the bufferpool
Buffers from the same bufferpool share theses functions.
c) A bufferpool should be mandatory
All plugins not currently using a bufferpool should get the default
bufferpool. This way we can easily do things like
#define gst_buffer_copy(buf) (buf)->bufferpool->copy(buf)
which gets some speed.
d) The mutex should go
If READONLY is not set, only one thread should use the buffer at any given
time anyway. If this is canot be guaranteed the READONLY flag is set in
which case the buffer is readonly anyway.
e) we need clear definitions about the offset information
- Is this information optional, should have (my vote) or even must have?
- What is this information representing? (original offset vs offset in
modified stream - eg after Mp3 decode; are timestamps always increasing
or can a seek to the start of the stream reset the timestamp (it should))
- Do we need all 3 (time/byte/frame offset) or do we need more or less
than that?

Ok, awaiting comments :)


More information about the gstreamer-devel mailing list