Scatterbuffer Lists

A scatter buffer list specifies `frames' of data by specifying buffers of memory that contain the appropriate data. A scatter buffer list is simply a list of scatter buffers where each scatter buffer contains one frame of data. A frame of data is a logical piece of data given the data type. For example, for a video stream, each frame of data contains one picture. For an audio stream, each frame of data contains some number of seconds of audio. A scatter buffer is simply a list of tuples specifying a buffer, an offset into the buffer where the data starts, and the length of the data.

For example, the following is a scatter buffer list containing 3 frames of data:

In this example, the first frame of data consist of the first 100 bytes of buffer0, the first 200 bytes of buffer1, and bytes 300 to 400 of buffer0. Notice that the same buffer, buffer0, is used twice.

The second frame of data in this example, consists of the first 100 bytes of buffer2 and the first 500 bytes of buffer3.

The third frame consists of 1000 bytes from buffer0, starting at byte number 400. Note that buffer0 is used both in the first frame and the last frame.

The buffers are created using the buffer manager (see man page). Typically, the applica tion programmer does not need to know about or create any buffers. Objects that produce data will create and fill these buffers as appropriate and pass them to other objects using the push, pull, send, and accept semantics outlined above.

The C representation of a scatterbuffer list is defined by the following set of data structures:

The data structure (Buffer *) is a pointer to a buffer created through the C interface to the buffer manager.

Data Layout

Data is laid out within a scatter buffer in "chunks". The method is similar to the way data is laid out in chunk files in that each chunk is typed and contains length information. In our terminology, we will refer to chunks passed in buffers as buffer chunks.

Data passed between objects should be laid out in buffer chunks. Each buffer chunk has the following format:

Each buffer chunk should reside completely within one buffer. In other words, buffer chunks should not span different buffers within a scatterbuffer list. The values of buffer chunk type depend on the type of data being passed. The following links describe the format of data passed along object pipelines by type:

Utility procedures exist for finding a particular buffer chunk type within a scatterbuffer list. These procedures are defined in cmBufferlist.c and cmBufferUtil.c