This file is indexed.

/usr/share/doc/gstreamer1.0-doc/gstreamer-libs-1.0/GstAdapter.html is in gstreamer1.0-doc 1.2.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GstAdapter</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GStreamer 1.0 Library Reference Manual">
<link rel="up" href="gstreamer-base.html" title="GStreamer Base and Utillity Classes">
<link rel="prev" href="GstPushSrc.html" title="GstPushSrc">
<link rel="next" href="gstreamer-libs-GstBitReader.html" title="GstBitReader">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GstPushSrc.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gstreamer-base.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GStreamer 1.0 Library Reference Manual</th>
<td><a accesskey="n" href="gstreamer-libs-GstBitReader.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GstAdapter.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GstAdapter.description" class="shortcut">Description</a>
                   | 
                  <a href="#GstAdapter.object-hierarchy" class="shortcut">Object Hierarchy</a>
</td></tr>
</table>
<div class="refentry">
<a name="GstAdapter"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GstAdapter.top_of_page"></a>GstAdapter</span></h2>
<p>GstAdapter — adapts incoming data on a sink pad into chunks of N bytes</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GstAdapter.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gst/base/gstadapter.h&gt;

                    <a class="link" href="GstAdapter.html#GstAdapter-struct" title="GstAdapter">GstAdapter</a>;
<a class="link" href="GstAdapter.html" title="GstAdapter"><span class="returnvalue">GstAdapter</span></a> *        <a class="link" href="GstAdapter.html#gst-adapter-new" title="gst_adapter_new ()">gst_adapter_new</a>                     (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GstAdapter.html#gst-adapter-clear" title="gst_adapter_clear ()">gst_adapter_clear</a>                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()">gst_adapter_push</a>                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> *buf</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"><span class="returnvalue">gconstpointer</span></a>       <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()">gst_adapter_map</a>                     (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()">gst_adapter_unmap</a>                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()">gst_adapter_copy</a>                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> dest</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GstAdapter.html#gst-adapter-flush" title="gst_adapter_flush ()">gst_adapter_flush</a>                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> flush</code></em>);
<span class="returnvalue">gsize</span>               <a class="link" href="GstAdapter.html#gst-adapter-available" title="gst_adapter_available ()">gst_adapter_available</a>               (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);
<span class="returnvalue">gsize</span>               <a class="link" href="GstAdapter.html#gst-adapter-available-fast" title="gst_adapter_available_fast ()">gst_adapter_available_fast</a>          (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()">gst_adapter_take</a>                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="returnvalue">GstBuffer</span></a> *         <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()">gst_adapter_take_buffer</a>             (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="GstAdapter.html#gst-adapter-take-list" title="gst_adapter_take_list ()">gst_adapter_take_list</a>               (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>        <a class="link" href="GstAdapter.html#gst-adapter-prev-pts" title="gst_adapter_prev_pts ()">gst_adapter_prev_pts</a>                (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>        <a class="link" href="GstAdapter.html#gst-adapter-prev-dts" title="gst_adapter_prev_dts ()">gst_adapter_prev_dts</a>                (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);
<span class="returnvalue">gssize</span>              <a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32" title="gst_adapter_masked_scan_uint32 ()">gst_adapter_masked_scan_uint32</a>      (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);
<span class="returnvalue">gssize</span>              <a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32-peek" title="gst_adapter_masked_scan_uint32_peek ()">gst_adapter_masked_scan_uint32_peek</a> (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> *value</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GstAdapter.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GstAdapter
</pre>
</div>
<div class="refsect1">
<a name="GstAdapter.description"></a><h2>Description</h2>
<p>
This class is for elements that receive buffers in an undesired size.
While for example raw video contains one image per buffer, the same is not
true for a lot of other formats, especially those that come directly from
a file. So if you have undefined buffer sizes and require a specific size,
this object is for you.
</p>
<p>
An adapter is created with <a class="link" href="GstAdapter.html#gst-adapter-new" title="gst_adapter_new ()"><code class="function">gst_adapter_new()</code></a>. It can be freed again with
<a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.
</p>
<p>
The theory of operation is like this: All buffers received are put
into the adapter using <a class="link" href="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()"><code class="function">gst_adapter_push()</code></a> and the data is then read back
in chunks of the desired size using <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>/<a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a>
and/or <a class="link" href="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()"><code class="function">gst_adapter_copy()</code></a>. After the data has been processed, it is freed
using <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a>.
</p>
<p>
Other methods such as <a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a> and <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>
combine <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a> and <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a> in one method and are
potentially more convenient for some use cases.
</p>
<p>
For example, a sink pad's chain function that needs to pass data to a library
in 512-byte chunks could be implemented like this:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> GstFlowReturn
<span class="function">sink_pad_chain</span> <span class="gtkdoc opt">(</span>GstPad <span class="gtkdoc opt">*</span>pad<span class="gtkdoc opt">,</span> GstObject <span class="gtkdoc opt">*</span>parent<span class="gtkdoc opt">,</span> GstBuffer <span class="gtkdoc opt">*</span>buffer<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  MyElement <span class="gtkdoc opt">*</span><span class="keyword">this</span><span class="gtkdoc opt">;</span>
  GstAdapter <span class="gtkdoc opt">*</span>adapter<span class="gtkdoc opt">;</span>
  GstFlowReturn ret <span class="gtkdoc opt">=</span> GST_FLOW_OK<span class="gtkdoc opt">;</span>

  <span class="keyword">this</span> <span class="gtkdoc opt">=</span> <span class="function">MY_ELEMENT</span> <span class="gtkdoc opt">(</span>parent<span class="gtkdoc opt">);</span>

  adapter <span class="gtkdoc opt">=</span> <span class="keyword">this</span><span class="gtkdoc opt">-&gt;</span>adapter<span class="gtkdoc opt">;</span>

  <span class="gtkdoc slc">// put buffer into adapter</span>
  <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-push">gst_adapter_push</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> buffer<span class="gtkdoc opt">);</span>

  <span class="gtkdoc slc">// while we can read out 512 bytes, process them</span>
  <span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-available">gst_adapter_available</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">) &gt;=</span> <span class="number">512</span> <span class="gtkdoc opt">&amp;&amp;</span> ret <span class="gtkdoc opt">==</span> GST_FLOW_OK<span class="gtkdoc opt">) {</span>
    <span class="gtkdoc kwb">const</span> guint8 <span class="gtkdoc opt">*</span>data <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-map">gst_adapter_map</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> <span class="number">512</span><span class="gtkdoc opt">);</span>
    <span class="gtkdoc slc">// use flowreturn as an error value</span>
    ret <span class="gtkdoc opt">=</span> <span class="function">my_library_foo</span> <span class="gtkdoc opt">(</span>data<span class="gtkdoc opt">);</span>
    <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-unmap">gst_adapter_unmap</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">);</span>
    <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-flush">gst_adapter_flush</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> <span class="number">512</span><span class="gtkdoc opt">);</span>
  <span class="gtkdoc opt">}</span>
  <span class="keyword">return</span> ret<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
For another example, a simple element inside GStreamer that uses GstAdapter
is the libvisual element.
</p>
<p>
An element using GstAdapter in its sink pad chain function should ensure that
when the FLUSH_STOP event is received, that any queued data is cleared using
<a class="link" href="GstAdapter.html#gst-adapter-clear" title="gst_adapter_clear ()"><code class="function">gst_adapter_clear()</code></a>. Data should also be cleared or processed on EOS and
when changing state from <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#GST-STATE-PAUSED:CAPS"><span class="type">GST_STATE_PAUSED</span></a> to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#GST-STATE-READY:CAPS"><span class="type">GST_STATE_READY</span></a>.
</p>
<p>
Also check the GST_BUFFER_FLAG_DISCONT flag on the buffer. Some elements might
need to clear the adapter after a discontinuity.
</p>
<p>
The adapter will keep track of the timestamps of the buffers
that were pushed. The last seen timestamp before the current position
can be queried with <a class="link" href="GstAdapter.html#gst-adapter-prev-pts" title="gst_adapter_prev_pts ()"><code class="function">gst_adapter_prev_pts()</code></a>. This function can
optionally return the number of bytes between the start of the buffer that
carried the timestamp and the current adapter position. The distance is
useful when dealing with, for example, raw audio samples because it allows
you to calculate the timestamp of the current adapter position by using the
last seen timestamp and the amount of bytes since.  Additionally, the
<code class="function">gst_adapter_prev_pts_at_offset()</code> can be used to determine the last
seen timestamp at a particular offset in the adapter.
</p>
<p>
A last thing to note is that while GstAdapter is pretty optimized,
merging buffers still might be an operation that requires a <code class="function">malloc()</code> and
<code class="function">memcpy()</code> operation, and these operations are not the fastest. Because of
this, some functions like <a class="link" href="GstAdapter.html#gst-adapter-available-fast" title="gst_adapter_available_fast ()"><code class="function">gst_adapter_available_fast()</code></a> are provided to help
speed up such cases should you want to. To avoid repeated memory allocations,
<a class="link" href="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()"><code class="function">gst_adapter_copy()</code></a> can be used to copy data into a (statically allocated)
user provided buffer.
</p>
<p>
GstAdapter is not MT safe. All operations on an adapter must be serialized by
the caller. This is not normally a problem, however, as the normal use case
of GstAdapter is inside one pad's chain function, in which case access is
serialized via the pad's STREAM_LOCK.
</p>
<p>
Note that <a class="link" href="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()"><code class="function">gst_adapter_push()</code></a> takes ownership of the buffer passed. Use
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-ref"><code class="function">gst_buffer_ref()</code></a> before pushing it into the adapter if you still want to
access the buffer later. The adapter will never modify the data in the
buffer pushed in it.
</p>
<p>
Last reviewed on 2009-05-13 (0.10.24).
</p>
</div>
<div class="refsect1">
<a name="GstAdapter.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GstAdapter-struct"></a><h3>GstAdapter</h3>
<pre class="programlisting">typedef struct _GstAdapter GstAdapter;</pre>
<p>
The opaque <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> data structure.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-new"></a><h3>gst_adapter_new ()</h3>
<pre class="programlisting"><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="returnvalue">GstAdapter</span></a> *        gst_adapter_new                     (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>. Free with <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-clear"></a><h3>gst_adapter_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gst_adapter_clear                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>
Removes all buffers from <em class="parameter"><code>adapter</code></em>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-push"></a><h3>gst_adapter_push ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gst_adapter_push                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> *buf</code></em>);</pre>
<p>
Adds the data from <em class="parameter"><code>buf</code></em> to the data stored inside <em class="parameter"><code>adapter</code></em> and takes
ownership of the buffer.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> to add to queue in the adapter. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-map"></a><h3>gst_adapter_map ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"><span class="returnvalue">gconstpointer</span></a>       gst_adapter_map                     (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>
Gets the first <em class="parameter"><code>size</code></em> bytes stored in the <em class="parameter"><code>adapter</code></em>. The returned pointer is
valid until the next function is called on the adapter.
</p>
<p>
Note that setting the returned pointer as the data of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> is
incorrect for general-purpose plugins. The reason is that if a downstream
element stores the buffer so that it has access to it outside of the bounds
of its chain function, the buffer will have an invalid data pointer after
your element flushes the bytes. In that case you should use
<a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a>, which returns a freshly-allocated buffer that you can set
as <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> memory or the potentially more performant
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>.
</p>
<p>
Returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> if <em class="parameter"><code>size</code></em> bytes are not available.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>the number of bytes to map/peek</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a pointer to the first <em class="parameter"><code>size</code></em> bytes of data, or NULL. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-unmap"></a><h3>gst_adapter_unmap ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gst_adapter_unmap                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>
Releases the memory obtained with the last <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-copy"></a><h3>gst_adapter_copy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gst_adapter_copy                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> dest</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>
Copies <em class="parameter"><code>size</code></em> bytes of data starting at <em class="parameter"><code>offset</code></em> out of the buffers
contained in <em class="parameter"><code>GstAdapter</code></em> into an array <em class="parameter"><code>dest</code></em> provided by the caller.
</p>
<p>
The array <em class="parameter"><code>dest</code></em> should be large enough to contain <em class="parameter"><code>size</code></em> bytes.
The user should check that the adapter has (<em class="parameter"><code>offset</code></em> + <em class="parameter"><code>size</code></em>) bytes
available before calling this function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>the memory to copy into. <span class="annotation">[<acronym title="Out parameter, where caller must allocate storage."><span class="acronym">out caller-allocates</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
<td>the bytes offset in the adapter to start from</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>the number of bytes to copy</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-flush"></a><h3>gst_adapter_flush ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gst_adapter_flush                   (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> flush</code></em>);</pre>
<p>
Flushes the first <em class="parameter"><code>flush</code></em> bytes in the <em class="parameter"><code>adapter</code></em>. The caller must ensure that
at least this many bytes are available.
</p>
<p>
See also: <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>, <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flush</code></em> :</span></p></td>
<td>the number of bytes to flush</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-available"></a><h3>gst_adapter_available ()</h3>
<pre class="programlisting"><span class="returnvalue">gsize</span>               gst_adapter_available               (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>
Gets the maximum amount of bytes available, that is it returns the maximum
value that can be supplied to <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a> without that function
returning NULL.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>number of bytes available in <em class="parameter"><code>adapter</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-available-fast"></a><h3>gst_adapter_available_fast ()</h3>
<pre class="programlisting"><span class="returnvalue">gsize</span>               gst_adapter_available_fast          (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>
Gets the maximum number of bytes that are immediately available without
requiring any expensive operations (like copying the data into a
temporary buffer).
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>number of bytes that are available in <em class="parameter"><code>adapter</code></em> without expensive
operations</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take"></a><h3>gst_adapter_take ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>            gst_adapter_take                    (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>
Returns a freshly allocated buffer containing the first <em class="parameter"><code>nbytes</code></em> bytes of the
<em class="parameter"><code>adapter</code></em>. The returned bytes will be flushed from the adapter.
</p>
<p>
Caller owns returned value. g_free after usage.
</p>
<p>
Free-function: g_free
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nbytes</code></em> :</span></p></td>
<td>the number of bytes to take</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>oven-fresh hot data, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> if <em class="parameter"><code>nbytes</code></em> bytes are not available. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=nbytes][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-buffer"></a><h3>gst_adapter_take_buffer ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="returnvalue">GstBuffer</span></a> *         gst_adapter_take_buffer             (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>
Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em> bytes of the
<em class="parameter"><code>adapter</code></em>. The returned bytes will be flushed from the adapter.
This function is potentially more performant than
<a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a> since it can reuse the memory in pushed buffers
by subbuffering or merging. This function will always return a
buffer with a single memory region.
</p>
<p>
Note that no assumptions should be made as to whether certain buffer
flags such as the DISCONT flag are set on the returned buffer, or not.
The caller needs to explicitly set or unset flags that should be set or
unset.
</p>
<p>
Caller owns a reference to the returned buffer. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> after
usage.
</p>
<p>
Free-function: gst_buffer_unref
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nbytes</code></em> :</span></p></td>
<td>the number of bytes to take</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GstBuffer"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em> of
the adapter, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> if <em class="parameter"><code>nbytes</code></em> bytes are not available.
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> when no longer needed. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-list"></a><h3>gst_adapter_take_list ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *             gst_adapter_take_list               (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>
Returns a <a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of buffers containing the first <em class="parameter"><code>nbytes</code></em> bytes of the
<em class="parameter"><code>adapter</code></em>. The returned bytes will be flushed from the adapter.
When the caller can deal with individual buffers, this function is more
performant because no memory should be copied.
</p>
<p>
Caller owns returned list and contained buffers. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> each
buffer in the list before freeing the list after usage.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nbytes</code></em> :</span></p></td>
<td>the number of bytes to take</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of buffers
containing the first <em class="parameter"><code>nbytes</code></em> of the adapter, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><span class="type">NULL</span></a> if <em class="parameter"><code>nbytes</code></em> bytes
are not available. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> Gst.Buffer][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-pts"></a><h3>gst_adapter_prev_pts ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>        gst_adapter_prev_pts                (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>
Get the pts that was before the current byte in the adapter. When
<em class="parameter"><code>distance</code></em> is given, the amount of bytes between the pts and the current
position is returned.
</p>
<p>
The pts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a pts is removed from the adapter, the pts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>distance</code></em> :</span></p></td>
<td>pointer to location for distance, or NULL. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The previously seen pts.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-dts"></a><h3>gst_adapter_prev_dts ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>        gst_adapter_prev_dts                (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>
Get the dts that was before the current byte in the adapter. When
<em class="parameter"><code>distance</code></em> is given, the amount of bytes between the dts and the current
position is returned.
</p>
<p>
The dts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a dts is removed from the adapter, the dts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>distance</code></em> :</span></p></td>
<td>pointer to location for distance, or NULL. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The previously seen dts.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-masked-scan-uint32"></a><h3>gst_adapter_masked_scan_uint32 ()</h3>
<pre class="programlisting"><span class="returnvalue">gssize</span>              gst_adapter_masked_scan_uint32      (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>
Scan for pattern <em class="parameter"><code>pattern</code></em> with applied mask <em class="parameter"><code>mask</code></em> in the adapter data,
starting from offset <em class="parameter"><code>offset</code></em>.
</p>
<p>
The bytes in <em class="parameter"><code>pattern</code></em> and <em class="parameter"><code>mask</code></em> are interpreted left-to-right, regardless
of endianness.  All four bytes of the pattern must be present in the
adapter for it to match, even if the first or last bytes are masked out.
</p>
<p>
It is an error to call this function without making sure that there is
enough data (offset+size bytes) in the adapter.
</p>
<p>
This function calls <a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32-peek" title="gst_adapter_masked_scan_uint32_peek ()"><code class="function">gst_adapter_masked_scan_uint32_peek()</code></a> passing NULL
for value.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>mask to apply to data before matching against <em class="parameter"><code>pattern</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pattern</code></em> :</span></p></td>
<td>pattern to match (after mask is applied)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
<td>offset into the adapter data from which to start scanning, returns
the last scanned position.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>number of bytes to scan from offset</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>offset of the first match, or -1 if no match was found.
Example:
<pre class="programlisting">
// Assume the adapter contains 0x00 0x01 0x02 ... 0xfe 0xff
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 256);
// -&gt; returns 0
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 1, 255);
// -&gt; returns -1
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 255);
// -&gt; returns 1
gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0001, 0, 256);
// -&gt; returns -1
gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0203, 0, 256);
// -&gt; returns 0
gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 256);
// -&gt; returns 2
gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 4);
// -&gt; returns -1
</pre>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-masked-scan-uint32-peek"></a><h3>gst_adapter_masked_scan_uint32_peek ()</h3>
<pre class="programlisting"><span class="returnvalue">gssize</span>              gst_adapter_masked_scan_uint32_peek (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> size</code></em>,
                                                         <em class="parameter"><code><span class="type">guint32</span> *value</code></em>);</pre>
<p>
Scan for pattern <em class="parameter"><code>pattern</code></em> with applied mask <em class="parameter"><code>mask</code></em> in the adapter data,
starting from offset <em class="parameter"><code>offset</code></em>.  If a match is found, the value that matched
is returned through <em class="parameter"><code>value</code></em>, otherwise <em class="parameter"><code>value</code></em> is left untouched.
</p>
<p>
The bytes in <em class="parameter"><code>pattern</code></em> and <em class="parameter"><code>mask</code></em> are interpreted left-to-right, regardless
of endianness.  All four bytes of the pattern must be present in the
adapter for it to match, even if the first or last bytes are masked out.
</p>
<p>
It is an error to call this function without making sure that there is
enough data (offset+size bytes) in the adapter.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>adapter</code></em> :</span></p></td>
<td>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>mask to apply to data before matching against <em class="parameter"><code>pattern</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pattern</code></em> :</span></p></td>
<td>pattern to match (after mask is applied)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
<td>offset into the adapter data from which to start scanning, returns
the last scanned position.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>number of bytes to scan from offset</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>pointer to uint32 to return matching data</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>offset of the first match, or -1 if no match was found.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>