swfdec.BufferQueue

swfdec.BufferQueue — Memory region handling.

Synopsis

class swfdec.BufferQueue(gobject.GBoxed):
    swfdec.BufferQueue()
def clear()
def flush(n_bytes)
def get_depth()
def get_offset()
def peek(length)
def peek_buffer()
def pull(length)
def pull_buffer()
def push(buffer)

Ancestry

+-- gobject.GBoxed
    +-- swfdec.BufferQueue

Description

A swfdec.BufferQueue is a queue of continuous buffers that allows reading its data in chunks of pre-defined sizes. It is used to transform a data stream that was provided by buffers of random sizes to buffers of the right size.

Constructor

    swfdec.BufferQueue()

Returns :

A new swfdec.BufferQueue

Creates a new swfdec.BufferQueue.

Methods

swfdec.BufferQueue.clear

    def clear()

Resets queue into to initial state. All buffers it contains will be released and the offset will be reset to 0.

swfdec.BufferQueue.flush

    def flush(n_bytes)

n_bytes :

amount of bytes to flush from the queue

Removes the first n_bytes bytes from the queue.

swfdec.BufferQueue.get_depth

    def get_depth()

Returns :

The amount of bytes in queue.

Returns the number of bytes currently in queue.

swfdec.BufferQueue.get_offset

    def get_offset()

Returns :

Number of bytes that were already pulled from this queue.

Queries the amount of bytes that has already been pulled out of queue using functions like swfdec.BufferQueue.pull()

swfdec.BufferQueue.peek

    def peek(length)

length :

Amount of bytes to peek.

Returns :

None if the requested amount of data wasn't available or a new readonly SwfdecBuffer.

Creates a new buffer with the first length bytes from queue, but unlike swfdec.BufferQueue.pull() does not remove them from queue.

swfdec.BufferQueue.peek_buffer

    def peek_buffer()

Returns :

The first buffer in queue or None if queue is empty.

Gets the first buffer out of queue and returns it. This function is equivalent to calling swfdec.BufferQueue.peek() with the size of the first buffer in it.

swfdec.BufferQueue.pull

    def pull(length)

length :

Amount of bytes to pull.

Returns :

A new SwfdecBuffer or None

If enough data is still available in queue, the first length bytes are put into a new buffer and that buffer is returned. The length bytes are removed from the head of the queue. If not enough data is available, None is returned.

swfdec.BufferQueue.pull_buffer

    def pull_buffer()

Returns :

The first buffer in queue or None if queue is empty.

Pulls the first buffer out of queue and returns it. This function is equivalent to calling swfdec.BufferQueue.pull() with the size of the first buffer in it.

swfdec.BufferQueue.push

    def push(buffer)

buffer :

SwfdecBuffer to append to queue.

Appends the given buffer to the buffers already in queue. This function will take ownership of the given buffer.