swfdec.Buffer

swfdec.Buffer — Memory region handling.

Synopsis

class swfdec.Buffer(gobject.GBoxed):
    def get_super()
def new_subbuffer(offset, length)
Functions
    def swfdec.buffer_new_from_file(filename)
def swfdec.buffer_new_for_data(data, size)

swfdec.Buffer Attributes

"data"ReadThe data.
"length"ReadNumber of bytes in data.

Ancestry

+-- gobject.GBoxed
	+-- swfdec.Buffer

Description

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()

Methods

swfdec.Buffer.get_super

    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.

swfdec.Buffer.new_subbuffer

    def new_subbuffer(offset, length)

error :

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.

Functions

swfdec.buffer_new_from_file

    def buffer_new_from_file(filename)

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().

swfdec.buffer_new_for_data

    def buffer_new_for_data(data, size)

data :

Memory region allocated with g_malloc().

size :

Size of data in bytes.

Returns :

A new swfdec.Buffer pointing to data.

Takes ownership of data and creates a new buffer managing it.