1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <gstreamermm/audioringbuffer.h>
7 #include <gstreamermm/private/audioringbuffer_p.h>
8 
9 
10 /* gstreamermm - a C++ wrapper for gstreamer
11  *
12  * Copyright 2008-2016 The gstreamermm Development Team
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28 
29 #include <gstreamermm/handle_error.h>
30 
31 
32 namespace Gst
33 {
34 
AudioRingBufferSpec()35 AudioRingBufferSpec::AudioRingBufferSpec()
36 : m_spec(g_try_new(GstAudioRingBufferSpec, 1)),
37   take_ownership(true)
38 {
39   // Handle possible memory allocation failure.
40   if(!m_spec)
41   {
42     gstreamermm_handle_error(
43       "Failed to allocate a new Gst::AudioRingBufferSpec.");
44     return;
45   }
46 }
47 
AudioRingBufferSpec(const Glib::RefPtr<Gst::Caps> & caps,Gst::AudioRingBufferFormatType type,guint64 latency_time,guint64 buffer_time,int segsize,int segtotal,int seglatency)48 AudioRingBufferSpec::AudioRingBufferSpec(const Glib::RefPtr<Gst::Caps>& caps,
49   Gst::AudioRingBufferFormatType type,
50   guint64 latency_time, guint64 buffer_time, int segsize, int segtotal,
51   int seglatency)
52 : m_spec(g_try_new(GstAudioRingBufferSpec, 1)),
53   take_ownership(true)
54 {
55   // Handle possible memory allocation failure.
56   if(!m_spec)
57   {
58     gstreamermm_handle_error("Failed to allocate a new Gst::AudioRingBufferSpec.");
59     return;
60   }
61 
62   GstAudioRingBufferSpec* spec = gobj();
63 
64   spec->caps = Glib::unwrap(caps);
65 
66   // Keep a copy of the caps (it will be unreferenced in the destructor).
67   if (caps)
68     caps->reference();
69 
70   spec->type = static_cast<GstAudioRingBufferFormatType>(type);
71   spec->latency_time = latency_time;
72   spec->buffer_time = buffer_time;
73   spec->segsize = segsize;
74   spec->segtotal = segtotal;
75   spec->seglatency = seglatency;
76 }
77 
78 
AudioRingBufferSpec(GstAudioRingBufferSpec & castitem,bool take_ownership)79 AudioRingBufferSpec::AudioRingBufferSpec(GstAudioRingBufferSpec& castitem, bool take_ownership)
80 : m_spec(&castitem),
81   take_ownership(take_ownership)
82 {
83   // Keep a copy of the caps (it will be unreferenced in the destructor).
84   if(castitem.caps)
85       gst_caps_ref(castitem.caps);
86 }
87 
AudioRingBufferSpec(const AudioRingBufferSpec & other)88 AudioRingBufferSpec::AudioRingBufferSpec(const AudioRingBufferSpec& other)
89 : m_spec(g_try_new(GstAudioRingBufferSpec, 1)),
90   take_ownership(true)
91 {
92   // Handle possible memory allocation failure.
93   if(!m_spec)
94   {
95     gstreamermm_handle_error("Failed to allocate a new Gst::AudioRingBufferSpec.");
96     return;
97   }
98 
99   m_spec->caps = other.m_spec->caps;
100 
101   // Keep a copy of the caps (it will be unreferenced in the destructor).
102   if(m_spec->caps)
103     gst_caps_ref(m_spec->caps);
104 
105   m_spec->type = other.m_spec->type;
106   m_spec->latency_time = other.m_spec->latency_time;
107   m_spec->buffer_time = other.m_spec->buffer_time;
108   m_spec->segsize = other.m_spec->segsize;
109   m_spec->segtotal = other.m_spec->segtotal;
110   m_spec->seglatency = other.m_spec->seglatency;
111 }
112 
operator =(const AudioRingBufferSpec & other)113 AudioRingBufferSpec& AudioRingBufferSpec::operator=(const AudioRingBufferSpec& other)
114 {
115   AudioRingBufferSpec temp(other);
116   swap(temp);
117   return *this;
118 }
119 
~AudioRingBufferSpec()120 AudioRingBufferSpec::~AudioRingBufferSpec()
121 {
122   // Unref existing reference to caps.
123   if(m_spec->caps)
124     gst_caps_unref(m_spec->caps);
125 
126   // Release the underlying m_spec if it is owned.
127   if(take_ownership)
128     g_free(m_spec);
129 }
130 
swap(AudioRingBufferSpec & other)131 void AudioRingBufferSpec::swap(AudioRingBufferSpec& other)
132 {
133   GstAudioRingBufferSpec* spec_temp = m_spec;
134   m_spec = other.m_spec;
135   other.m_spec = spec_temp;
136 
137   const bool take_temp = take_ownership;
138   take_ownership = other.take_ownership;
139   other.take_ownership = take_temp;
140 }
141 
prepare_read(int & segment,std::vector<guint8> & readptr,int & len)142 bool AudioRingBuffer::prepare_read(int& segment, std::vector<guint8>& readptr,
143   int& len)
144 {
145   guint8* c_readptr = nullptr;
146 
147   const bool result = static_cast<bool>(gst_audio_ring_buffer_prepare_read(gobj(), &segment, &c_readptr, &len));
148   readptr.assign(c_readptr, c_readptr + len);
149 
150   if (c_readptr)
151     g_free(c_readptr);
152 
153   return result;
154 }
155 
acquire_vfunc_callback(GstAudioRingBuffer * self,GstAudioRingBufferSpec * spec)156 gboolean AudioRingBuffer_Class::acquire_vfunc_callback(GstAudioRingBuffer* self, GstAudioRingBufferSpec* spec)
157 {
158   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
159       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
160 
161   // Non-gtkmmproc-generated custom classes implicitly call the default
162   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
163   // generated classes can use this optimisation, which avoids the unnecessary
164   // parameter conversions if there is no possibility of the virtual function
165   // being overridden:
166   if(obj_base && obj_base->is_derived_())
167   {
168     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
169     if(obj) // This can be NULL during destruction.
170     {
171       try // Trap C++ exceptions which would normally be lost because this is a C callback.
172       {
173         Gst::AudioRingBufferSpec cpp_spec(*spec);
174 
175         // Call the virtual member method, which derived classes might override.
176         return static_cast<int>(obj->acquire_vfunc(cpp_spec));
177 
178       }
179       catch(...)
180       {
181         Glib::exception_handlers_invoke();
182       }
183     }
184   }
185 
186   BaseClassType *const base = static_cast<BaseClassType*>(
187       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
188   );
189 
190   // Call the original underlying C function:
191   if(base && base->acquire)
192     return (*base->acquire)(self, spec);
193 
194 
195   typedef gboolean RType;
196   return RType();
197 }
acquire_vfunc(Gst::AudioRingBufferSpec & spec)198 bool Gst::AudioRingBuffer::acquire_vfunc(Gst::AudioRingBufferSpec& spec)
199 {
200   BaseClassType *const base = static_cast<BaseClassType*>(
201       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
202   );
203 
204   if(base && base->acquire)
205     return static_cast<bool>((*base->acquire)(gobj(), spec.gobj()));
206 
207   typedef bool RType;
208   return RType();
209 }
commit_vfunc_callback(GstAudioRingBuffer * self,guint64 * sample,guchar * data,gint in_samples,gint out_samples,gint * accum)210 guint AudioRingBuffer_Class::commit_vfunc_callback(GstAudioRingBuffer* self, guint64* sample, guchar* data, gint in_samples, gint out_samples, gint* accum)
211 {
212   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
213       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
214 
215   // Non-gtkmmproc-generated custom classes implicitly call the default
216   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
217   // generated classes can use this optimisation, which avoids the unnecessary
218   // parameter conversions if there is no possibility of the virtual function
219   // being overridden:
220   if(obj_base && obj_base->is_derived_())
221   {
222     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
223     if(obj) // This can be NULL during destruction.
224     {
225       try // Trap C++ exceptions which would normally be lost because this is a C callback.
226       {
227         // Declare the ArrayHandle for the C++ vfunc.
228         Glib::ArrayHandle<guchar> cpp_data(data, self->size, Glib::OWNERSHIP_NONE);
229         // Call the virtual member method, which derived classes might override.
230         return obj->commit_vfunc(*(sample), Glib::ArrayHandler<guint8>::array_to_vector(data, self->size, Glib::OWNERSHIP_NONE), in_samples, out_samples, *(accum));
231       }
232       catch(...)
233       {
234         Glib::exception_handlers_invoke();
235       }
236     }
237   }
238 
239   BaseClassType *const base = static_cast<BaseClassType*>(
240       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
241   );
242 
243   // Call the original underlying C function:
244   if(base && base->commit)
245     return (*base->commit)(self, sample, data, in_samples, out_samples, accum);
246 
247 
248   typedef guint RType;
249   return RType();
250 }
commit_vfunc(guint64 & sample,const std::vector<guint8> & data,int in_samples,int out_samples,int & accum)251 guint Gst::AudioRingBuffer::commit_vfunc(guint64& sample, const std::vector<guint8>& data, int in_samples, int out_samples, int& accum)
252 {
253   BaseClassType *const base = static_cast<BaseClassType*>(
254       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
255   );
256 
257   if(base && base->commit)
258     return (*base->commit)(gobj(),&sample,Glib::ArrayHandler<guint8>::vector_to_array(data).data(),in_samples,out_samples,&accum);
259 
260   typedef guint RType;
261   return RType();
262 }
263 
264 } // namespace Gst
265 
266 namespace
267 {
268 } // anonymous namespace
269 
270 // static
value_type()271 GType Glib::Value<Gst::AudioChannelPosition>::value_type()
272 {
273   return gst_audio_channel_position_get_type();
274 }
275 
276 // static
value_type()277 GType Glib::Value<Gst::AudioRingBufferState>::value_type()
278 {
279   return gst_audio_ring_buffer_state_get_type();
280 }
281 
282 // static
value_type()283 GType Glib::Value<Gst::AudioRingBufferFormatType>::value_type()
284 {
285   return gst_audio_ring_buffer_format_type_get_type();
286 }
287 
288 
289 namespace Gst
290 {
291 
292 
get_caps()293 Glib::RefPtr<Gst::Caps> AudioRingBufferSpec::get_caps()
294 {
295   Glib::RefPtr<Gst::Caps> ref_ptr(Glib::wrap(gobj()->caps));
296 
297   if(ref_ptr)
298     ref_ptr->reference();
299 
300   return ref_ptr;
301 }
302 
get_caps() const303 Glib::RefPtr<const Gst::Caps> AudioRingBufferSpec::get_caps() const
304 {
305   Glib::RefPtr<const Gst::Caps> ref_ptr(Glib::wrap(gobj()->caps));
306 
307   if(ref_ptr)
308     ref_ptr->reference();
309 
310   return ref_ptr;
311 }
312 
set_caps(const Glib::RefPtr<Gst::Caps> & value)313 void AudioRingBufferSpec::set_caps(const Glib::RefPtr<Gst::Caps>& value)
314 {
315   Glib::RefPtr<Gst::Caps> valueOld(Glib::wrap(gobj()->caps)); //Take possession of the old one, unref-ing it in the destructor.
316 
317   if(value)
318     value->reference(); //Ref once for the recipient.
319 
320   gobj()->caps = Glib::unwrap(value);
321 }
322 
get_type() const323 Gst::AudioRingBufferFormatType AudioRingBufferSpec::get_type() const
324 {
325   return ((Gst::AudioRingBufferFormatType)(gobj()->type));
326 }
327 
set_type(const Gst::AudioRingBufferFormatType & value)328 void AudioRingBufferSpec::set_type(const Gst::AudioRingBufferFormatType& value)
329 {
330   gobj()->type = ((GstAudioRingBufferFormatType)(value));
331 }
332 
get_latency_time() const333 guint64 AudioRingBufferSpec::get_latency_time() const
334 {
335   return gobj()->latency_time;
336 }
337 
set_latency_time(const guint64 & value)338 void AudioRingBufferSpec::set_latency_time(const guint64& value)
339 {
340   gobj()->latency_time = value;
341 }
342 
get_buffer_time() const343 guint64 AudioRingBufferSpec::get_buffer_time() const
344 {
345   return gobj()->buffer_time;
346 }
347 
set_buffer_time(const guint64 & value)348 void AudioRingBufferSpec::set_buffer_time(const guint64& value)
349 {
350   gobj()->buffer_time = value;
351 }
352 
get_segsize() const353 int AudioRingBufferSpec::get_segsize() const
354 {
355   return gobj()->segsize;
356 }
357 
set_segsize(const int & value)358 void AudioRingBufferSpec::set_segsize(const int& value)
359 {
360   gobj()->segsize = value;
361 }
362 
get_segtotal() const363 int AudioRingBufferSpec::get_segtotal() const
364 {
365   return gobj()->segtotal;
366 }
367 
set_segtotal(const int & value)368 void AudioRingBufferSpec::set_segtotal(const int& value)
369 {
370   gobj()->segtotal = value;
371 }
372 
get_seglatency() const373 int AudioRingBufferSpec::get_seglatency() const
374 {
375   return gobj()->seglatency;
376 }
377 
set_seglatency(const int & value)378 void AudioRingBufferSpec::set_seglatency(const int& value)
379 {
380   gobj()->seglatency = value;
381 }
382 
383 
384 } // namespace Gst
385 
386 
387 namespace Glib
388 {
389 
wrap(GstAudioRingBuffer * object,bool take_copy)390 Glib::RefPtr<Gst::AudioRingBuffer> wrap(GstAudioRingBuffer* object, bool take_copy)
391 {
392   return Glib::RefPtr<Gst::AudioRingBuffer>( dynamic_cast<Gst::AudioRingBuffer*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
393   //We use dynamic_cast<> in case of multiple inheritance.
394 }
395 
396 } /* namespace Glib */
397 
398 
399 namespace Gst
400 {
401 
402 
403 /* The *_Class implementation: */
404 
init()405 const Glib::Class& AudioRingBuffer_Class::init()
406 {
407   if(!gtype_) // create the GType if necessary
408   {
409     // Glib::Class has to know the class init function to clone custom types.
410     class_init_func_ = &AudioRingBuffer_Class::class_init_function;
411 
412     // This is actually just optimized away, apparently with no harm.
413     // Make sure that the parent type has been created.
414     //CppClassParent::CppObjectType::get_type();
415 
416     // Create the wrapper type, with the same class/instance size as the base type.
417     register_derived_type(gst_audio_ring_buffer_get_type());
418 
419     // Add derived versions of interfaces, if the C type implements any interfaces:
420 
421   }
422 
423   return *this;
424 }
425 
426 
class_init_function(void * g_class,void * class_data)427 void AudioRingBuffer_Class::class_init_function(void* g_class, void* class_data)
428 {
429   const auto klass = static_cast<BaseClassType*>(g_class);
430   CppClassParent::class_init_function(klass, class_data);
431 
432   klass->open_device = &open_device_vfunc_callback;
433   klass->release = &release_vfunc_callback;
434   klass->close_device = &close_device_vfunc_callback;
435   klass->start = &start_vfunc_callback;
436   klass->pause = &pause_vfunc_callback;
437   klass->resume = &resume_vfunc_callback;
438   klass->stop = &stop_vfunc_callback;
439   klass->delay = &delay_vfunc_callback;
440   klass->activate = &activate_vfunc_callback;
441   klass->clear_all = &clear_all_vfunc_callback;
442   klass->acquire = &acquire_vfunc_callback;
443   klass->commit = &commit_vfunc_callback;
444 
445 }
446 
open_device_vfunc_callback(GstAudioRingBuffer * self)447 gboolean AudioRingBuffer_Class::open_device_vfunc_callback(GstAudioRingBuffer* self)
448 {
449   const auto obj_base = static_cast<Glib::ObjectBase*>(
450       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
451 
452   // Non-gtkmmproc-generated custom classes implicitly call the default
453   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
454   // generated classes can use this optimisation, which avoids the unnecessary
455   // parameter conversions if there is no possibility of the virtual function
456   // being overridden:
457   if(obj_base && obj_base->is_derived_())
458   {
459     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
460     if(obj) // This can be NULL during destruction.
461     {
462       try // Trap C++ exceptions which would normally be lost because this is a C callback.
463       {
464         // Call the virtual member method, which derived classes might override.
465         return static_cast<int>(obj->open_device_vfunc());
466       }
467       catch(...)
468       {
469         Glib::exception_handlers_invoke();
470       }
471     }
472   }
473 
474   BaseClassType *const base = static_cast<BaseClassType*>(
475       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
476   );
477 
478   // Call the original underlying C function:
479   if(base && base->open_device)
480     return (*base->open_device)(self);
481 
482   using RType = gboolean;
483   return RType();
484 }
release_vfunc_callback(GstAudioRingBuffer * self)485 gboolean AudioRingBuffer_Class::release_vfunc_callback(GstAudioRingBuffer* self)
486 {
487   const auto obj_base = static_cast<Glib::ObjectBase*>(
488       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
489 
490   // Non-gtkmmproc-generated custom classes implicitly call the default
491   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
492   // generated classes can use this optimisation, which avoids the unnecessary
493   // parameter conversions if there is no possibility of the virtual function
494   // being overridden:
495   if(obj_base && obj_base->is_derived_())
496   {
497     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
498     if(obj) // This can be NULL during destruction.
499     {
500       try // Trap C++ exceptions which would normally be lost because this is a C callback.
501       {
502         // Call the virtual member method, which derived classes might override.
503         return static_cast<int>(obj->release_vfunc());
504       }
505       catch(...)
506       {
507         Glib::exception_handlers_invoke();
508       }
509     }
510   }
511 
512   BaseClassType *const base = static_cast<BaseClassType*>(
513       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
514   );
515 
516   // Call the original underlying C function:
517   if(base && base->release)
518     return (*base->release)(self);
519 
520   using RType = gboolean;
521   return RType();
522 }
close_device_vfunc_callback(GstAudioRingBuffer * self)523 gboolean AudioRingBuffer_Class::close_device_vfunc_callback(GstAudioRingBuffer* self)
524 {
525   const auto obj_base = static_cast<Glib::ObjectBase*>(
526       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
527 
528   // Non-gtkmmproc-generated custom classes implicitly call the default
529   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
530   // generated classes can use this optimisation, which avoids the unnecessary
531   // parameter conversions if there is no possibility of the virtual function
532   // being overridden:
533   if(obj_base && obj_base->is_derived_())
534   {
535     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
536     if(obj) // This can be NULL during destruction.
537     {
538       try // Trap C++ exceptions which would normally be lost because this is a C callback.
539       {
540         // Call the virtual member method, which derived classes might override.
541         return static_cast<int>(obj->close_device_vfunc());
542       }
543       catch(...)
544       {
545         Glib::exception_handlers_invoke();
546       }
547     }
548   }
549 
550   BaseClassType *const base = static_cast<BaseClassType*>(
551       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
552   );
553 
554   // Call the original underlying C function:
555   if(base && base->close_device)
556     return (*base->close_device)(self);
557 
558   using RType = gboolean;
559   return RType();
560 }
start_vfunc_callback(GstAudioRingBuffer * self)561 gboolean AudioRingBuffer_Class::start_vfunc_callback(GstAudioRingBuffer* self)
562 {
563   const auto obj_base = static_cast<Glib::ObjectBase*>(
564       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
565 
566   // Non-gtkmmproc-generated custom classes implicitly call the default
567   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
568   // generated classes can use this optimisation, which avoids the unnecessary
569   // parameter conversions if there is no possibility of the virtual function
570   // being overridden:
571   if(obj_base && obj_base->is_derived_())
572   {
573     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
574     if(obj) // This can be NULL during destruction.
575     {
576       try // Trap C++ exceptions which would normally be lost because this is a C callback.
577       {
578         // Call the virtual member method, which derived classes might override.
579         return static_cast<int>(obj->start_vfunc());
580       }
581       catch(...)
582       {
583         Glib::exception_handlers_invoke();
584       }
585     }
586   }
587 
588   BaseClassType *const base = static_cast<BaseClassType*>(
589       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
590   );
591 
592   // Call the original underlying C function:
593   if(base && base->start)
594     return (*base->start)(self);
595 
596   using RType = gboolean;
597   return RType();
598 }
pause_vfunc_callback(GstAudioRingBuffer * self)599 gboolean AudioRingBuffer_Class::pause_vfunc_callback(GstAudioRingBuffer* self)
600 {
601   const auto obj_base = static_cast<Glib::ObjectBase*>(
602       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
603 
604   // Non-gtkmmproc-generated custom classes implicitly call the default
605   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
606   // generated classes can use this optimisation, which avoids the unnecessary
607   // parameter conversions if there is no possibility of the virtual function
608   // being overridden:
609   if(obj_base && obj_base->is_derived_())
610   {
611     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
612     if(obj) // This can be NULL during destruction.
613     {
614       try // Trap C++ exceptions which would normally be lost because this is a C callback.
615       {
616         // Call the virtual member method, which derived classes might override.
617         return static_cast<int>(obj->pause_vfunc());
618       }
619       catch(...)
620       {
621         Glib::exception_handlers_invoke();
622       }
623     }
624   }
625 
626   BaseClassType *const base = static_cast<BaseClassType*>(
627       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
628   );
629 
630   // Call the original underlying C function:
631   if(base && base->pause)
632     return (*base->pause)(self);
633 
634   using RType = gboolean;
635   return RType();
636 }
resume_vfunc_callback(GstAudioRingBuffer * self)637 gboolean AudioRingBuffer_Class::resume_vfunc_callback(GstAudioRingBuffer* self)
638 {
639   const auto obj_base = static_cast<Glib::ObjectBase*>(
640       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
641 
642   // Non-gtkmmproc-generated custom classes implicitly call the default
643   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
644   // generated classes can use this optimisation, which avoids the unnecessary
645   // parameter conversions if there is no possibility of the virtual function
646   // being overridden:
647   if(obj_base && obj_base->is_derived_())
648   {
649     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
650     if(obj) // This can be NULL during destruction.
651     {
652       try // Trap C++ exceptions which would normally be lost because this is a C callback.
653       {
654         // Call the virtual member method, which derived classes might override.
655         return static_cast<int>(obj->resume_vfunc());
656       }
657       catch(...)
658       {
659         Glib::exception_handlers_invoke();
660       }
661     }
662   }
663 
664   BaseClassType *const base = static_cast<BaseClassType*>(
665       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
666   );
667 
668   // Call the original underlying C function:
669   if(base && base->resume)
670     return (*base->resume)(self);
671 
672   using RType = gboolean;
673   return RType();
674 }
stop_vfunc_callback(GstAudioRingBuffer * self)675 gboolean AudioRingBuffer_Class::stop_vfunc_callback(GstAudioRingBuffer* self)
676 {
677   const auto obj_base = static_cast<Glib::ObjectBase*>(
678       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
679 
680   // Non-gtkmmproc-generated custom classes implicitly call the default
681   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
682   // generated classes can use this optimisation, which avoids the unnecessary
683   // parameter conversions if there is no possibility of the virtual function
684   // being overridden:
685   if(obj_base && obj_base->is_derived_())
686   {
687     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
688     if(obj) // This can be NULL during destruction.
689     {
690       try // Trap C++ exceptions which would normally be lost because this is a C callback.
691       {
692         // Call the virtual member method, which derived classes might override.
693         return static_cast<int>(obj->stop_vfunc());
694       }
695       catch(...)
696       {
697         Glib::exception_handlers_invoke();
698       }
699     }
700   }
701 
702   BaseClassType *const base = static_cast<BaseClassType*>(
703       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
704   );
705 
706   // Call the original underlying C function:
707   if(base && base->stop)
708     return (*base->stop)(self);
709 
710   using RType = gboolean;
711   return RType();
712 }
delay_vfunc_callback(GstAudioRingBuffer * self)713 guint AudioRingBuffer_Class::delay_vfunc_callback(GstAudioRingBuffer* self)
714 {
715   const auto obj_base = static_cast<Glib::ObjectBase*>(
716       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
717 
718   // Non-gtkmmproc-generated custom classes implicitly call the default
719   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
720   // generated classes can use this optimisation, which avoids the unnecessary
721   // parameter conversions if there is no possibility of the virtual function
722   // being overridden:
723   if(obj_base && obj_base->is_derived_())
724   {
725     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
726     if(obj) // This can be NULL during destruction.
727     {
728       try // Trap C++ exceptions which would normally be lost because this is a C callback.
729       {
730         // Call the virtual member method, which derived classes might override.
731         return obj->delay_vfunc();
732       }
733       catch(...)
734       {
735         Glib::exception_handlers_invoke();
736       }
737     }
738   }
739 
740   BaseClassType *const base = static_cast<BaseClassType*>(
741       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
742   );
743 
744   // Call the original underlying C function:
745   if(base && base->delay)
746     return (*base->delay)(self);
747 
748   using RType = guint;
749   return RType();
750 }
activate_vfunc_callback(GstAudioRingBuffer * self,gboolean active)751 gboolean AudioRingBuffer_Class::activate_vfunc_callback(GstAudioRingBuffer* self, gboolean active)
752 {
753   const auto obj_base = static_cast<Glib::ObjectBase*>(
754       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
755 
756   // Non-gtkmmproc-generated custom classes implicitly call the default
757   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
758   // generated classes can use this optimisation, which avoids the unnecessary
759   // parameter conversions if there is no possibility of the virtual function
760   // being overridden:
761   if(obj_base && obj_base->is_derived_())
762   {
763     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
764     if(obj) // This can be NULL during destruction.
765     {
766       try // Trap C++ exceptions which would normally be lost because this is a C callback.
767       {
768         // Call the virtual member method, which derived classes might override.
769         return static_cast<int>(obj->activate_vfunc(active
770 ));
771       }
772       catch(...)
773       {
774         Glib::exception_handlers_invoke();
775       }
776     }
777   }
778 
779   BaseClassType *const base = static_cast<BaseClassType*>(
780       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
781   );
782 
783   // Call the original underlying C function:
784   if(base && base->activate)
785     return (*base->activate)(self, active);
786 
787   using RType = gboolean;
788   return RType();
789 }
clear_all_vfunc_callback(GstAudioRingBuffer * self)790 void AudioRingBuffer_Class::clear_all_vfunc_callback(GstAudioRingBuffer* self)
791 {
792   const auto obj_base = static_cast<Glib::ObjectBase*>(
793       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
794 
795   // Non-gtkmmproc-generated custom classes implicitly call the default
796   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
797   // generated classes can use this optimisation, which avoids the unnecessary
798   // parameter conversions if there is no possibility of the virtual function
799   // being overridden:
800   if(obj_base && obj_base->is_derived_())
801   {
802     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
803     if(obj) // This can be NULL during destruction.
804     {
805       try // Trap C++ exceptions which would normally be lost because this is a C callback.
806       {
807         // Call the virtual member method, which derived classes might override.
808         obj->clear_all_vfunc();
809         return;
810       }
811       catch(...)
812       {
813         Glib::exception_handlers_invoke();
814       }
815     }
816   }
817 
818   BaseClassType *const base = static_cast<BaseClassType*>(
819       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
820   );
821 
822   // Call the original underlying C function:
823   if(base && base->clear_all)
824     (*base->clear_all)(self);
825 }
826 
827 
wrap_new(GObject * object)828 Glib::ObjectBase* AudioRingBuffer_Class::wrap_new(GObject* object)
829 {
830   return new AudioRingBuffer((GstAudioRingBuffer*)object);
831 }
832 
833 
834 /* The implementation: */
835 
gobj_copy()836 GstAudioRingBuffer* AudioRingBuffer::gobj_copy()
837 {
838   reference();
839   return gobj();
840 }
841 
AudioRingBuffer(const Glib::ConstructParams & construct_params)842 AudioRingBuffer::AudioRingBuffer(const Glib::ConstructParams& construct_params)
843 :
844   Gst::Object(construct_params)
845 {
846 
847 }
848 
AudioRingBuffer(GstAudioRingBuffer * castitem)849 AudioRingBuffer::AudioRingBuffer(GstAudioRingBuffer* castitem)
850 :
851   Gst::Object((GstObject*)(castitem))
852 {}
853 
854 
AudioRingBuffer(AudioRingBuffer && src)855 AudioRingBuffer::AudioRingBuffer(AudioRingBuffer&& src) noexcept
856 : Gst::Object(std::move(src))
857 {}
858 
operator =(AudioRingBuffer && src)859 AudioRingBuffer& AudioRingBuffer::operator=(AudioRingBuffer&& src) noexcept
860 {
861   Gst::Object::operator=(std::move(src));
862   return *this;
863 }
864 
865 
~AudioRingBuffer()866 AudioRingBuffer::~AudioRingBuffer() noexcept
867 {}
868 
869 
870 AudioRingBuffer::CppClassType AudioRingBuffer::audioringbuffer_class_; // initialize static member
871 
get_type()872 GType AudioRingBuffer::get_type()
873 {
874   return audioringbuffer_class_.init().get_type();
875 }
876 
877 
get_base_type()878 GType AudioRingBuffer::get_base_type()
879 {
880   return gst_audio_ring_buffer_get_type();
881 }
882 
acquire(Gst::AudioRingBufferSpec & spec)883 bool AudioRingBuffer::acquire(Gst::AudioRingBufferSpec& spec)
884 {
885   return gst_audio_ring_buffer_acquire(gobj(), spec.gobj());
886 }
887 
release()888 bool AudioRingBuffer::release()
889 {
890   return gst_audio_ring_buffer_release(gobj());
891 }
892 
is_acquired() const893 bool AudioRingBuffer::is_acquired() const
894 {
895   return gst_audio_ring_buffer_is_acquired(const_cast<GstAudioRingBuffer*>(gobj()));
896 }
897 
activate(bool active)898 bool AudioRingBuffer::activate(bool active)
899 {
900   return gst_audio_ring_buffer_activate(gobj(), static_cast<int>(active));
901 }
902 
is_active() const903 bool AudioRingBuffer::is_active() const
904 {
905   return gst_audio_ring_buffer_is_active(const_cast<GstAudioRingBuffer*>(gobj()));
906 }
907 
start()908 bool AudioRingBuffer::start()
909 {
910   return gst_audio_ring_buffer_start(gobj());
911 }
912 
pause()913 bool AudioRingBuffer::pause()
914 {
915   return gst_audio_ring_buffer_pause(gobj());
916 }
917 
stop()918 bool AudioRingBuffer::stop()
919 {
920   return gst_audio_ring_buffer_stop(gobj());
921 }
922 
get_delay() const923 guint AudioRingBuffer::get_delay() const
924 {
925   return gst_audio_ring_buffer_delay(const_cast<GstAudioRingBuffer*>(gobj()));
926 }
927 
get_samples_done() const928 guint64 AudioRingBuffer::get_samples_done() const
929 {
930   return gst_audio_ring_buffer_samples_done(const_cast<GstAudioRingBuffer*>(gobj()));
931 }
932 
set_sample(guint64 sample)933 void AudioRingBuffer::set_sample(guint64 sample)
934 {
935   gst_audio_ring_buffer_set_sample(gobj(), sample);
936 }
937 
set_channel_position(const Gst::AudioChannelPosition & position)938 void AudioRingBuffer::set_channel_position(const Gst::AudioChannelPosition& position)
939 {
940   gst_audio_ring_buffer_set_channel_positions(gobj(), (const GstAudioChannelPosition*)(&position));
941 }
942 
is_flushing()943 gboolean AudioRingBuffer::is_flushing()
944 {
945   return gst_audio_ring_buffer_is_flushing(gobj());
946 }
947 
set_timestamp(gint readseg,ClockTime timestamp)948 void AudioRingBuffer::set_timestamp(gint readseg, ClockTime timestamp)
949 {
950   gst_audio_ring_buffer_set_timestamp(gobj(), readseg, ((GstClockTime)(timestamp)));
951 }
952 
commit(guint64 & sample,const std::vector<guint8> & data,int in_samples,int out_samples,int & accum)953 guint AudioRingBuffer::commit(guint64& sample, const std::vector<guint8>& data, int in_samples, int out_samples, int& accum)
954 {
955   return gst_audio_ring_buffer_commit(gobj(), &(sample), Glib::ArrayHandler<guint8>::vector_to_array(data).data(), in_samples, out_samples, &(accum));
956 }
957 
convert(Gst::Format src_fmt,gint64 src_val,Gst::Format dest_fmt,gint64 & dest_val) const958 bool AudioRingBuffer::convert(Gst::Format src_fmt, gint64 src_val, Gst::Format dest_fmt, gint64& dest_val) const
959 {
960   return gst_audio_ring_buffer_convert(const_cast<GstAudioRingBuffer*>(gobj()), ((GstFormat)(src_fmt)), src_val, ((GstFormat)(dest_fmt)), &(dest_val));
961 }
962 
read(guint64 sample,const std::vector<guint8> & data,guint len,Gst::ClockTime & timestamp)963 guint AudioRingBuffer::read(guint64 sample, const std::vector<guint8>& data, guint len, Gst::ClockTime& timestamp)
964 {
965   return gst_audio_ring_buffer_read(gobj(), sample, Glib::ArrayHandler<guint8>::vector_to_array(data).data(), len, (GstClockTime*)(&timestamp));
966 }
967 
clear(int segment)968 void AudioRingBuffer::clear(int segment)
969 {
970   gst_audio_ring_buffer_clear(gobj(), segment);
971 }
972 
clear_all()973 void AudioRingBuffer::clear_all()
974 {
975   gst_audio_ring_buffer_clear_all(gobj());
976 }
977 
advance(guint advance)978 void AudioRingBuffer::advance(guint advance)
979 {
980   gst_audio_ring_buffer_advance(gobj(), advance);
981 }
982 
close_device()983 bool AudioRingBuffer::close_device()
984 {
985   return gst_audio_ring_buffer_close_device(gobj());
986 }
987 
open_device()988 bool AudioRingBuffer::open_device()
989 {
990   return gst_audio_ring_buffer_open_device(gobj());
991 }
992 
device_is_open() const993 bool AudioRingBuffer::device_is_open() const
994 {
995   return gst_audio_ring_buffer_device_is_open(const_cast<GstAudioRingBuffer*>(gobj()));
996 }
997 
set_may_start(bool allowed)998 void AudioRingBuffer::set_may_start(bool allowed)
999 {
1000   gst_audio_ring_buffer_may_start(gobj(), static_cast<int>(allowed));
1001 }
1002 
parse_caps(Gst::AudioRingBufferSpec & p1,const Glib::RefPtr<Gst::Caps> & caps)1003 bool AudioRingBuffer::parse_caps(Gst::AudioRingBufferSpec& p1, const Glib::RefPtr<Gst::Caps>& caps)
1004 {
1005   return gst_audio_ring_buffer_parse_caps(p1.gobj(), Glib::unwrap(caps));
1006 }
1007 
set_flushing(bool flushing)1008 void AudioRingBuffer::set_flushing(bool flushing)
1009 {
1010   gst_audio_ring_buffer_set_flushing(gobj(), static_cast<int>(flushing));
1011 }
1012 
1013 
open_device_vfunc()1014 bool Gst::AudioRingBuffer::open_device_vfunc()
1015 {
1016   const auto base = static_cast<BaseClassType*>(
1017       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1018   );
1019 
1020   if(base && base->open_device)
1021   {
1022     bool retval((*base->open_device)(gobj()));
1023     return retval;
1024   }
1025 
1026   using RType = bool;
1027   return RType();
1028 }
release_vfunc()1029 bool Gst::AudioRingBuffer::release_vfunc()
1030 {
1031   const auto base = static_cast<BaseClassType*>(
1032       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1033   );
1034 
1035   if(base && base->release)
1036   {
1037     bool retval((*base->release)(gobj()));
1038     return retval;
1039   }
1040 
1041   using RType = bool;
1042   return RType();
1043 }
close_device_vfunc()1044 bool Gst::AudioRingBuffer::close_device_vfunc()
1045 {
1046   const auto base = static_cast<BaseClassType*>(
1047       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1048   );
1049 
1050   if(base && base->close_device)
1051   {
1052     bool retval((*base->close_device)(gobj()));
1053     return retval;
1054   }
1055 
1056   using RType = bool;
1057   return RType();
1058 }
start_vfunc()1059 bool Gst::AudioRingBuffer::start_vfunc()
1060 {
1061   const auto base = static_cast<BaseClassType*>(
1062       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1063   );
1064 
1065   if(base && base->start)
1066   {
1067     bool retval((*base->start)(gobj()));
1068     return retval;
1069   }
1070 
1071   using RType = bool;
1072   return RType();
1073 }
pause_vfunc()1074 bool Gst::AudioRingBuffer::pause_vfunc()
1075 {
1076   const auto base = static_cast<BaseClassType*>(
1077       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1078   );
1079 
1080   if(base && base->pause)
1081   {
1082     bool retval((*base->pause)(gobj()));
1083     return retval;
1084   }
1085 
1086   using RType = bool;
1087   return RType();
1088 }
resume_vfunc()1089 bool Gst::AudioRingBuffer::resume_vfunc()
1090 {
1091   const auto base = static_cast<BaseClassType*>(
1092       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1093   );
1094 
1095   if(base && base->resume)
1096   {
1097     bool retval((*base->resume)(gobj()));
1098     return retval;
1099   }
1100 
1101   using RType = bool;
1102   return RType();
1103 }
stop_vfunc()1104 bool Gst::AudioRingBuffer::stop_vfunc()
1105 {
1106   const auto base = static_cast<BaseClassType*>(
1107       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1108   );
1109 
1110   if(base && base->stop)
1111   {
1112     bool retval((*base->stop)(gobj()));
1113     return retval;
1114   }
1115 
1116   using RType = bool;
1117   return RType();
1118 }
delay_vfunc()1119 guint Gst::AudioRingBuffer::delay_vfunc()
1120 {
1121   const auto base = static_cast<BaseClassType*>(
1122       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1123   );
1124 
1125   if(base && base->delay)
1126   {
1127     guint retval((*base->delay)(gobj()));
1128     return retval;
1129   }
1130 
1131   using RType = guint;
1132   return RType();
1133 }
activate_vfunc(bool active)1134 bool Gst::AudioRingBuffer::activate_vfunc(bool active)
1135 {
1136   const auto base = static_cast<BaseClassType*>(
1137       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1138   );
1139 
1140   if(base && base->activate)
1141   {
1142     bool retval((*base->activate)(gobj(),static_cast<int>(active)));
1143     return retval;
1144   }
1145 
1146   using RType = bool;
1147   return RType();
1148 }
clear_all_vfunc()1149 void Gst::AudioRingBuffer::clear_all_vfunc()
1150 {
1151   const auto base = static_cast<BaseClassType*>(
1152       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1153   );
1154 
1155   if(base && base->clear_all)
1156   {
1157     (*base->clear_all)(gobj());
1158   }
1159 }
1160 
1161 
1162 } // namespace Gst
1163 
1164 
1165