swfdec.BufferQueue — Memory region handling.
class swfdec.BufferQueue(gobject.GBoxed): |
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.
def clear()Resets queue into to initial state. All buffers it contains will be released and the offset will be reset to 0.
def flush(n_bytes)
| amount of bytes to flush from the queue |
Removes the first n_bytes bytes from the queue.
def get_depth()Returns : | The amount of bytes in queue. |
Returns the number of bytes currently in queue.
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()
def peek(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.
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.
def pull(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.
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.