1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
5
<refentry id="pyswfdec-bufferqueue">
8
<refname>swfdec.BufferQueue</refname>
9
<refpurpose>Memory region handling.</refpurpose>
13
<title>Synopsis</title>
15
<classsynopsis language="python">
16
<ooclass><classname>swfdec.BufferQueue</classname></ooclass>
17
<ooclass><classname>gobject.GBoxed</classname></ooclass>
19
<constructorsynopsis language="python">
20
<methodname><link linkend="constructor-bufferqueue">swfdec.BufferQueue</link></methodname>
21
<methodparam></methodparam>
22
</constructorsynopsis>
24
<methodsynopsis language="python">
25
<methodname><link linkend="method-swfbufferqueue--clear">clear</link></methodname>
26
<methodparam></methodparam>
29
<methodsynopsis language="python">
30
<methodname><link linkend="method-swfbufferqueue--flush">flush</link></methodname>
31
<methodparam><parameter role="keyword">n_bytes</parameter></methodparam>
34
<methodsynopsis language="python">
35
<methodname><link linkend="method-swfbufferqueue--get-depth">get_depth</link></methodname>
36
<methodparam></methodparam>
39
<methodsynopsis language="python">
40
<methodname><link linkend="method-swfbufferqueue--get-offset">get_offset</link></methodname>
41
<methodparam></methodparam>
44
<methodsynopsis language="python">
45
<methodname><link linkend="method-swfbufferqueue--peek">peek</link></methodname>
46
<methodparam><parameter role="keyword">length</parameter></methodparam>
49
<methodsynopsis language="python">
50
<methodname><link linkend="method-swfbufferqueue--peek-buffer">peek_buffer</link></methodname>
51
<methodparam></methodparam>
54
<methodsynopsis language="python">
55
<methodname><link linkend="method-swfbufferqueue--pull">pull</link></methodname>
56
<methodparam><parameter role="keyword">length</parameter></methodparam>
59
<methodsynopsis language="python">
60
<methodname><link linkend="method-swfbufferqueue--pull-buffer">pull_buffer</link></methodname>
61
<methodparam></methodparam>
64
<methodsynopsis language="python">
65
<methodname><link linkend="method-swfbufferqueue--push">push</link></methodname>
66
<methodparam><parameter role="keyword">buffer</parameter></methodparam>
73
<title>Ancestry</title>
75
<synopsis>+-- <link linkend="class-gobjectgboxed">gobject.GBoxed</link>
76
+-- <link linkend="pyswfdec-bufferqueue">swfdec.BufferQueue</link>
82
<title>Description</title>
84
A <link linkend="pyswfdec-bufferqueue"><classname>swfdec.BufferQueue</classname></link>
85
is a queue of continuous buffers that allows reading its data in chunks of pre-defined sizes.
86
It is used to transform a data stream that was provided by buffers of random sizes to buffers of the right size.
90
<refsect1 id="constructor-bufferqueue">
91
<title>Constructor</title>
93
<programlisting><constructorsynopsis language="python">
94
<methodname>swfdec.BufferQueue</methodname>
95
</constructorsynopsis></programlisting>
99
<term><emphasis>Returns</emphasis> :</term>
100
<listitem><simpara>A new
101
<link linkend="pyswfdec-bufferqueue"><classname>swfdec.BufferQueue</classname></link>
102
</simpara></listitem>
106
Creates a new <link linkend="pyswfdec-bufferqueue"><classname>swfdec.BufferQueue</classname></link>.
111
<title>Methods</title>
113
<refsect2 id="method-swfbufferqueue--clear">
114
<title>swfdec.BufferQueue.clear</title>
116
<programlisting><methodsynopsis language="python">
117
<methodname>clear</methodname>
118
<methodparam></methodparam>
119
</methodsynopsis></programlisting>
125
Resets queue into to initial state. All buffers it contains will
126
be released and the offset will be reset to 0.
130
<refsect2 id="method-swfbufferqueue--flush">
131
<title>swfdec.BufferQueue.flush</title>
133
<programlisting><methodsynopsis language="python">
134
<methodname>flush</methodname>
135
<methodparam><parameter role="keyword">n_bytes</parameter></methodparam>
136
</methodsynopsis></programlisting>
140
<term><parameter role="keyword">n_bytes</parameter> :</term>
141
<listitem><simpara>amount of bytes to flush from the queue </simpara></listitem>
146
Removes the first n_bytes bytes from the queue.
150
<refsect2 id="method-swfbufferqueue--get-depth">
151
<title>swfdec.BufferQueue.get_depth</title>
153
<programlisting><methodsynopsis language="python">
154
<methodname>get_depth</methodname>
155
<methodparam></methodparam>
156
</methodsynopsis></programlisting>
160
<term><emphasis>Returns</emphasis> :</term>
161
<listitem><simpara>The amount of bytes in queue.</simpara></listitem>
166
Returns the number of bytes currently in queue.
170
<refsect2 id="method-swfbufferqueue--get-offset">
171
<title>swfdec.BufferQueue.get_offset</title>
173
<programlisting><methodsynopsis language="python">
174
<methodname>get_offset</methodname>
175
<methodparam></methodparam>
176
</methodsynopsis></programlisting>
180
<term><emphasis>Returns</emphasis> :</term>
181
<listitem><simpara>Number of bytes that were already pulled from this queue.</simpara></listitem>
186
Queries the amount of bytes that has already been pulled out of
187
queue using functions like
188
<methodname><link linkend="method-swfbufferqueue--pull">swfdec.BufferQueue.pull()</link></methodname>
192
<refsect2 id="method-swfbufferqueue--peek">
193
<title>swfdec.BufferQueue.peek</title>
195
<programlisting><methodsynopsis language="python">
196
<methodname>peek</methodname>
197
<methodparam><parameter role="keyword">length</parameter></methodparam>
198
</methodsynopsis></programlisting>
202
<term><parameter role="keyword">length</parameter> :</term>
203
<listitem><simpara>Amount of bytes to peek.</simpara></listitem>
206
<term><emphasis>Returns</emphasis> :</term>
207
<listitem><simpara>None if the requested amount of data wasn't
208
available or a new readonly SwfdecBuffer.</simpara></listitem>
213
Creates a new buffer with the first length bytes from queue, but unlike
214
<methodname><link linkend="method-swfbufferqueue--pull">swfdec.BufferQueue.pull()</link></methodname>
215
does not remove them from queue.
219
<refsect2 id="method-swfbufferqueue--peek-buffer">
220
<title>swfdec.BufferQueue.peek_buffer</title>
222
<programlisting><methodsynopsis language="python">
223
<methodname>peek_buffer</methodname>
224
<methodparam></methodparam>
225
</methodsynopsis></programlisting>
229
<term><emphasis>Returns</emphasis> :</term>
230
<listitem><simpara>The first buffer in queue or <literal>None</literal>
231
if queue is empty.</simpara></listitem>
236
Gets the first buffer out of queue and returns it. This function is
237
equivalent to calling
238
<methodname><link linkend="method-swfbufferqueue--peek">swfdec.BufferQueue.peek</link></methodname>()
239
with the size of the first buffer in it.
243
<refsect2 id="method-swfbufferqueue--pull">
244
<title>swfdec.BufferQueue.pull</title>
246
<programlisting><methodsynopsis language="python">
247
<methodname>pull</methodname>
248
<methodparam><parameter role="keyword">length</parameter></methodparam>
249
</methodsynopsis></programlisting>
253
<term><parameter role="keyword">length</parameter> :</term>
254
<listitem><simpara>Amount of bytes to pull.</simpara></listitem>
257
<term><emphasis>Returns</emphasis> :</term>
258
<listitem><simpara>A new SwfdecBuffer or None</simpara></listitem>
263
If enough data is still available in queue, the first length bytes
264
are put into a new buffer and that buffer is returned. The length
265
bytes are removed from the head of the queue. If not enough data is available,
270
<refsect2 id="method-swfbufferqueue--pull-buffer">
271
<title>swfdec.BufferQueue.pull_buffer</title>
273
<programlisting><methodsynopsis language="python">
274
<methodname>pull_buffer</methodname>
275
<methodparam></methodparam>
276
</methodsynopsis></programlisting>
280
<term><emphasis>Returns</emphasis> :</term>
281
<listitem><simpara>The first buffer in queue or None if queue is empty.</simpara></listitem>
286
Pulls the first buffer out of queue and returns it. This function
287
is equivalent to calling
288
<methodname><link linkend="method-swfbufferqueue--pull">swfdec.BufferQueue.pull()</link></methodname>
289
with the size of the first buffer in it.
293
<refsect2 id="method-swfbufferqueue--push">
294
<title>swfdec.BufferQueue.push</title>
296
<programlisting><methodsynopsis language="python">
297
<methodname>push</methodname>
298
<methodparam><parameter role="keyword">buffer</parameter></methodparam>
299
</methodsynopsis></programlisting>
303
<term><parameter role="keyword">buffer</parameter> :</term>
304
<listitem><simpara>SwfdecBuffer to append to queue.</simpara></listitem>
309
Appends the given buffer to the buffers already in queue. This function
310
will take ownership of the given buffer.