| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/padtemplate.h> |
| 7 | #include <gstreamermm/private/padtemplate_p.h> |
| 8 | |
| 9 | #include <cstring> // std::memset() |
| 10 | |
| 11 | /* gstreamermm - a C++ wrapper for gstreamer |
| 12 | * |
| 13 | * Copyright 2008-2016 The gstreamermm Development Team |
| 14 | * |
| 15 | * This library is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU Lesser General Public |
| 17 | * License as published by the Free Software Foundation; either |
| 18 | * version 2.1 of the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This library is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * Lesser General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU Lesser General Public |
| 26 | * License along with this library; if not, write to the Free |
| 27 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 28 | */ |
| 29 | |
| 30 | #include <gst/gst.h> |
| 31 | #include <gstreamermm/caps.h> |
| 32 | #include <gstreamermm/pad.h> |
| 33 | |
| 34 | |
| 35 | namespace |
| 36 | { |
| 37 | |
| 38 | |
| 39 | static void PadTemplate_signal_pad_created_callback(GstPadTemplate* self, GstPad* p0,void* data) |
| 40 | { |
| 41 | using namespace Gst; |
| 42 | using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Pad>& >; |
| 43 | |
| 44 | auto obj = dynamic_cast<PadTemplate*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); |
| 45 | // Do not try to call a signal on a disassociated wrapper. |
| 46 | if(obj) |
| 47 | { |
| 48 | try |
| 49 | { |
| 50 | if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) |
| 51 | (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true) |
| 52 | ); |
| 53 | } |
| 54 | catch(...) |
| 55 | { |
| 56 | Glib::exception_handlers_invoke(); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | static const Glib::SignalProxyInfo PadTemplate_signal_pad_created_info = |
| 62 | { |
| 63 | "pad-created", |
| 64 | (GCallback) &PadTemplate_signal_pad_created_callback, |
| 65 | (GCallback) &PadTemplate_signal_pad_created_callback |
| 66 | }; |
| 67 | |
| 68 | |
| 69 | } // anonymous namespace |
| 70 | |
| 71 | // static |
| 72 | GType Glib::Value<Gst::PadTemplateFlags>::value_type() |
| 73 | { |
| 74 | return gst_pad_template_flags_get_type(); |
| 75 | } |
| 76 | |
| 77 | // static |
| 78 | GType Glib::Value<Gst::PadPresence>::value_type() |
| 79 | { |
| 80 | return gst_pad_presence_get_type(); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | namespace Glib |
| 85 | { |
| 86 | |
| 87 | Glib::RefPtr<Gst::PadTemplate> wrap(GstPadTemplate* object, bool take_copy) |
| 88 | { |
| 89 | return Glib::RefPtr<Gst::PadTemplate>( dynamic_cast<Gst::PadTemplate*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); |
| 90 | //We use dynamic_cast<> in case of multiple inheritance. |
| 91 | } |
| 92 | |
| 93 | } /* namespace Glib */ |
| 94 | |
| 95 | |
| 96 | namespace Gst |
| 97 | { |
| 98 | |
| 99 | |
| 100 | /* The *_Class implementation: */ |
| 101 | |
| 102 | const Glib::Class& PadTemplate_Class::init() |
| 103 | { |
| 104 | if(!gtype_) // create the GType if necessary |
| 105 | { |
| 106 | // Glib::Class has to know the class init function to clone custom types. |
| 107 | class_init_func_ = &PadTemplate_Class::class_init_function; |
| 108 | |
| 109 | // This is actually just optimized away, apparently with no harm. |
| 110 | // Make sure that the parent type has been created. |
| 111 | //CppClassParent::CppObjectType::get_type(); |
| 112 | |
| 113 | // Create the wrapper type, with the same class/instance size as the base type. |
| 114 | register_derived_type(gst_pad_template_get_type()); |
| 115 | |
| 116 | // Add derived versions of interfaces, if the C type implements any interfaces: |
| 117 | |
| 118 | } |
| 119 | |
| 120 | return *this; |
| 121 | } |
| 122 | |
| 123 | |
| 124 | void PadTemplate_Class::class_init_function(void* g_class, void* class_data) |
| 125 | { |
| 126 | const auto klass = static_cast<BaseClassType*>(g_class); |
| 127 | CppClassParent::class_init_function(klass, class_data); |
| 128 | |
| 129 | |
| 130 | klass->pad_created = &pad_created_callback; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | void PadTemplate_Class::pad_created_callback(GstPadTemplate* self, GstPad* p0) |
| 135 | { |
| 136 | const auto obj_base = static_cast<Glib::ObjectBase*>( |
| 137 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 138 | |
| 139 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 140 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 141 | // generated classes can use this optimisation, which avoids the unnecessary |
| 142 | // parameter conversions if there is no possibility of the virtual function |
| 143 | // being overridden: |
| 144 | if(obj_base && obj_base->is_derived_()) |
| 145 | { |
| 146 | const auto obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 147 | if(obj) // This can be NULL during destruction. |
| 148 | { |
| 149 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 150 | { |
| 151 | // Call the virtual member method, which derived classes might override. |
| 152 | obj->on_pad_created(Glib::wrap(p0, true) |
| 153 | ); |
| 154 | return; |
| 155 | } |
| 156 | catch(...) |
| 157 | { |
| 158 | Glib::exception_handlers_invoke(); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | const auto base = static_cast<BaseClassType*>( |
| 164 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). |
| 165 | ); |
| 166 | |
| 167 | // Call the original underlying C function: |
| 168 | if(base && base->pad_created) |
| 169 | (*base->pad_created)(self, p0); |
| 170 | } |
| 171 | |
| 172 | |
| 173 | Glib::ObjectBase* PadTemplate_Class::wrap_new(GObject* object) |
| 174 | { |
| 175 | return new PadTemplate((GstPadTemplate*)object); |
| 176 | } |
| 177 | |
| 178 | |
| 179 | /* The implementation: */ |
| 180 | |
| 181 | GstPadTemplate* PadTemplate::gobj_copy() |
| 182 | { |
| 183 | reference(); |
| 184 | return gobj(); |
| 185 | } |
| 186 | |
| 187 | PadTemplate::PadTemplate(const Glib::ConstructParams& construct_params) |
| 188 | : |
| 189 | Object(construct_params) |
| 190 | { |
| 191 | |
| 192 | } |
| 193 | |
| 194 | PadTemplate::PadTemplate(GstPadTemplate* castitem) |
| 195 | : |
| 196 | Object((GstObject*)(castitem)) |
| 197 | {} |
| 198 | |
| 199 | |
| 200 | PadTemplate::PadTemplate(PadTemplate&& src) noexcept |
| 201 | : Object(std::move(src)) |
| 202 | {} |
| 203 | |
| 204 | PadTemplate& PadTemplate::operator=(PadTemplate&& src) noexcept |
| 205 | { |
| 206 | Object::operator=(std::move(src)); |
| 207 | return *this; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | PadTemplate::~PadTemplate() noexcept |
| 212 | {} |
| 213 | |
| 214 | |
| 215 | PadTemplate::CppClassType PadTemplate::padtemplate_class_; // initialize static member |
| 216 | |
| 217 | GType PadTemplate::get_type() |
| 218 | { |
| 219 | return padtemplate_class_.init().get_type(); |
| 220 | } |
| 221 | |
| 222 | |
| 223 | GType PadTemplate::get_base_type() |
| 224 | { |
| 225 | return gst_pad_template_get_type(); |
| 226 | } |
| 227 | |
| 228 | |
| 229 | PadTemplate::PadTemplate(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Gst::Caps>& caps) |
| 230 | : |
| 231 | // Mark this class as non-derived to allow C++ vfuncs to be skipped. |
| 232 | Glib::ObjectBase(nullptr), |
| 233 | Object(Glib::ConstructParams(padtemplate_class_.init(), "name_template", name_template.c_str(), "direction", ((GstPadDirection)(direction)), "presence", ((GstPadPresence)(presence)), "caps", Glib::unwrap(caps), nullptr)) |
| 234 | { |
| 235 | |
| 236 | |
| 237 | } |
| 238 | |
| 239 | Glib::RefPtr<PadTemplate> PadTemplate::create(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Gst::Caps>& caps) |
| 240 | { |
| 241 | return Glib::RefPtr<PadTemplate>( new PadTemplate(name_template, direction, presence, caps) ); |
| 242 | } |
| 243 | |
| 244 | Glib::RefPtr<Gst::Caps> PadTemplate::get_caps() |
| 245 | { |
| 246 | return Glib::wrap(gst_pad_template_get_caps(gobj())); |
| 247 | } |
| 248 | |
| 249 | Glib::RefPtr<const Gst::Caps> PadTemplate::get_caps() const |
| 250 | { |
| 251 | return const_cast<PadTemplate*>(this)->get_caps(); |
| 252 | } |
| 253 | |
| 254 | Glib::ustring PadTemplate::get_name_template() const |
| 255 | { |
| 256 | return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name_template); |
| 257 | } |
| 258 | |
| 259 | PadDirection PadTemplate::get_direction() const |
| 260 | { |
| 261 | return ((PadDirection)(gobj()->direction)); |
| 262 | } |
| 263 | |
| 264 | PadPresence PadTemplate::get_presence() const |
| 265 | { |
| 266 | return ((PadPresence)(gobj()->presence)); |
| 267 | } |
| 268 | |
| 269 | |
| 270 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& > PadTemplate::signal_pad_created() |
| 271 | { |
| 272 | return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& >(this, &PadTemplate_signal_pad_created_info); |
| 273 | } |
| 274 | |
| 275 | |
| 276 | Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> > PadTemplate::property_caps() const |
| 277 | { |
| 278 | return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> >(this, "caps"); |
| 279 | } |
| 280 | |
| 281 | Glib::PropertyProxy_ReadOnly< Gst::PadDirection > PadTemplate::property_direction() const |
| 282 | { |
| 283 | return Glib::PropertyProxy_ReadOnly< Gst::PadDirection >(this, "direction"); |
| 284 | } |
| 285 | |
| 286 | Glib::PropertyProxy_ReadOnly< Glib::ustring > PadTemplate::property_name_template() const |
| 287 | { |
| 288 | return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name-template"); |
| 289 | } |
| 290 | |
| 291 | Glib::PropertyProxy_ReadOnly< Gst::PadPresence > PadTemplate::property_presence() const |
| 292 | { |
| 293 | return Glib::PropertyProxy_ReadOnly< Gst::PadPresence >(this, "presence"); |
| 294 | } |
| 295 | |
| 296 | |
| 297 | void Gst::PadTemplate::on_pad_created(const Glib::RefPtr<Gst::Pad>& pad) |
| 298 | { |
| 299 | const auto base = static_cast<BaseClassType*>( |
| 300 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). |
| 301 | ); |
| 302 | |
| 303 | if(base && base->pad_created) |
| 304 | (*base->pad_created)(gobj(),Glib::unwrap(pad)); |
| 305 | } |
| 306 | |
| 307 | |
| 308 | } // namespace Gst |
| 309 | |
| 310 | |
| 311 | namespace Glib |
| 312 | { |
| 313 | |
| 314 | Gst::StaticPadTemplate& wrap(GstStaticPadTemplate* object) |
| 315 | { |
| 316 | return *reinterpret_cast<Gst::StaticPadTemplate*>(object); |
| 317 | } |
| 318 | |
| 319 | const Gst::StaticPadTemplate& wrap(const GstStaticPadTemplate* object) |
| 320 | { |
| 321 | return *reinterpret_cast<const Gst::StaticPadTemplate*>(object); |
| 322 | } |
| 323 | |
| 324 | } // namespace Glib |
| 325 | |
| 326 | |
| 327 | namespace Gst |
| 328 | { |
| 329 | |
| 330 | |
| 331 | StaticPadTemplate::StaticPadTemplate(const StaticPadTemplate& other) noexcept |
| 332 | : |
| 333 | gobject_(other.gobject_) |
| 334 | { |
| 335 | } |
| 336 | |
| 337 | StaticPadTemplate& StaticPadTemplate::operator=(const StaticPadTemplate& other) noexcept |
| 338 | { |
| 339 | gobject_ = other.gobject_; |
| 340 | return *this; |
| 341 | } |
| 342 | |
| 343 | StaticPadTemplate::StaticPadTemplate(StaticPadTemplate&& other) noexcept |
| 344 | : |
| 345 | gobject_(std::move(other.gobject_)) |
| 346 | { |
| 347 | //We could wipe other.gobject_ via memset, |
| 348 | //but that is not really necessary: |
| 349 | //other.gobject_ = nullptr; |
| 350 | } |
| 351 | |
| 352 | StaticPadTemplate& StaticPadTemplate::operator=(StaticPadTemplate&& other) noexcept |
| 353 | { |
| 354 | gobject_ = std::move(other.gobject_); |
| 355 | return *this; |
| 356 | } |
| 357 | |
| 358 | // static |
| 359 | GType StaticPadTemplate::get_type() |
| 360 | { |
| 361 | return gst_static_pad_template_get_type(); |
| 362 | } |
| 363 | |
| 364 | StaticPadTemplate::StaticPadTemplate() |
| 365 | { |
| 366 | std::memset(&gobject_, 0, sizeof(GstStaticPadTemplate)); |
| 367 | } |
| 368 | |
| 369 | StaticPadTemplate::StaticPadTemplate(const GstStaticPadTemplate* gobject) |
| 370 | { |
| 371 | if(gobject) |
| 372 | gobject_ = *gobject; |
| 373 | else |
| 374 | std::memset(&gobject_, 0, sizeof(GstStaticPadTemplate)); |
| 375 | } |
| 376 | |
| 377 | Glib::RefPtr<Gst::Caps> StaticPadTemplate::get_caps() |
| 378 | { |
| 379 | return Glib::wrap(gst_static_pad_template_get_caps(gobj())); |
| 380 | } |
| 381 | |
| 382 | Glib::RefPtr<const Gst::Caps> StaticPadTemplate::get_caps() const |
| 383 | { |
| 384 | return const_cast<StaticPadTemplate*>(this)->get_caps(); |
| 385 | } |
| 386 | |
| 387 | Glib::RefPtr<Gst::PadTemplate> StaticPadTemplate::get() |
| 388 | { |
| 389 | return Glib::wrap(gst_static_pad_template_get(gobj())); |
| 390 | } |
| 391 | |
| 392 | Glib::ustring StaticPadTemplate::get_name_template() const |
| 393 | { |
| 394 | return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name_template); |
| 395 | } |
| 396 | |
| 397 | PadDirection StaticPadTemplate::get_direction() const |
| 398 | { |
| 399 | return ((PadDirection)(gobj()->direction)); |
| 400 | } |
| 401 | |
| 402 | PadPresence StaticPadTemplate::get_presence() const |
| 403 | { |
| 404 | return ((PadPresence)(gobj()->presence)); |
| 405 | } |
| 406 | |
| 407 | |
| 408 | } // namespace Gst |
| 409 | |
| 410 |