| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!cxx . . $ `<file>/gstreamer/gstreamermm/miniobject.cc`/ |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/miniobject.h>cxx . . $ `<file>/gstreamer/gstreamermm/miniobject.h`/ |
| 7 | #include <gstreamermm/private/miniobject_p.h>cxx . . $ `<file>/gstreamer/gstreamermm/private/miniobject_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 <gstreamermm/miniobject.h>cxx . . $ `<file>/gstreamer/gstreamermm/miniobject.h`/ |
| 30 | #include <gstreamermm/private/miniobject_p.h>cxx . . $ `<file>/gstreamer/gstreamermm/private/miniobject_p.h`/ |
| 31 | |
| 32 | namespace Gstcxx . . $ Gst/ |
| 33 | { |
| 34 | |
| 35 | stdcxx . . $ std/::mapcxx . . $ std/map#<GstMiniObject*, MiniObjectcxx . . $ Gst/MiniObject#::SlotFinalizercxx . . $ Gst/MiniObject#SlotFinalizer#*> MiniObjectcxx . . $ Gst/MiniObject#::finalizerscxx . . $ Gst/MiniObject#finalizers.; |
| 36 | |
| 37 | MiniObjectcxx . . $ Gst/MiniObject#::~cxx . . $ Gst/MiniObject#`~MiniObject`(ced63f7c635d850d).MiniObjectcxx . . $ Gst/MiniObject#() |
| 38 | { |
| 39 | GstMiniObject *const gobject_ = reinterpret_cast<GstMiniObject*>(const_cast<MiniObjectcxx . . $ Gst/MiniObject#*>(this)); |
| 40 | // The value of the reference count is checked so that if this mini object is |
| 41 | // being destroyed as a result of weak reference notification no |
| 42 | // unreferencing is done and thus no error is issued on unreferencing a mini |
| 43 | // object with a reference of 0. |
| 44 | if (gobject_ && GST_MINI_OBJECT_REFCOUNT_VALUEcxx . . $ `<external>/14155253843284837254/gstminiobject.h:196:9`!(gobject_) > 0) |
| 45 | { |
| 46 | gst_mini_object_unref(gobject_); |
| 47 | } |
| 48 | |
| 49 | if (finalizerscxx . . $ Gst/MiniObject#finalizers..findcxx . . $ std/map#find(36f8d56706583706).(gobject_) !=cxx . . $ std/`operator!=`(be6a71a859368080). finalizerscxx . . $ Gst/MiniObject#finalizers..endcxx . . $ std/map#end(7e4de33083b6e738).()) |
| 50 | { |
| 51 | delete finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(bbd415b616967878).gobject_]; |
| 52 | finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(bbd415b616967878).gobject_] = nullptr; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::MiniObjectcxx . . $ Gst/MiniObject#> MiniObjectcxx . . $ Gst/MiniObject#::create_writablecxx . . $ Gst/MiniObject#create_writable(92f2c868643191bf).() |
| 57 | { |
| 58 | /* |
| 59 | * This function is generally used in the following pattern: |
| 60 | * RefPtr<Buffer> p = (...); |
| 61 | * p = p->create_writable(); |
| 62 | * |
| 63 | * There are two cases: |
| 64 | * 1. object is not writable, therefore: |
| 65 | * - somebody else may have another reference to the object (but it this might change in the meantime) |
| 66 | * - gst_mini_object_make_writable may return a new copy of object |
| 67 | * - we have to make additional ref, that will be unreffed in gst_mini_object_make_writable |
| 68 | * 2. object is_writable, then: |
| 69 | * - our caller has the only one reference to object (therefore nobody can increase refcount in the meantime) |
| 70 | * - gst_mini_object_make_writable will return the same object and will not do any reffing/unreffing |
| 71 | * - we cannot make any additional refs before calling gst_mini_object_make_writable, since it would enforce unnecessary |
| 72 | * copying of the object |
| 73 | * - we are supposed to create a new RefPtr with is own reference to the object, therefore we need to "take copy" |
| 74 | * - however when caller release the pointer (implicitly, during assignment) the refcount will be 1 again |
| 75 | */ |
| 76 | if(is_writablecxx . . $ Gst/MiniObject#is_writable(50ce9a9e25b4a850).()) |
| 77 | { |
| 78 | return Glibcxx . . $ Glib/::wrapcxx . . $ Glib/wrap(413d5b330b2373be).(gst_mini_object_make_writable(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()), true); // take copy so original object is left to the current owner (and hopefully will be released soon) |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | referencecxx . . $ Gst/MiniObject#reference(83f5f38750778ac8).(); // gst_mini_object_make_writable(buf) will unref the old buffer, but our caller is still holding RefPtr to it |
| 83 | return Glibcxx . . $ Glib/::wrapcxx . . $ Glib/wrap(413d5b330b2373be).(gst_mini_object_make_writable(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).())); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void MiniObjectcxx . . $ Gst/MiniObject#::set_qdatacxx . . $ Gst/MiniObject#set_qdata(62fe55a4e6c8b71b).(GQuark quark, QuarkDatacxx . . $ Gst/QuarkData# *data) |
| 88 | { |
| 89 | gst_mini_object_set_qdata(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), quark, static_cast<gpointer>(data), &MiniObjectcxx . . $ Gst/MiniObject#::destroy_qdatacxx . . $ Gst/MiniObject#destroy_qdata(5d22bdacc48458e8).); |
| 90 | } |
| 91 | |
| 92 | void MiniObjectcxx . . $ Gst/MiniObject#::destroy_qdatacxx . . $ Gst/MiniObject#destroy_qdata(5d22bdacc48458e8).(gpointer qdata) |
| 93 | { |
| 94 | QuarkDatacxx . . $ Gst/QuarkData# *data = static_cast<QuarkDatacxx . . $ Gst/QuarkData#*>(qdata); |
| 95 | delete data; |
| 96 | } |
| 97 | |
| 98 | QuarkDatacxx . . $ Gst/QuarkData#* MiniObjectcxx . . $ Gst/MiniObject#::get_qdatacxx . . $ Gst/MiniObject#get_qdata(857201ba21ba23af).(GQuark quark) const |
| 99 | { |
| 100 | gpointer qdata = gst_mini_object_get_qdata(const_cast<GstMiniObject*>(gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).()), quark); |
| 101 | return static_cast<QuarkDatacxx . . $ Gst/QuarkData#*>(qdata); |
| 102 | } |
| 103 | |
| 104 | void MiniObjectcxx . . $ Gst/MiniObject#::add_finalize_notifiercxx . . $ Gst/MiniObject#add_finalize_notifier(c89ba1236a12ec8f).(const SlotFinalizercxx . . $ Gst/MiniObject#SlotFinalizer#& slot) |
| 105 | { |
| 106 | SlotFinalizercxx . . $ Gst/MiniObject#SlotFinalizer# *finalizer = new SlotFinalizercxx . . $ Gst/MiniObject#SlotFinalizer#(slot); |
| 107 | if (finalizerscxx . . $ Gst/MiniObject#finalizers..findcxx . . $ std/map#find(36f8d56706583706).(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()) !=cxx . . $ std/`operator!=`(be6a71a859368080). finalizerscxx . . $ Gst/MiniObject#finalizers..endcxx . . $ std/map#end(7e4de33083b6e738).()) |
| 108 | { |
| 109 | delete finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()]; |
| 110 | finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()] = finalizer; |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | finalizerscxx . . $ Gst/MiniObject#finalizers..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), finalizer)); |
| 115 | } |
| 116 | gst_mini_object_weak_ref(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), &MiniObjectcxx . . $ Gst/MiniObject#::MiniObject_Finalizer_gstreamermm_callbackcxx . . $ Gst/MiniObject#MiniObject_Finalizer_gstreamermm_callback(327c659357c44b77)., static_cast<gpointer>(finalizer)); |
| 117 | } |
| 118 | |
| 119 | void MiniObjectcxx . . $ Gst/MiniObject#::MiniObject_Finalizer_gstreamermm_callbackcxx . . $ Gst/MiniObject#MiniObject_Finalizer_gstreamermm_callback(327c659357c44b77).(gpointer userdata, GstMiniObject*) |
| 120 | { |
| 121 | (*static_cast<SlotFinalizercxx . . $ Gst/MiniObject#SlotFinalizer#*>(userdata))(cxx . . $ sigc/slot0#`operator()`(8f5363d873dd4781).); |
| 122 | } |
| 123 | |
| 124 | void MiniObjectcxx . . $ Gst/MiniObject#::remove_finalize_notifiercxx . . $ Gst/MiniObject#remove_finalize_notifier(49f6e7a06ebc5aa8).() |
| 125 | { |
| 126 | if (finalizerscxx . . $ Gst/MiniObject#finalizers..findcxx . . $ std/map#find(36f8d56706583706).(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()) !=cxx . . $ std/`operator!=`(be6a71a859368080). finalizerscxx . . $ Gst/MiniObject#finalizers..endcxx . . $ std/map#end(7e4de33083b6e738).()) |
| 127 | { |
| 128 | gst_mini_object_weak_unref(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), &MiniObjectcxx . . $ Gst/MiniObject#::MiniObject_Finalizer_gstreamermm_callbackcxx . . $ Gst/MiniObject#MiniObject_Finalizer_gstreamermm_callback(327c659357c44b77)., finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()]); |
| 129 | delete finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()]; |
| 130 | finalizerscxx . . $ Gst/MiniObject#finalizers.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()] = nullptr; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | } //namespace Gst |
| 135 | |
| 136 | namespacecxx . . $ `$anonymous_namespace_gstreamer/gstreamermm/miniobject.cc`/ |
| 137 | { |
| 138 | } // anonymous namespace |
| 139 | |
| 140 | // static |
| 141 | GType Glibcxx . . $ Glib/::Valuecxx . . $ Glib/Value#<Gst::MiniObjectFlags>::value_typecxx . . $ Glib/Value#value_type(f708dce9a8856c70).() |
| 142 | { |
| 143 | return gst_mini_object_flags_get_type(); |
| 144 | } |
| 145 | |
| 146 | // static |
| 147 | GType Glibcxx . . $ Glib/::Valuecxx . . $ Glib/Value#<Gst::LockFlags>::value_typecxx . . $ Glib/Value#value_type(f708dce9a8856c70).() |
| 148 | { |
| 149 | return gst_lock_flags_get_type(); |
| 150 | } |
| 151 | |
| 152 | |
| 153 | /* Why reinterpret_cast<MiniObject*>(gobject) is needed: |
| 154 | * |
| 155 | * A MiniObject instance is in fact always a GstMiniObject instance. |
| 156 | * Unfortunately, GstMiniObject cannot be a member of MiniObject, |
| 157 | * because it is an opaque struct. Also, the C interface does not provide |
| 158 | * any hooks to install a destroy notification handler, thus we cannot |
| 159 | * wrap it dynamically either. |
| 160 | * |
| 161 | * The cast works because MiniObject does not have any member data, and |
| 162 | * it is impossible to derive from it. This is ensured by using final on the |
| 163 | * class and by using = delete on the default constructor. |
| 164 | */ |
| 165 | |
| 166 | namespace Glibcxx . . $ Glib/ |
| 167 | { |
| 168 | |
| 169 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::MiniObjectcxx . . $ Gst/MiniObject#> wrapcxx . . $ Glib/wrap(413d5b330b2373be).(GstMiniObject* object, bool take_copy) |
| 170 | { |
| 171 | if(take_copy && object) |
| 172 | gst_mini_object_ref(object); |
| 173 | |
| 174 | // See the comment at the top of this file, if you want to know why the cast works. |
| 175 | return Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::MiniObjectcxx . . $ Gst/MiniObject#>(reinterpret_cast<Gstcxx . . $ Gst/::MiniObjectcxx . . $ Gst/MiniObject#*>(object)); |
| 176 | } |
| 177 | |
| 178 | } // namespace Glib |
| 179 | |
| 180 | |
| 181 | namespace Gstcxx . . $ Gst/ |
| 182 | { |
| 183 | |
| 184 | |
| 185 | void MiniObjectcxx . . $ Gst/MiniObject#::referencecxx . . $ Gst/MiniObject#reference(83f5f38750778ac8).() const |
| 186 | { |
| 187 | // See the comment at the top of this file, if you want to know why the cast works. |
| 188 | gst_mini_object_ref(reinterpret_cast<GstMiniObject*>(const_cast<MiniObjectcxx . . $ Gst/MiniObject#*>(this))); |
| 189 | } |
| 190 | |
| 191 | void MiniObjectcxx . . $ Gst/MiniObject#::unreferencecxx . . $ Gst/MiniObject#unreference(83f5f38750778ac8).() const |
| 192 | { |
| 193 | // See the comment at the top of this file, if you want to know why the cast works. |
| 194 | gst_mini_object_unref(reinterpret_cast<GstMiniObject*>(const_cast<MiniObjectcxx . . $ Gst/MiniObject#*>(this))); |
| 195 | } |
| 196 | |
| 197 | GstMiniObject* MiniObjectcxx . . $ Gst/MiniObject#::gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).() |
| 198 | { |
| 199 | // See the comment at the top of this file, if you want to know why the cast works. |
| 200 | return reinterpret_cast<GstMiniObject*>(this); |
| 201 | } |
| 202 | |
| 203 | const GstMiniObject* MiniObjectcxx . . $ Gst/MiniObject#::gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).() const |
| 204 | { |
| 205 | // See the comment at the top of this file, if you want to know why the cast works. |
| 206 | return reinterpret_cast<const GstMiniObject*>(this); |
| 207 | } |
| 208 | |
| 209 | GstMiniObject* MiniObjectcxx . . $ Gst/MiniObject#::gobj_copycxx . . $ Gst/MiniObject#gobj_copy(f3d3780a908b226b).() const |
| 210 | { |
| 211 | // See the comment at the top of this file, if you want to know why the cast works. |
| 212 | const auto gobject = reinterpret_cast<GstMiniObject*>(const_cast<MiniObjectcxx . . $ Gst/MiniObject#*>(this)); |
| 213 | gst_mini_object_ref(gobject); |
| 214 | return gobject; |
| 215 | } |
| 216 | |
| 217 | |
| 218 | guint MiniObjectcxx . . $ Gst/MiniObject#::get_flagscxx . . $ Gst/MiniObject#get_flags(ddd8539a2fcdd4ce).() const |
| 219 | { |
| 220 | return gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).()->flagscxx . . $ _GstMiniObject#flags.; |
| 221 | } |
| 222 | |
| 223 | void MiniObjectcxx . . $ Gst/MiniObject#::set_flagscxx . . $ Gst/MiniObject#set_flags(8e697350d7af5000).(const guint& value) |
| 224 | { |
| 225 | gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).()->flagscxx . . $ _GstMiniObject#flags. = value; |
| 226 | } |
| 227 | |
| 228 | gint MiniObjectcxx . . $ Gst/MiniObject#::get_refcountcxx . . $ Gst/MiniObject#get_refcount(455f465bc33b4cdf).() const |
| 229 | { |
| 230 | return gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).()->refcountcxx . . $ _GstMiniObject#refcount.; |
| 231 | } |
| 232 | |
| 233 | gint MiniObjectcxx . . $ Gst/MiniObject#::get_lockstatecxx . . $ Gst/MiniObject#get_lockstate(455f465bc33b4cdf).() const |
| 234 | { |
| 235 | return gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).()->lockstatecxx . . $ _GstMiniObject#lockstate.; |
| 236 | } |
| 237 | |
| 238 | bool MiniObjectcxx . . $ Gst/MiniObject#::lockcxx . . $ Gst/MiniObject#lock(16b5b5ec7596633).(LockFlagscxx . . $ Gst/LockFlags# flags) |
| 239 | { |
| 240 | return gst_mini_object_lock(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), ((GstLockFlags)(flags))); |
| 241 | } |
| 242 | |
| 243 | void MiniObjectcxx . . $ Gst/MiniObject#::unlockcxx . . $ Gst/MiniObject#unlock(e0aa61a16a5bc008).(LockFlagscxx . . $ Gst/LockFlags# flags) |
| 244 | { |
| 245 | gst_mini_object_unlock(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), ((GstLockFlags)(flags))); |
| 246 | } |
| 247 | |
| 248 | bool MiniObjectcxx . . $ Gst/MiniObject#::is_writablecxx . . $ Gst/MiniObject#is_writable(50ce9a9e25b4a850).() const |
| 249 | { |
| 250 | return gst_mini_object_is_writable(const_cast<GstMiniObject*>(gobjcxx . . $ Gst/MiniObject#gobj(2897744ae5effc52).())); |
| 251 | } |
| 252 | |
| 253 | QuarkDatacxx . . $ Gst/QuarkData#* MiniObjectcxx . . $ Gst/MiniObject#::steal_qdatacxx . . $ Gst/MiniObject#steal_qdata(16d0b97e2a1afd59).(GQuark quark) |
| 254 | { |
| 255 | return static_cast<QuarkDatacxx . . $ Gst/QuarkData#*>(gst_mini_object_steal_qdata(gobjcxx . . $ Gst/MiniObject#gobj(38f55b1ae576fab2).(), quark)); |
| 256 | } |
| 257 | |
| 258 | |
| 259 | } // namespace Gst |
| 260 | |
| 261 |