| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/taskpool.h> |
| 7 | #include <gstreamermm/private/taskpool_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008 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 <gst/gst.h> |
| 30 | |
| 31 | |
| 32 | namespace |
| 33 | { |
| 34 | |
| 35 | extern "C" |
| 36 | { |
| 37 | |
| 38 | static void TaskPool_Push_gstreamermm_callback(void* data) |
| 39 | { |
| 40 | Gst::TaskPool::SlotPush* the_slot = static_cast<Gst::TaskPool::SlotPush*>(data); |
| 41 | |
| 42 | try |
| 43 | { |
| 44 | (*the_slot)(); |
| 45 | delete the_slot; |
| 46 | } |
| 47 | catch(...) |
| 48 | { |
| 49 | Glib::exception_handlers_invoke(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | } // extern "C" |
| 54 | |
| 55 | } // anonymous namespace |
| 56 | |
| 57 | namespace Gst |
| 58 | { |
| 59 | |
| 60 | gpointer TaskPool::push(const SlotPush& slot) |
| 61 | { |
| 62 | GError* gerror = 0; |
| 63 | SlotPush* slot_copy = new SlotPush(slot); |
| 64 | |
| 65 | gpointer ret_val = gst_task_pool_push(gobj(), |
| 66 | &TaskPool_Push_gstreamermm_callback, slot_copy, &gerror); |
| 67 | |
| 68 | if(gerror) |
| 69 | ::Glib::Error::throw_exception(gerror); |
| 70 | |
| 71 | return ret_val; |
| 72 | } |
| 73 | |
| 74 | void TaskPool_Class::prepare_vfunc_callback(GstTaskPool* self, GError** error) |
| 75 | { |
| 76 | Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 77 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 78 | |
| 79 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 80 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 81 | // generated classes can use this optimisation, which avoids the unnecessary |
| 82 | // parameter conversions if there is no possibility of the virtual function |
| 83 | // being overridden: |
| 84 | if(obj_base && obj_base->is_derived_()) |
| 85 | { |
| 86 | CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 87 | if(obj) // This can be NULL during destruction. |
| 88 | { |
| 89 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 90 | { |
| 91 | // Call the virtual member method, which derived classes might override. |
| 92 | obj->prepare_vfunc(); |
| 93 | |
| 94 | return; |
| 95 | } |
| 96 | catch(...) |
| 97 | { |
| 98 | Glib::exception_handlers_invoke(); |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 104 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 105 | ); |
| 106 | |
| 107 | // Call the original underlying C function: |
| 108 | if(base && base->prepare) |
| 109 | (*base->prepare)(self, error); |
| 110 | |
| 111 | } |
| 112 | void Gst::TaskPool::prepare_vfunc() |
| 113 | { |
| 114 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 115 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 116 | ); |
| 117 | |
| 118 | if(base && base->prepare) |
| 119 | { |
| 120 | GError* gerror = 0; |
| 121 | (*base->prepare)(gobj(),&gerror); |
| 122 | |
| 123 | if(gerror) |
| 124 | ::Glib::Error::throw_exception(gerror); |
| 125 | } |
| 126 | } |
| 127 | gpointer TaskPool_Class::push_vfunc_callback(GstTaskPool* self, GstTaskPoolFunction func, gpointer user_data, GError** error) |
| 128 | { |
| 129 | Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 130 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 131 | |
| 132 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 133 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 134 | // generated classes can use this optimisation, which avoids the unnecessary |
| 135 | // parameter conversions if there is no possibility of the virtual function |
| 136 | // being overridden: |
| 137 | if(obj_base && obj_base->is_derived_()) |
| 138 | { |
| 139 | CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 140 | if(obj) // This can be NULL during destruction. |
| 141 | { |
| 142 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 143 | { |
| 144 | // Call the virtual member method, which derived classes might override. |
| 145 | Gst::TaskPool::SlotPush* slot = |
| 146 | static_cast<Gst::TaskPool::SlotPush*>(user_data); |
| 147 | |
| 148 | return obj->push_vfunc(*slot); |
| 149 | |
| 150 | } |
| 151 | catch(...) |
| 152 | { |
| 153 | Glib::exception_handlers_invoke(); |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 159 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 160 | ); |
| 161 | |
| 162 | // Call the original underlying C function: |
| 163 | if(base && base->push) |
| 164 | return (*base->push)(self, func, user_data, error); |
| 165 | |
| 166 | |
| 167 | typedef gpointer RType; |
| 168 | return RType(); |
| 169 | } |
| 170 | gpointer Gst::TaskPool::push_vfunc(const SlotPush& slot) |
| 171 | { |
| 172 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 173 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 174 | ); |
| 175 | |
| 176 | if(base && base->push) |
| 177 | { |
| 178 | GError* gerror = 0; |
| 179 | gpointer result = (*base->push)(gobj(), |
| 180 | &TaskPool_Push_gstreamermm_callback, const_cast<SlotPush*>(&slot), |
| 181 | &gerror); |
| 182 | |
| 183 | if(gerror) |
| 184 | ::Glib::Error::throw_exception(gerror); |
| 185 | |
| 186 | return result; |
| 187 | } |
| 188 | |
| 189 | typedef gpointer RType; |
| 190 | return RType(); |
| 191 | } |
| 192 | |
| 193 | } //namespace Gst |
| 194 | |
| 195 | namespace |
| 196 | { |
| 197 | } // anonymous namespace |
| 198 | |
| 199 | |
| 200 | namespace Glib |
| 201 | { |
| 202 | |
| 203 | Glib::RefPtr<Gst::TaskPool> wrap(GstTaskPool* object, bool take_copy) |
| 204 | { |
| 205 | return Glib::RefPtr<Gst::TaskPool>( dynamic_cast<Gst::TaskPool*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); |
| 206 | //We use dynamic_cast<> in case of multiple inheritance. |
| 207 | } |
| 208 | |
| 209 | } /* namespace Glib */ |
| 210 | |
| 211 | |
| 212 | namespace Gst |
| 213 | { |
| 214 | |
| 215 | |
| 216 | /* The *_Class implementation: */ |
| 217 | |
| 218 | const Glib::Class& TaskPool_Class::init() |
| 219 | { |
| 220 | if(!gtype_) // create the GType if necessary |
| 221 | { |
| 222 | // Glib::Class has to know the class init function to clone custom types. |
| 223 | class_init_func_ = &TaskPool_Class::class_init_function; |
| 224 | |
| 225 | // This is actually just optimized away, apparently with no harm. |
| 226 | // Make sure that the parent type has been created. |
| 227 | //CppClassParent::CppObjectType::get_type(); |
| 228 | |
| 229 | // Create the wrapper type, with the same class/instance size as the base type. |
| 230 | register_derived_type(gst_task_pool_get_type()); |
| 231 | |
| 232 | // Add derived versions of interfaces, if the C type implements any interfaces: |
| 233 | |
| 234 | } |
| 235 | |
| 236 | return *this; |
| 237 | } |
| 238 | |
| 239 | |
| 240 | void TaskPool_Class::class_init_function(void* g_class, void* class_data) |
| 241 | { |
| 242 | const auto klass = static_cast<BaseClassType*>(g_class); |
| 243 | CppClassParent::class_init_function(klass, class_data); |
| 244 | |
| 245 | klass->cleanup = &cleanup_vfunc_callback; |
| 246 | klass->join = &join_vfunc_callback; |
| 247 | klass->prepare = &prepare_vfunc_callback; |
| 248 | klass->push = &push_vfunc_callback; |
| 249 | |
| 250 | } |
| 251 | |
| 252 | void TaskPool_Class::cleanup_vfunc_callback(GstTaskPool* self) |
| 253 | { |
| 254 | const auto obj_base = static_cast<Glib::ObjectBase*>( |
| 255 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 256 | |
| 257 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 258 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 259 | // generated classes can use this optimisation, which avoids the unnecessary |
| 260 | // parameter conversions if there is no possibility of the virtual function |
| 261 | // being overridden: |
| 262 | if(obj_base && obj_base->is_derived_()) |
| 263 | { |
| 264 | const auto obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 265 | if(obj) // This can be NULL during destruction. |
| 266 | { |
| 267 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 268 | { |
| 269 | // Call the virtual member method, which derived classes might override. |
| 270 | obj->cleanup_vfunc(); |
| 271 | return; |
| 272 | } |
| 273 | catch(...) |
| 274 | { |
| 275 | Glib::exception_handlers_invoke(); |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 281 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 282 | ); |
| 283 | |
| 284 | // Call the original underlying C function: |
| 285 | if(base && base->cleanup) |
| 286 | (*base->cleanup)(self); |
| 287 | } |
| 288 | void TaskPool_Class::join_vfunc_callback(GstTaskPool* self, gpointer id) |
| 289 | { |
| 290 | const auto obj_base = static_cast<Glib::ObjectBase*>( |
| 291 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 292 | |
| 293 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 294 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 295 | // generated classes can use this optimisation, which avoids the unnecessary |
| 296 | // parameter conversions if there is no possibility of the virtual function |
| 297 | // being overridden: |
| 298 | if(obj_base && obj_base->is_derived_()) |
| 299 | { |
| 300 | const auto obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 301 | if(obj) // This can be NULL during destruction. |
| 302 | { |
| 303 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 304 | { |
| 305 | // Call the virtual member method, which derived classes might override. |
| 306 | obj->join_vfunc(id); |
| 307 | return; |
| 308 | } |
| 309 | catch(...) |
| 310 | { |
| 311 | Glib::exception_handlers_invoke(); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 317 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 318 | ); |
| 319 | |
| 320 | // Call the original underlying C function: |
| 321 | if(base && base->join) |
| 322 | (*base->join)(self, id); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | Glib::ObjectBase* TaskPool_Class::wrap_new(GObject* object) |
| 327 | { |
| 328 | return new TaskPool((GstTaskPool*)object); |
| 329 | } |
| 330 | |
| 331 | |
| 332 | /* The implementation: */ |
| 333 | |
| 334 | GstTaskPool* TaskPool::gobj_copy() |
| 335 | { |
| 336 | reference(); |
| 337 | return gobj(); |
| 338 | } |
| 339 | |
| 340 | TaskPool::TaskPool(const Glib::ConstructParams& construct_params) |
| 341 | : |
| 342 | Object(construct_params) |
| 343 | { |
| 344 | |
| 345 | } |
| 346 | |
| 347 | TaskPool::TaskPool(GstTaskPool* castitem) |
| 348 | : |
| 349 | Object((GstObject*)(castitem)) |
| 350 | {} |
| 351 | |
| 352 | |
| 353 | TaskPool::TaskPool(TaskPool&& src) noexcept |
| 354 | : Object(std::move(src)) |
| 355 | {} |
| 356 | |
| 357 | TaskPool& TaskPool::operator=(TaskPool&& src) noexcept |
| 358 | { |
| 359 | Object::operator=(std::move(src)); |
| 360 | return *this; |
| 361 | } |
| 362 | |
| 363 | |
| 364 | TaskPool::~TaskPool() noexcept |
| 365 | {} |
| 366 | |
| 367 | |
| 368 | TaskPool::CppClassType TaskPool::taskpool_class_; // initialize static member |
| 369 | |
| 370 | GType TaskPool::get_type() |
| 371 | { |
| 372 | return taskpool_class_.init().get_type(); |
| 373 | } |
| 374 | |
| 375 | |
| 376 | GType TaskPool::get_base_type() |
| 377 | { |
| 378 | return gst_task_pool_get_type(); |
| 379 | } |
| 380 | |
| 381 | |
| 382 | TaskPool::TaskPool() |
| 383 | : |
| 384 | // Mark this class as non-derived to allow C++ vfuncs to be skipped. |
| 385 | Glib::ObjectBase(nullptr), |
| 386 | Object(Glib::ConstructParams(taskpool_class_.init())) |
| 387 | { |
| 388 | |
| 389 | |
| 390 | } |
| 391 | |
| 392 | Glib::RefPtr<TaskPool> TaskPool::create() |
| 393 | { |
| 394 | return Glib::RefPtr<TaskPool>( new TaskPool() ); |
| 395 | } |
| 396 | |
| 397 | void TaskPool::prepare() |
| 398 | { |
| 399 | GError* gerror = nullptr; |
| 400 | gst_task_pool_prepare(gobj(), &(gerror)); |
| 401 | if(gerror) |
| 402 | ::Glib::Error::throw_exception(gerror); |
| 403 | } |
| 404 | |
| 405 | void TaskPool::join(gpointer id) |
| 406 | { |
| 407 | gst_task_pool_join(gobj(), id); |
| 408 | } |
| 409 | |
| 410 | void TaskPool::cleanup() |
| 411 | { |
| 412 | gst_task_pool_cleanup(gobj()); |
| 413 | } |
| 414 | |
| 415 | |
| 416 | void Gst::TaskPool::cleanup_vfunc() |
| 417 | { |
| 418 | const auto base = static_cast<BaseClassType*>( |
| 419 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 420 | ); |
| 421 | |
| 422 | if(base && base->cleanup) |
| 423 | { |
| 424 | (*base->cleanup)(gobj()); |
| 425 | } |
| 426 | } |
| 427 | void Gst::TaskPool::join_vfunc(gpointer id) |
| 428 | { |
| 429 | const auto base = static_cast<BaseClassType*>( |
| 430 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 431 | ); |
| 432 | |
| 433 | if(base && base->join) |
| 434 | { |
| 435 | (*base->join)(gobj(),id); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | |
| 440 | } // namespace Gst |
| 441 | |
| 442 |