4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GstBuffer</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7
7
<link rel="home" href="index.html" title="GStreamer 0.10 Core Reference Manual">
8
8
<link rel="up" href="libgstreamer.html" title="GStreamer Core Library">
9
9
<link rel="prev" href="GstBin.html" title="GstBin">
10
10
<link rel="next" href="gstreamer-GstBufferList.html" title="GstBufferList">
11
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
83
83
#define <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-make-writable" title="gst_buffer_make_writable()">gst_buffer_make_writable</a> (buf)
84
84
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-is-metadata-writable" title="gst_buffer_is_metadata_writable ()">gst_buffer_is_metadata_writable</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf</code></em>);
85
85
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-make-metadata-writable" title="gst_buffer_make_metadata_writable ()">gst_buffer_make_metadata_writable</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf</code></em>);
86
#define <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-replace" title="gst_buffer_replace()">gst_buffer_replace</a> (obuf,
86
<span class="returnvalue">void</span> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-replace" title="gst_buffer_replace ()">gst_buffer_replace</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> **obuf</code></em>,
87
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *nbuf</code></em>);
88
<span class="returnvalue">void</span> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-set-qdata" title="gst_buffer_set_qdata ()">gst_buffer_set_qdata</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>,
89
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>,
90
<em class="parameter"><code><a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="type">GstStructure</span></a> *data</code></em>);
91
const <a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="returnvalue">GstStructure</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-get-qdata" title="gst_buffer_get_qdata ()">gst_buffer_get_qdata</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>,
92
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>);
88
93
<a class="link" href="gstreamer-GstCaps.html#GstCaps" title="struct GstCaps"><span class="returnvalue">GstCaps</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-get-caps" title="gst_buffer_get_caps ()">gst_buffer_get_caps</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>);
89
94
<span class="returnvalue">void</span> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-set-caps" title="gst_buffer_set_caps ()">gst_buffer_set_caps</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>,
90
95
<em class="parameter"><code><a class="link" href="gstreamer-GstCaps.html#GstCaps" title="struct GstCaps"><span class="type">GstCaps</span></a> *caps</code></em>);
94
99
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-is-span-fast" title="gst_buffer_is_span_fast ()">gst_buffer_is_span_fast</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
95
100
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>);
96
101
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-span" title="gst_buffer_span ()">gst_buffer_span</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
97
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> offset</code></em>,
102
<em class="parameter"><code><span class="type">guint32</span> offset</code></em>,
98
103
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>,
99
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> len</code></em>);
104
<em class="parameter"><code><span class="type">guint32</span> len</code></em>);
100
105
<span class="returnvalue">void</span> <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-stamp" title="gst_buffer_stamp ()">gst_buffer_stamp</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *dest</code></em>,
101
106
<em class="parameter"><code>const <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *src</code></em>);
102
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-join" title="gst_buffer_join ()">gst_buffer_join</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
107
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-join" title="gst_buffer_join ()">gst_buffer_join</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
103
108
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>);
104
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-merge" title="gst_buffer_merge ()">gst_buffer_merge</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
109
<a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * <a class="link" href="gstreamer-GstBuffer.html#gst-buffer-merge" title="gst_buffer_merge ()">gst_buffer_merge</a> (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
105
110
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>);
121
126
video frame with a given width, height and bits per plane.
123
128
<div class="example">
124
<a name="idp8458416"></a><p class="title"><b>Example 3. Creating a buffer for a video frame</b></p>
129
<a name="idp6568304"></a><p class="title"><b>Example 3. Creating a buffer for a video frame</b></p>
125
130
<div class="example-contents">
126
131
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
294
299
<td>the <a class="link" href="gstreamer-GstCaps.html#GstCaps" title="struct GstCaps"><span class="type">GstCaps</span></a> describing the data format in this buffer</td>
297
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="GstBuffer.offset"></a>offset</code></em>;</span></p></td>
302
<td><p><span class="term"><span class="type">guint64</span> <em class="structfield"><code><a name="GstBuffer.offset"></a>offset</code></em>;</span></p></td>
298
303
<td>a media specific offset for the buffer data.
299
304
For video frames, this is the frame number of this buffer.
300
305
For audio samples, this is the offset of the first sample in this buffer.
302
307
byte in this buffer.</td>
305
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="GstBuffer.offset-end"></a>offset_end</code></em>;</span></p></td>
310
<td><p><span class="term"><span class="type">guint64</span> <em class="structfield"><code><a name="GstBuffer.offset-end"></a>offset_end</code></em>;</span></p></td>
306
311
<td>the last offset contained in this buffer. It has the same
307
312
format as <em class="parameter"><code>offset</code></em>.</td>
310
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint8"><span class="type">guint8</span></a> *<em class="structfield"><code><a name="GstBuffer.malloc-data"></a>malloc_data</code></em>;</span></p></td>
315
<td><p><span class="term"><span class="type">guint8</span> *<em class="structfield"><code><a name="GstBuffer.malloc-data"></a>malloc_data</code></em>;</span></p></td>
311
316
<td>a pointer to the allocated memory associated with this buffer.
312
317
When the buffer is freed, this data will freed with <em class="parameter"><code>free_func</code></em>.</td>
416
421
<pre class="programlisting">typedef enum {
417
422
GST_BUFFER_COPY_FLAGS = (1 << 0),
418
423
GST_BUFFER_COPY_TIMESTAMPS = (1 << 1),
419
GST_BUFFER_COPY_CAPS = (1 << 2)
424
GST_BUFFER_COPY_CAPS = (1 << 2),
425
GST_BUFFER_COPY_QDATA = (1 << 3)
420
426
} GstBufferCopyFlags;
1130
1142
<div class="refsect2">
1131
<a name="gst-buffer-replace"></a><h3>gst_buffer_replace()</h3>
1132
<pre class="programlisting">#define gst_buffer_replace(obuf,nbuf)</pre>
1143
<a name="gst-buffer-replace"></a><h3>gst_buffer_replace ()</h3>
1144
<pre class="programlisting"><span class="returnvalue">void</span> gst_buffer_replace (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> **obuf</code></em>,
1145
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *nbuf</code></em>);</pre>
1134
1147
Modifies a pointer to a <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> to point to a different <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>. The
1135
1148
modification is done atomically (so this is useful for ensuring thread safety
1161
1174
<div class="refsect2">
1175
<a name="gst-buffer-set-qdata"></a><h3>gst_buffer_set_qdata ()</h3>
1176
<pre class="programlisting"><span class="returnvalue">void</span> gst_buffer_set_qdata (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>,
1177
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>,
1178
<em class="parameter"><code><a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="type">GstStructure</span></a> *data</code></em>);</pre>
1180
Set metadata structure for name quark <em class="parameter"><code>quark</code></em> to <em class="parameter"><code>data</code></em>, or remove the
1181
existing metadata structure by that name in case <em class="parameter"><code>data</code></em> is NULL.
1184
Takes ownership of <em class="parameter"><code>data</code></em>.
1186
<div class="variablelist"><table border="0">
1187
<col align="left" valign="top">
1190
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1191
<td>a <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>
1195
<td><p><span class="term"><em class="parameter"><code>quark</code></em> :</span></p></td>
1196
<td>name quark of data structure to set or replace</td>
1199
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
1200
<td>a <a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="type">GstStructure</span></a> to store with the
1201
buffer, name must match <em class="parameter"><code>quark</code></em>. Can be NULL to remove an existing
1202
structure. This function takes ownership of the structure passed. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1207
<p class="since">Since 0.10.36</p>
1210
<div class="refsect2">
1211
<a name="gst-buffer-get-qdata"></a><h3>gst_buffer_get_qdata ()</h3>
1212
<pre class="programlisting">const <a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="returnvalue">GstStructure</span></a> * gst_buffer_get_qdata (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>,
1213
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> quark</code></em>);</pre>
1215
Get metadata structure for name quark <em class="parameter"><code>quark</code></em>.
1217
<div class="variablelist"><table border="0">
1218
<col align="left" valign="top">
1221
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1222
<td>a <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>
1226
<td><p><span class="term"><em class="parameter"><code>quark</code></em> :</span></p></td>
1227
<td>name quark of data structure to find</td>
1230
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1231
<td>a <a class="link" href="gstreamer-GstStructure.html#GstStructure" title="struct GstStructure"><span class="type">GstStructure</span></a>, or NULL if not found. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
1236
<p class="since">Since 0.10.36</p>
1239
<div class="refsect2">
1162
1240
<a name="gst-buffer-get-caps"></a><h3>gst_buffer_get_caps ()</h3>
1163
1241
<pre class="programlisting"><a class="link" href="gstreamer-GstCaps.html#GstCaps" title="struct GstCaps"><span class="returnvalue">GstCaps</span></a> * gst_buffer_get_caps (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buffer</code></em>);</pre>
1286
1364
<div class="refsect2">
1287
1365
<a name="gst-buffer-span"></a><h3>gst_buffer_span ()</h3>
1288
1366
<pre class="programlisting"><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * gst_buffer_span (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
1289
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> offset</code></em>,
1367
<em class="parameter"><code><span class="type">guint32</span> offset</code></em>,
1290
1368
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>,
1291
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> len</code></em>);</pre>
1369
<em class="parameter"><code><span class="type">guint32</span> len</code></em>);</pre>
1293
1371
Creates a new buffer that consists of part of buf1 and buf2.
1294
1372
Logically, buf1 and buf2 are concatenated into a single larger
1370
1448
<div class="refsect2">
1371
1449
<a name="gst-buffer-join"></a><h3>gst_buffer_join ()</h3>
1372
<pre class="programlisting"><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * gst_buffer_join (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
1450
<pre class="programlisting"><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * gst_buffer_join (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
1373
1451
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>);</pre>
1375
1453
Create a new buffer that is the concatenation of the two source
1392
1470
<td><p><span class="term"><em class="parameter"><code>buf1</code></em> :</span></p></td>
1393
<td>the first source <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>.</td>
1471
<td>the first source <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1396
1475
<td><p><span class="term"><em class="parameter"><code>buf2</code></em> :</span></p></td>
1397
<td>the second source <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>.</td>
1476
<td>the second source <a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1400
1480
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1409
1489
<div class="refsect2">
1410
1490
<a name="gst-buffer-merge"></a><h3>gst_buffer_merge ()</h3>
1411
<pre class="programlisting"><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * gst_buffer_merge (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
1491
<pre class="programlisting"><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="returnvalue">GstBuffer</span></a> * gst_buffer_merge (<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf1</code></em>,
1412
1492
<em class="parameter"><code><a class="link" href="gstreamer-GstBuffer.html#GstBuffer" title="struct GstBuffer"><span class="type">GstBuffer</span></a> *buf2</code></em>);</pre>
1414
1494
Create a new buffer that is the concatenation of the two source