| 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 |
#include <gstreamermm/structure.h> |
| 21 |
#include <gst/video/video-enumtypes.h> |
| 22 |
|
| 23 |
namespace Gst |
| 24 |
{ |
| 25 |
|
| 26 |
void Navigation_Class::send_event_vfunc_callback(GstNavigation* self, GstStructure* structure) |
| 27 |
{ |
| 28 |
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 29 |
Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 30 |
|
| 31 |
// Non-gtkmmproc-generated custom classes implicitly call the default |
| 32 |
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 33 |
// generated classes can use this optimisation, which avoids the unnecessary |
| 34 |
// parameter conversions if there is no possibility of the virtual function |
| 35 |
// being overridden: |
| 36 |
if(obj_base && obj_base->is_derived_()) |
| 37 |
{ |
| 38 |
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 39 |
if(obj) // This can be NULL during destruction. |
| 40 |
{ |
| 41 |
try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 42 |
{ |
| 43 |
// Call the virtual member method, which derived classes might override. |
| 44 |
obj->send_event_vfunc(Gst::Structure(structure)); |
| 45 |
return; |
| 46 |
} |
| 47 |
catch(...) |
| 48 |
{ |
| 49 |
Glib::exception_handlers_invoke(); |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
BaseClassType *const base = static_cast<BaseClassType*>( |
| 55 |
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 56 |
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. |
| 57 |
) ); |
| 58 |
|
| 59 |
// Call the original underlying C function: |
| 60 |
if(base && base->send_event) |
| 61 |
(*base->send_event)(self, structure); |
| 62 |
|
| 63 |
} |
| 64 |
void Gst::Navigation::send_event_vfunc(Gst::Structure&& structure) |
| 65 |
{ |
| 66 |
BaseClassType *const base = static_cast<BaseClassType*>( |
| 67 |
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 68 |
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. |
| 69 |
) ); |
| 70 |
|
| 71 |
if(base && base->send_event) |
| 72 |
(*base->send_event)(gobj(), structure ? structure.release() : nullptr); |
| 73 |
} |
| 74 |
|
| 75 |
} // namespace Gst |