| 1 |
/* gstreamermm - a C++ wrapper for gstreamer |
| 2 |
* |
| 3 |
* Copyright 2008-2016 The gstreamermm Development Team |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free |
| 17 |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
_PINCLUDE(gstreamermm/private/audiobasesink_p.h) |
| 21 |
|
| 22 |
namespace Gst |
| 23 |
{ |
| 24 |
|
| 25 |
gboolean AudioSink_Class::prepare_audiosink_vfunc_callback(GstAudioSink* self, GstAudioRingBufferSpec* spec) |
| 26 |
{ |
| 27 |
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 28 |
Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 29 |
|
| 30 |
// Non-gtkmmproc-generated custom classes implicitly call the default |
| 31 |
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 32 |
// generated classes can use this optimisation, which avoids the unnecessary |
| 33 |
// parameter conversions if there is no possibility of the virtual function |
| 34 |
// being overridden: |
| 35 |
if(obj_base && obj_base->is_derived_()) |
| 36 |
{ |
| 37 |
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 38 |
if(obj) // This can be NULL during destruction. |
| 39 |
{ |
| 40 |
try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 41 |
{ |
| 42 |
Gst::AudioRingBufferSpec cpp_spec(*spec); |
| 43 |
|
| 44 |
// Call the virtual member method, which derived classes might override. |
| 45 |
return static_cast<int>(obj->prepare_audiosink_vfunc(cpp_spec)); |
| 46 |
} |
| 47 |
catch(...) |
| 48 |
{ |
| 49 |
Glib::exception_handlers_invoke(); |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
BaseClassType *const base = static_cast<BaseClassType*>( |
| 55 |
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 56 |
); |
| 57 |
|
| 58 |
// Call the original underlying C function: |
| 59 |
if(base && base->prepare) |
| 60 |
return (*base->prepare)(self, spec); |
| 61 |
|
| 62 |
|
| 63 |
typedef gboolean RType; |
| 64 |
return RType(); |
| 65 |
} |
| 66 |
bool Gst::AudioSink::prepare_audiosink_vfunc(Gst::AudioRingBufferSpec& spec) |
| 67 |
{ |
| 68 |
BaseClassType *const base = static_cast<BaseClassType*>( |
| 69 |
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 70 |
); |
| 71 |
|
| 72 |
if(base && base->prepare) |
| 73 |
return static_cast<bool>((*base->prepare)(gobj(),spec.gobj())); |
| 74 |
|
| 75 |
typedef bool RType; |
| 76 |
return RType(); |
| 77 |
} |
| 78 |
|
| 79 |
} // namespace Gst |
| 80 |
|