| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/urihandler.h> |
| 7 | #include <gstreamermm/private/urihandler_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 | #include <gstreamermm/element.h> |
| 31 | |
| 32 | namespace Gst |
| 33 | { |
| 34 | |
| 35 | URIType URIHandler::get_type_vfunc() |
| 36 | { |
| 37 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 38 | g_type_interface_peek_parent( |
| 39 | g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) |
| 40 | ) ); |
| 41 | |
| 42 | if(base && base->get_type) |
| 43 | { |
| 44 | return static_cast<URIType>((*base->get_type)(CppObjectType::get_type())); |
| 45 | } |
| 46 | |
| 47 | return URIType(); |
| 48 | } |
| 49 | |
| 50 | GstURIType URIHandler_Class::get_type_vfunc_callback(GType type) |
| 51 | { |
| 52 | gpointer self = g_object_new(type, nullptr); |
| 53 | Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 54 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 55 | |
| 56 | if(obj_base && obj_base->is_derived_()) |
| 57 | { |
| 58 | CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 59 | if(obj) |
| 60 | { |
| 61 | #ifdef GLIBMM_EXCEPTIONS_ENABLED |
| 62 | try |
| 63 | { |
| 64 | #endif //GLIBMM_EXCEPTIONS_ENABLED |
| 65 | return static_cast<GstURIType>(obj->get_type_vfunc()); |
| 66 | #ifdef GLIBMM_EXCEPTIONS_ENABLED |
| 67 | } |
| 68 | catch(...) |
| 69 | { |
| 70 | Glib::exception_handlers_invoke(); |
| 71 | } |
| 72 | #endif //GLIBMM_EXCEPTIONS_ENABLED |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 77 | g_type_interface_peek_parent( |
| 78 | g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) |
| 79 | ) ); |
| 80 | |
| 81 | if(base && base->get_type) |
| 82 | { |
| 83 | return (*base->get_type)(type); |
| 84 | } |
| 85 | |
| 86 | return GstURIType(); |
| 87 | } |
| 88 | |
| 89 | const gchar * const * URIHandler::get_protocols_vfunc() const |
| 90 | { |
| 91 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 92 | g_type_interface_peek_parent( |
| 93 | g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) |
| 94 | ) ); |
| 95 | |
| 96 | if(base && base->get_protocols) |
| 97 | { |
| 98 | return (*base->get_protocols)(CppObjectType::get_type()); |
| 99 | } |
| 100 | static const gchar* protocols[] = {nullptr}; |
| 101 | return protocols; |
| 102 | } |
| 103 | |
| 104 | const gchar * const * URIHandler_Class::get_protocols_vfunc_callback(GType type) |
| 105 | { |
| 106 | gpointer self = g_object_new(type, nullptr); |
| 107 | Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 108 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 109 | |
| 110 | if(obj_base && obj_base->is_derived_()) |
| 111 | { |
| 112 | CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 113 | if(obj) |
| 114 | { |
| 115 | #ifdef GLIBMM_EXCEPTIONS_ENABLED |
| 116 | try |
| 117 | { |
| 118 | #endif //GLIBMM_EXCEPTIONS_ENABLED |
| 119 | return obj->get_protocols_vfunc(); |
| 120 | #ifdef GLIBMM_EXCEPTIONS_ENABLED |
| 121 | } |
| 122 | catch(...) |
| 123 | { |
| 124 | Glib::exception_handlers_invoke(); |
| 125 | } |
| 126 | #endif //GLIBMM_EXCEPTIONS_ENABLED |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 131 | g_type_interface_peek_parent( |
| 132 | g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) |
| 133 | ) ); |
| 134 | |
| 135 | if(base && base->get_protocols) |
| 136 | { |
| 137 | return (*base->get_protocols)(type); |
| 138 | } |
| 139 | static const gchar *protocols[] = { nullptr }; |
| 140 | return protocols; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | namespace |
| 145 | { |
| 146 | } // anonymous namespace |
| 147 | |
| 148 | // static |
| 149 | GType Glib::Value<Gst::URIType>::value_type() |
| 150 | { |
| 151 | return gst_uri_type_get_type(); |
| 152 | } |
| 153 | |
| 154 | // static |
| 155 | GType Glib::Value<Gst::URIError>::value_type() |
| 156 | { |
| 157 | return gst_uri_error_get_type(); |
| 158 | } |
| 159 | |
| 160 | |
| 161 | namespace Glib |
| 162 | { |
| 163 | |
| 164 | Glib::RefPtr<Gst::URIHandler> wrap(GstURIHandler* object, bool take_copy) |
| 165 | { |
| 166 | return Glib::RefPtr<Gst::URIHandler>( dynamic_cast<Gst::URIHandler*> (Glib::wrap_auto_interface<Gst::URIHandler> ((GObject*)(object), take_copy)) ); |
| 167 | //We use dynamic_cast<> in case of multiple inheritance. |
| 168 | } |
| 169 | |
| 170 | } // namespace Glib |
| 171 | |
| 172 | |
| 173 | namespace Gst |
| 174 | { |
| 175 | |
| 176 | |
| 177 | /* The *_Class implementation: */ |
| 178 | |
| 179 | const Glib::Interface_Class& URIHandler_Class::init() |
| 180 | { |
| 181 | if(!gtype_) // create the GType if necessary |
| 182 | { |
| 183 | // Glib::Interface_Class has to know the interface init function |
| 184 | // in order to add interfaces to implementing types. |
| 185 | class_init_func_ = &URIHandler_Class::iface_init_function; |
| 186 | |
| 187 | // We can not derive from another interface, and it is not necessary anyway. |
| 188 | gtype_ = gst_uri_handler_get_type(); |
| 189 | } |
| 190 | |
| 191 | return *this; |
| 192 | } |
| 193 | |
| 194 | void URIHandler_Class::iface_init_function(void* g_iface, void*) |
| 195 | { |
| 196 | const auto klass = static_cast<BaseClassType*>(g_iface); |
| 197 | |
| 198 | //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. |
| 199 | //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc |
| 200 | g_assert(klass != nullptr); |
| 201 | |
| 202 | klass->get_uri = &get_uri_vfunc_callback; |
| 203 | klass->set_uri = &set_uri_vfunc_callback; |
| 204 | klass->get_type = &get_type_vfunc_callback; |
| 205 | klass->get_protocols = &get_protocols_vfunc_callback; |
| 206 | |
| 207 | } |
| 208 | |
| 209 | gchar* URIHandler_Class::get_uri_vfunc_callback(GstURIHandler* self) |
| 210 | { |
| 211 | const auto obj_base = static_cast<Glib::ObjectBase*>( |
| 212 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 213 | |
| 214 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 215 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 216 | // generated classes can use this optimisation, which avoids the unnecessary |
| 217 | // parameter conversions if there is no possibility of the virtual function |
| 218 | // being overridden: |
| 219 | if(obj_base && obj_base->is_derived_()) |
| 220 | { |
| 221 | const auto obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 222 | if(obj) // This can be NULL during destruction. |
| 223 | { |
| 224 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 225 | { |
| 226 | // Call the virtual member method, which derived classes might override. |
| 227 | return g_strdup((obj->get_uri_vfunc()).c_str()); |
| 228 | } |
| 229 | catch(...) |
| 230 | { |
| 231 | Glib::exception_handlers_invoke(); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 237 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 238 | g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. |
| 239 | ) ); |
| 240 | |
| 241 | // Call the original underlying C function: |
| 242 | if(base && base->get_uri) |
| 243 | return (*base->get_uri)(self); |
| 244 | |
| 245 | using RType = gchar*; |
| 246 | return RType(); |
| 247 | } |
| 248 | gboolean URIHandler_Class::set_uri_vfunc_callback(GstURIHandler* self, const gchar* uri, GError** error) |
| 249 | { |
| 250 | const auto obj_base = static_cast<Glib::ObjectBase*>( |
| 251 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 252 | |
| 253 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 254 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 255 | // generated classes can use this optimisation, which avoids the unnecessary |
| 256 | // parameter conversions if there is no possibility of the virtual function |
| 257 | // being overridden: |
| 258 | if(obj_base && obj_base->is_derived_()) |
| 259 | { |
| 260 | const auto obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 261 | if(obj) // This can be NULL during destruction. |
| 262 | { |
| 263 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 264 | { |
| 265 | // Call the virtual member method, which derived classes might override. |
| 266 | return static_cast<int>(obj->set_uri_vfunc(Glib::convert_const_gchar_ptr_to_ustring(uri) |
| 267 | , error)); |
| 268 | } |
| 269 | catch(...) |
| 270 | { |
| 271 | Glib::exception_handlers_invoke(); |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 277 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 278 | g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. |
| 279 | ) ); |
| 280 | |
| 281 | // Call the original underlying C function: |
| 282 | if(base && base->set_uri) |
| 283 | return (*base->set_uri)(self, uri, error); |
| 284 | |
| 285 | using RType = gboolean; |
| 286 | return RType(); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | Glib::ObjectBase* URIHandler_Class::wrap_new(GObject* object) |
| 291 | { |
| 292 | return new URIHandler((GstURIHandler*)(object)); |
| 293 | } |
| 294 | |
| 295 | |
| 296 | /* The implementation: */ |
| 297 | |
| 298 | URIHandler::URIHandler() |
| 299 | : |
| 300 | Glib::Interface(urihandler_class_.init()) |
| 301 | {} |
| 302 | |
| 303 | URIHandler::URIHandler(GstURIHandler* castitem) |
| 304 | : |
| 305 | Glib::Interface((GObject*)(castitem)) |
| 306 | {} |
| 307 | |
| 308 | URIHandler::URIHandler(const Glib::Interface_Class& interface_class) |
| 309 | : Glib::Interface(interface_class) |
| 310 | { |
| 311 | } |
| 312 | |
| 313 | URIHandler::URIHandler(URIHandler&& src) noexcept |
| 314 | : Glib::Interface(std::move(src)) |
| 315 | {} |
| 316 | |
| 317 | URIHandler& URIHandler::operator=(URIHandler&& src) noexcept |
| 318 | { |
| 319 | Glib::Interface::operator=(std::move(src)); |
| 320 | return *this; |
| 321 | } |
| 322 | |
| 323 | URIHandler::~URIHandler() noexcept |
| 324 | {} |
| 325 | |
| 326 | // static |
| 327 | void URIHandler::add_interface(GType gtype_implementer) |
| 328 | { |
| 329 | urihandler_class_.init().add_interface(gtype_implementer); |
| 330 | } |
| 331 | |
| 332 | URIHandler::CppClassType URIHandler::urihandler_class_; // initialize static member |
| 333 | |
| 334 | GType URIHandler::get_type() |
| 335 | { |
| 336 | return urihandler_class_.init().get_type(); |
| 337 | } |
| 338 | |
| 339 | |
| 340 | GType URIHandler::get_base_type() |
| 341 | { |
| 342 | return gst_uri_handler_get_type(); |
| 343 | } |
| 344 | |
| 345 | |
| 346 | bool URIHandler::protocol_is_valid(const Glib::ustring& protocol) |
| 347 | { |
| 348 | return gst_uri_protocol_is_valid(protocol.c_str()); |
| 349 | } |
| 350 | |
| 351 | bool URIHandler::protocol_is_supported(const Gst::URIType type, const Glib::ustring& protocol) |
| 352 | { |
| 353 | return gst_uri_protocol_is_supported((GstURIType)(type), protocol.c_str()); |
| 354 | } |
| 355 | |
| 356 | bool URIHandler::uri_is_valid(const Glib::ustring& uri) |
| 357 | { |
| 358 | return gst_uri_is_valid(uri.c_str()); |
| 359 | } |
| 360 | |
| 361 | bool URIHandler::uri_has_protocol(const Glib::ustring& uri, const Glib::ustring& protocol) |
| 362 | { |
| 363 | return gst_uri_has_protocol(uri.c_str(), protocol.c_str()); |
| 364 | } |
| 365 | |
| 366 | Glib::ustring URIHandler::get_protocol(const Glib::ustring& uri) |
| 367 | { |
| 368 | return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_get_protocol(uri.c_str())); |
| 369 | } |
| 370 | |
| 371 | Glib::ustring URIHandler::get_location(const Glib::ustring& uri) |
| 372 | { |
| 373 | return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_get_location(uri.c_str())); |
| 374 | } |
| 375 | |
| 376 | Glib::ustring URIHandler::construct_uri(const Glib::ustring& protocol, const Glib::ustring& location) |
| 377 | { |
| 378 | return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_construct(protocol.c_str(), location.c_str())); |
| 379 | } |
| 380 | |
| 381 | Glib::ustring URIHandler::filename_to_uri(const Glib::ustring& filename) |
| 382 | { |
| 383 | GError* gerror = nullptr; |
| 384 | Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(gst_filename_to_uri(filename.c_str(), &(gerror))); |
| 385 | if(gerror) |
| 386 | ::Glib::Error::throw_exception(gerror); |
| 387 | return retvalue; |
| 388 | } |
| 389 | |
| 390 | Glib::RefPtr<Gst::Element> URIHandler::make_element_from_uri(const Gst::URIType type, const Glib::ustring& uri, const Glib::ustring& name) |
| 391 | { |
| 392 | GError* gerror = nullptr; |
| 393 | Glib::RefPtr<Gst::Element> retvalue = Glib::wrap(gst_element_make_from_uri((GstURIType)(type), uri.c_str(), name.c_str(), &(gerror))); |
| 394 | if(gerror) |
| 395 | ::Glib::Error::throw_exception(gerror); |
| 396 | return retvalue; |
| 397 | } |
| 398 | |
| 399 | URIType URIHandler::get_uri_type() const |
| 400 | { |
| 401 | return ((URIType)(gst_uri_handler_get_uri_type(const_cast<GstURIHandler*>(gobj())))); |
| 402 | } |
| 403 | |
| 404 | std::vector<Glib::ustring> URIHandler::get_protocols() const |
| 405 | { |
| 406 | return Glib::ArrayHandler<Glib::ustring>::array_to_vector(gst_uri_handler_get_protocols(const_cast<GstURIHandler*>(gobj())), Glib::OWNERSHIP_NONE); |
| 407 | } |
| 408 | |
| 409 | Glib::ustring URIHandler::get_uri() const |
| 410 | { |
| 411 | return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_handler_get_uri(const_cast<GstURIHandler*>(gobj()))); |
| 412 | } |
| 413 | |
| 414 | bool URIHandler::set_uri(const Glib::ustring& uri) |
| 415 | { |
| 416 | GError* gerror = nullptr; |
| 417 | bool retvalue = gst_uri_handler_set_uri(gobj(), uri.c_str(), &(gerror)); |
| 418 | if(gerror) |
| 419 | ::Glib::Error::throw_exception(gerror); |
| 420 | return retvalue; |
| 421 | } |
| 422 | |
| 423 | |
| 424 | Glib::ustring Gst::URIHandler::get_uri_vfunc() const |
| 425 | { |
| 426 | const auto base = static_cast<BaseClassType*>( |
| 427 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 428 | g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. |
| 429 | ) ); |
| 430 | |
| 431 | if(base && base->get_uri) |
| 432 | { |
| 433 | Glib::ustring retval(Glib::convert_const_gchar_ptr_to_ustring((*base->get_uri)(const_cast<GstURIHandler*>(gobj())))); |
| 434 | return retval; |
| 435 | } |
| 436 | |
| 437 | using RType = Glib::ustring; |
| 438 | return RType(); |
| 439 | } |
| 440 | bool Gst::URIHandler::set_uri_vfunc(const Glib::ustring& uri, GError** error) |
| 441 | { |
| 442 | const auto base = static_cast<BaseClassType*>( |
| 443 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 444 | g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. |
| 445 | ) ); |
| 446 | |
| 447 | if(base && base->set_uri) |
| 448 | { |
| 449 | bool retval((*base->set_uri)(gobj(),uri.c_str(),error)); |
| 450 | return retval; |
| 451 | } |
| 452 | |
| 453 | using RType = bool; |
| 454 | return RType(); |
| 455 | } |
| 456 | |
| 457 | |
| 458 | } // namespace Gst |
| 459 | |
| 460 |