swfdec.Buffer — Memory region handling.
class swfdec.Buffer(gobject.GBoxed): |
Functionsdef swfdec.buffer_new_from_file(filename)def swfdec.buffer_new_for_data(data,size)
This section describes how memory is to be handled when interacting with the Swfdec library.
Memory regions are refcounted and passed using a
swfdec.Buffer
If large memory segments need to be handled that may span multiple buffers, Swfdec uses a
swfdec.BufferQueue
To allow for easy sharing of memory regions,
swfdec.Buffer
was created. Every buffer refers to a memory region and its size and takes care
of freeing that region when the buffer is no longer needed. They are reference counted
to make it easy to refer to the same region from various independant parts of your code.
Buffers also support some advanced functionalities like extracting parts of the buffer using
swfdec.Buffer.new_subbuffer()
def get_super()Returns : | The largest buffer available that contains the memory pointed to by buffer. |
Returns the largest buffer that contains the memory pointed to by buffer.
This will either be the passed buffer itself, or if the buffer was created via
swfdec.Buffer.new_subbuffer(),
the buffer used for that.
def new_subbuffer(offset, length)
| A string describing the error. |
Returns : | A new swfdec.Buffer
managing the indicated region. |
Creates a swfdec.Buffer
for managing a partial section of the memory pointed to by buffer.
def buffer_new_from_file(filename)
| Name of the file to load. |
Returns : | A new swfdec.Buffer
or None on failure. |
Tries to create a buffer for the given filename using a GMappedFile. If the creation fails, None is returned and error is set. The error can be any of the errors that are valid from g_mapped_file_new().
def buffer_new_for_data(data, size)
| Memory region allocated with g_malloc(). |
| Size of data in bytes. |
Returns : | A new swfdec.Buffer
pointing to data. |
Takes ownership of data and creates a new buffer managing it.