This file is indexed.

/usr/include/gstreamermm-0.10/gstreamermm/ringbuffer.h is in libgstreamermm-0.10-dev 0.10.9-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
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GSTREAMERMM_RINGBUFFER_H
#define _GSTREAMERMM_RINGBUFFER_H


#include <glibmm.h>

/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008-2009 The gstreamermm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gst/audio/gstringbuffer.h>
#include <gstreamermm/caps.h>
#include <gstreamermm/object.h>
#include <gstreamermm/format.h>
#include <memory>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GstRingBuffer GstRingBuffer;
typedef struct _GstRingBufferClass GstRingBufferClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gst
{ class RingBuffer_Class; } // namespace Gst
namespace Gst
{

/** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */

/**
 * @ingroup gstreamermmEnums
 */
enum RingBufferSegState
{
  SEGSTATE_INVALID,
  SEGSTATE_EMPTY,
  SEGSTATE_FILLED,
  SEGSTATE_PARTIAL
};

} // namespace Gst


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gst::RingBufferSegState> : public Glib::Value_Enum<Gst::RingBufferSegState>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gst
{

/**
 * @ingroup gstreamermmEnums
 */
enum RingBufferState
{
  RING_BUFFER_STATE_STOPPED,
  RING_BUFFER_STATE_PAUSED,
  RING_BUFFER_STATE_STARTED
};

} // namespace Gst


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gst::RingBufferState> : public Glib::Value_Enum<Gst::RingBufferState>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gst
{

/**
 * @ingroup gstreamermmEnums
 */
enum BufferFormat
{
  UNKNOWN,
  S8,
  U8,
  S16_LE,
  S16_BE,
  U16_LE,
  U16_BE,
  S24_LE,
  S24_BE,
  U24_LE,
  U24_BE,
  S32_LE,
  S32_BE,
  U32_LE,
  U32_BE,
  S24_3LE,
  S24_3BE,
  U24_3LE,
  U24_3BE,
  S20_3LE,
  S20_3BE,
  U20_3LE,
  U20_3BE,
  S18_3LE,
  S18_3BE,
  U18_3LE,
  U18_3BE,
  FLOAT32_LE,
  FLOAT32_BE,
  FLOAT64_LE,
  FLOAT64_BE,
  MU_LAW,
  A_LAW,
  IMA_ADPCM,
  MPEG,
  GSM,
  IEC958,
  AC3,
  EAC3,
  DTS
};

} // namespace Gst


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gst::BufferFormat> : public Glib::Value_Enum<Gst::BufferFormat>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gst
{

/**
 * @ingroup gstreamermmEnums
 */
enum BufferFormatType
{
  BUFTYPE_LINEAR,
  BUFTYPE_FLOAT,
  BUFTYPE_MU_LAW,
  BUFTYPE_A_LAW,
  BUFTYPE_IMA_ADPCM,
  BUFTYPE_MPEG,
  BUFTYPE_GSM,
  BUFTYPE_IEC958,
  BUFTYPE_AC3,
  BUFTYPE_EAC3,
  BUFTYPE_DTS
};

} // namespace Gst


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gst::BufferFormatType> : public Glib::Value_Enum<Gst::BufferFormatType>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gst
{


/** A class containing the format specification of a Gst::RingBuffer.
 * Gst::RingBufferSpec contains the format specification of a Gst::RingBuffer.
 * The "in" members should be specified by the caller of the
 * Gst::RingBuffer::acquire() method while the "in/out" members may be set by
 * the caller but are also modifiable by Gst::RingBuffer::acquire().  The
 * "out" members are generated as a result of the call to
 * Gst::RingBuffer::acquire().
 * @see Gst::RingBuffer::acquire().
 */
class RingBufferSpec
{
    public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef RingBufferSpec CppObjectType;
  typedef GstRingBufferSpec BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

private:

public:
  /** Default constructor.
   * @throw std::runtime_error if memory is unavailable for the new
   * Gst::RingBufferSpec.
   */
  RingBufferSpec();

  /** Fully construct a Gst::RingBufferSpec.  Only the "(in)" parameters are
   * required.  The "(in/out)" parameters are optional and may be modified by
   * the call to the Gst::RingBuffer::acquire() method.
   * @param caps The caps of the buffer (in).
   * @param type The sample type (in/out).
   * @param format The sample format (in/out).
   * @param sign The sample sign (in/out).
   * @param bigend The endianness of the samples (in/out).
   * @param width The width of the samples (in/out).
   * @param depth The depth of the samples (in/out).
   * @param rate The sample rate (in/out).
   * @param channels The number of channels (in/out).
   * @param latency_time The latency in microseconds (in/out).
   * @param buffer_time The total buffer size in microseconds (in/out).
   * @param segsize The size of one segment in bytes (in/out).
   * @param segtotal The total number of segments (in/out).
   * @param seglatency Number of segments queued in the lower level device,
   * defaults to @a segtotal in the C API (in/out).
   *
   * @throw std::runtime_error if memory is unavailable for the new
   * Gst::RingBufferSpec.
   */
  RingBufferSpec(const Glib::RefPtr<Gst::Caps>& caps,
    Gst::BufferFormatType type = Gst::BUFTYPE_LINEAR,
    Gst::BufferFormat format = Gst::UNKNOWN, bool sign = false,
    bool bigend = false, int width = 0, int depth = 0, int rate = 0,
    int channels = 0, guint64 latency_time = 0, guint64 buffer_time = 0,
    int segsize = 0, int segtotal = 0, int seglatency = 0);

  /// Construct a Gst::RingBufferSpec from a GstRingBufferSpec.
  explicit RingBufferSpec(GstRingBufferSpec& castitem,
    bool take_ownership = false);

  /** Copy constructor.
   *
   * @throw std::runtime_error if memory is unavailable for the new
   * Gst::RingBufferSpec.
   */
  RingBufferSpec(const RingBufferSpec& other);

  /// Assignment operator.
  RingBufferSpec& operator=(const RingBufferSpec& other);

  /// Destructor.
  virtual ~RingBufferSpec();

  void swap(RingBufferSpec& other);

  /// Gets the underlying gobject.
  GstRingBufferSpec* gobj() { return m_spec; };

  /// Gets the underlying gobject.
  const GstRingBufferSpec* gobj() const { return m_spec; };

  /** Get the caps of the buffer (in). */
   Glib::RefPtr<Gst::Caps> get_caps();
  Glib::RefPtr<const Gst::Caps> get_caps() const;
 
  /** Set the caps of the buffer (in). */
   void set_caps(const Glib::RefPtr<Gst::Caps>& value);
 
  /** Get the sample type (in/out).
   */
   Gst::BufferFormatType get_type() const;
 
  /** Set the sample type (in/out).
   */
   void set_type(const Gst::BufferFormatType& value);
 
  /** Get the sample format (in/out).
   */
   Gst::BufferFormat get_format() const;
 
  /** Set the sample format (in/out).
   */
   void set_format(const Gst::BufferFormat& value);
 
  /** Get the sample sign (in/out).
   */
   bool get_sign() const;
 
  /** Set the sample sign (in/out).
   */
   void set_sign(const bool& value);
 
  /** Get the endianness of the samples (in/out).
   */
   bool get_bigend() const;
 
  /** Set the endianness of the samples (in/out).
   */
   void set_bigend(const bool& value);
 
  /** Get the width of the samples (in/out).
   */
   int get_width() const;
 
  /** Set the width of the samples (in/out).
   */
   void set_width(const int& value);
 
  /** Get the depth of the samples (in/out).
   */
   int get_depth() const;
 
  /** Set the depth of the samples (in/out).
   */
   void set_depth(const int& value);
 
  /** Get the samplerate (in/out).
   */
   int get_rate() const;
 
  /** Set the samplerate (in/out).
   */
   void set_rate(const int& value);
 
  /** Get the number of channels (in/out).
   */
   int get_channels() const;
 
  /** Set the number of channels (in/out).
   */
   void set_channels(const int& value);
 
  /** Get the latency in microseconds (in/out).
   */
   guint64 get_latency_time() const;
 
  /** Set the latency in microseconds (in/out).
   */
   void set_latency_time(const guint64& value);
 
  /** Get the total buffer size in microseconds (in/out).
   */
   guint64 get_buffer_time() const;
 
  /** Set the total buffer size in microseconds (in/out).
   */
   void set_buffer_time(const guint64& value);
 
  /** Get the size of one segment in bytes (in/out).
   */
   int get_segsize() const;
 
  /** Set the size of one segment in bytes (in/out).
   */
   void set_segsize(const int& value);
 
  /** Get the total number of segments (in/out).
   */
   int get_segtotal() const;
 
  /** Set the total number of segments (in/out).
   */
   void set_segtotal(const int& value);
 
  /** Get the number of segments queued in the lower level device, defaults to
   * segtotal (in/out).
   */
   int get_seglatency() const;
 
  /** Set the number of segments queued in the lower level device, defaults to
   * segtotal (in/out).
   */
   void set_seglatency(const int& value);
 
  /** Get the number of bytes of one sample (out).  This is set by the call to
   * Gst::RingBuffer::acquire().
   */
   int get_bytes_per_sample() const;
 
  /** Set the number of bytes of one sample (out).  This is set by the call to
   * Gst::RingBuffer::acquire() and should probably not be set.
   */
   void set_bytes_per_sample(const int& value);
 
// This constant is obtained from the "silence_sample" member in the
// GstRingBufferSpec structure definition.
#define GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE 32

 
  /** Get the bytes representing one sample of silence (out).  This is set by
   * the call to Gst::RingBuffer::acquire().
   */
   Glib::ArrayHandle<guint8> get_silence_sample() const;
 
  /** Sets the bytes representing one sample of silence (out).  This is set by
   * the call to Gst::RingBuffer::acquire() and probably should not be set.
   */
  void set_silence_sample(const Glib::ArrayHandle<guint8>& silence_sample);

protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  GstRingBufferSpec* m_spec;
  // Tells whether the m_spec member should be freed upon destruction.
  bool take_ownership;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


};

/** A base class for audio ringbuffer implementations.
 * This object is the base class for audio ringbuffers used by the base audio
 * source and sink classes.
 *
 * The ringbuffer abstracts a circular buffer of data. One reader and one
 * writer can operate on the data from different threads in a lockfree manner.
 * The base class is sufficiently flexible to be used as an abstraction for
 * DMA based ringbuffers as well as a pure software implementations.
 *
 * Last reviewed on 2006-02-02 (0.10.4).
 * @ingroup GstBaseClasses
 */

class RingBuffer : public Gst::Object
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef RingBuffer CppObjectType;
  typedef RingBuffer_Class CppClassType;
  typedef GstRingBuffer BaseObjectType;
  typedef GstRingBufferClass BaseClassType;

private:  friend class RingBuffer_Class;
  static CppClassType ringbuffer_class_;

private:
  // noncopyable
  RingBuffer(const RingBuffer&);
  RingBuffer& operator=(const RingBuffer&);

protected:
  explicit RingBuffer(const Glib::ConstructParams& construct_params);
  explicit RingBuffer(GstRingBuffer* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~RingBuffer();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;


  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GstRingBuffer*       gobj()       { return reinterpret_cast<GstRingBuffer*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GstRingBuffer* gobj() const { return reinterpret_cast<GstRingBuffer*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GstRingBuffer* gobj_copy();

private:


public:
  /** For example,
   * bool on_fill(const Glib::RefPtr<Gst::RingBuffer>& rbuf,
   * const std::vector<guint8>& data, guint len);.
   * This slot is set with set_fill_slot() and is called to fill the memory at
   * data with len bytes of samples.
   */
  typedef sigc::slot<void, const Glib::ArrayHandle<guint8>&, guint> SlotFill;

  //TODO: _MEMBER_GET(cond, cond, Glib::Cond, GCond*)

  /** Sets the given fill slot on the buffer. The slot will be called every
   * time a segment has been written to a device.
   *
   * MT safe.
   *
   * @param slot The fill slot to set.
   */
  void set_fill_slot(const SlotFill& slot);
  

  /** Allocate the resources for the ringbuffer. This function fills
   * in the data pointer of the ring buffer with a valid Gst::Buffer
   * to which samples can be written.
   * @param spec The specs of the buffer.
   * @return <tt>true</tt> if the device could be acquired, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool acquire(Gst::RingBufferSpec& spec);
  
  /** Free the resources of the ringbuffer.
   * @return <tt>true</tt> if the device could be released, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool release();
  
  /** Check if the ringbuffer is acquired and ready to use.
   * @return <tt>true</tt> if the ringbuffer is acquired, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool is_acquired() const;
  
  /** Activate @a buf to start or stop pulling data.
   * 
   * MT safe.
   * 
   * @newin{0,10}.22.
   * @param active The new mode.
   * @return <tt>true</tt> if the device could be activated in the requested mode,
   * <tt>false</tt> on error.
   */
  bool activate(bool active);
  
  /** Check if @a buf is activated.
   * 
   * MT safe.
   * 
   * @newin{0,10}.22.
   * @return <tt>true</tt> if the device is active.
   */
  bool is_active() const;
  
  /** Start processing samples from the ringbuffer.
   * @return <tt>true</tt> if the device could be started, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool start();
  
  /** Pause processing samples from the ringbuffer.
   * @return <tt>true</tt> if the device could be paused, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool pause();
  
  /** Stop processing samples from the ringbuffer.
   * @return <tt>true</tt> if the device could be stopped, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool stop();
  
  /** Get the number of samples queued in the audio device. This is
   * usually less than the segment size but can be bigger when the
   * implementation uses another internal buffer between the audio
   * device.
   * 
   * For playback ringbuffers this is the amount of samples transfered from the
   * ringbuffer to the device but still not played.
   * 
   * For capture ringbuffers this is the amount of samples in the device that are
   * not yet transfered to the ringbuffer.
   * @return The number of samples queued in the audio device.
   * 
   * MT safe.
   */
  guint get_delay() const;
  
  /** Get the number of samples that were processed by the ringbuffer
   * since it was last started. This does not include the number of samples not
   * yet processed (see delay()).
   * @return The number of samples processed by the ringbuffer.
   * 
   * MT safe.
   */
  guint64 get_samples_done() const;
  
  /** Make sure that the next sample written to the device is
   * accounted for as being the @a sample sample written to the
   * device. This value will be used in reporting the current
   * sample position of the ringbuffer.
   * 
   * This function will also clear the buffer with silence.
   * 
   * MT safe.
   * @param sample The sample number to set.
   */
  void set_sample(guint64 sample);

 
  /** Same as commit_full() but with a in_samples and out_samples
   * equal to @a len, ignoring accum.
   * @param sample The sample position of the data.
   * @param data The data to commit.
   * @param len The number of samples in the data to commit.
   * @return The number of samples written to the ringbuffer or -1 on
   * error.
   * 
   * MT safe.
   */
  guint commit(guint64 sample, const Glib::ArrayHandle<guchar>& data, guint len);
  
  /** Commit @a in_samples samples pointed to by @a data to the ringbuffer @a buf. 
   * 
   *  @a in_samples and @a out_samples define the rate conversion to perform on the the
   * samples in @a data. For negative rates, @a out_samples must be negative and
   *  @a in_samples positive.
   * 
   * When @a out_samples is positive, the first sample will be written at position @a sample
   * in the ringbuffer. When @a out_samples is negative, the last sample will be written to
   *  @a sample in reverse order.
   * 
   *  @a out_samples does not need to be a multiple of the segment size of the ringbuffer
   * although it is recommended for optimal performance. 
   * 
   *  @a accum will hold a temporary accumulator used in rate conversion and should be
   * set to 0 when this function is first called. In case the commit operation is
   * interrupted, one can resume the processing by passing the previously returned
   *  @a accum value back to this function.
   * 
   * MT safe.
   * 
   * @newin{0,10}.11.
   * @param sample The sample position of the data.
   * @param data The data to commit.
   * @param in_samples The number of samples in the data to commit.
   * @param out_samples The number of samples to write to the ringbuffer.
   * @param accum Accumulator for rate conversion.
   * @return The number of samples written to the ringbuffer or -1 on error. The
   * number of samples written can be less than @a out_samples when @a buf was interrupted
   * with a flush or stop.
   */
  guint commit(guint64& sample, const Glib::ArrayHandle<guchar>& data, int in_samples, int out_samples, int& accum);

  
  /** Convert @a src_val in @a src_fmt to the equivalent value in @a dest_fmt. The result
   * will be put in @a dest_val.
   * 
   * @newin{0,10}.22.
   * @param src_fmt The source format.
   * @param src_val The source value.
   * @param dest_fmt The destination format.
   * @param dest_val A location to store the converted value.
   * @return <tt>true</tt> if the conversion succeeded.
   */
  bool convert(Gst::Format src_fmt, gint64 src_val, Gst::Format dest_fmt, gint64& dest_val) const;

  
  /** Returns a pointer to memory where the data from segment @a segment
   * can be found. This function is mostly used by subclasses.
   * @param segment The segment to read.
   * @param readptr The pointer to the memory where samples can be read.
   * @param len The number of bytes to read.
   * @return <tt>false</tt> if the buffer is not started.
   * 
   * MT safe.
   */

  bool prepare_read(int& segment, std::vector<guint8>& readptr, int& len);

  
  /** Read @a len samples from the ringbuffer into the memory pointed 
   * to by @a data.
   * The first sample should be read from position @a sample in
   * the ringbuffer.
   * 
   *  @a len should not be a multiple of the segment size of the ringbuffer
   * although it is recommended.
   * @param sample The sample position of the data.
   * @param data Where the data should be read.
   * @param len The number of samples in data to read.
   * @return The number of samples read from the ringbuffer or -1 on
   * error.
   * 
   * MT safe.
   */
  guint read(guint64 sample, const Glib::ArrayHandle<guchar>& data, guint len);

  
  /** Clear the given segment of the buffer with silence samples.
   * This function is used by subclasses.
   * 
   * MT safe.
   * @param segment The segment to clear.
   */
  void clear(int segment);
  
  /** Fill the ringbuffer with silence.
   * 
   * MT safe.
   */
  void clear_all();
  
  /** Subclasses should call this function to notify the fact that 
   *  @a advance segments are now processed by the device.
   * 
   * MT safe.
   * @param advance The number of segments written.
   */
  void advance(guint advance);
  
  /** Close the audio device associated with the ring buffer. The ring buffer
   * should already have been released via release().
   * @return <tt>true</tt> if the device could be closed, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool close_device();
  
  /** Open the audio device associated with the ring buffer. Does not perform any
   * setup on the device. You must open the device before acquiring the ring
   * buffer.
   * @return <tt>true</tt> if the device could be opened, <tt>false</tt> on error.
   * 
   * MT safe.
   */
  bool open_device();
  
  /** Checks the status of the device associated with the ring buffer.
   * @return <tt>true</tt> if the device was open, <tt>false</tt> if it was closed.
   * 
   * MT safe.
   */
  bool device_is_open() const;
  
  /** Tell the ringbuffer that it is allowed to start playback when
   * the ringbuffer is filled with samples. 
   * 
   * MT safe.
   * 
   * @newin{0,10}.6
   * @param allowed The new value.
   */
  void set_may_start(bool allowed);
  
  /** Parse @a caps into @a spec.
   * @param spec A spec.
   * @param caps A Gst::Caps.
   * @return <tt>true</tt> if the caps could be parsed.
   */
  static bool parse_caps(Gst::RingBufferSpec&, const Glib::RefPtr<Gst::Caps>& caps);
  
  /** Set the ringbuffer to flushing mode or normal mode.
   * 
   * MT safe.
   * @param flushing The new mode.
   */
  void set_flushing(bool flushing);

  /** Virtual function to open the device.  Don't set any params or allocate
   * anything.
   */
    virtual bool open_device_vfunc();


  /** Virtual function to allocate the resources for the ring buffer using the
   * given spec.
   */
  virtual bool acquire_vfunc(Gst::RingBufferSpec& spec);

  /** Virtual function to free resources of the ring buffer.
   */
    virtual bool release_vfunc();


  /** Virtual function to close the device.
   */
    virtual bool close_device_vfunc();


  /** Virtual function to start processing of samples.
   */
    virtual bool start_vfunc();


  /** Virtual function to pause processing of samples.
   */
    virtual bool pause_vfunc();


  /** Virtual function to resume processing of samples after pause.
   */
    virtual bool resume_vfunc();


  /** Virtual function to stop processing of samples.
   */
    virtual bool stop_vfunc();


  /** Virtual function to get number of samples queued in device.
   */
    virtual guint delay_vfunc();


  /** Virtual function to activate the thread that starts pulling and
   * monitoring the consumed segments in the device. Since 0.10.22.
   */
    virtual bool activate_vfunc(bool active);


  /** Virtual function to write samples into the ring buffer.
   */
  virtual guint commit_vfunc(guint64& sample, const Glib::ArrayHandle<guchar>& data, int in_samples, int out_samples, int& accum);

  /** Virtual function to clear the entire ringbuffer Since 0.10.24.
   */
    virtual void clear_all_vfunc();


protected:

  
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
  std::auto_ptr<SlotFill> m_slot;
#endif


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::


};

} // namespace Gst


namespace Glib
{
  /** A Glib::wrap() method for this object.
   * 
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gst::RingBuffer
   */
  Glib::RefPtr<Gst::RingBuffer> wrap(GstRingBuffer* object, bool take_copy = false);
}


#endif /* _GSTREAMERMM_RINGBUFFER_H */