Debian Codegraph @

gstreamer/gstreamermm/object.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/object.h>
7 #include <gstreamermm/private/object_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008-2016 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 <glibmm/threads.h>
31
32
33 namespace Gst
34 {
35
36 Object::Object(const Glib::ConstructParams& construct_params)
37 :
38 Glib::Object(construct_params)
39 {
40 // Get rid of the floating reference for newly constructed Gst::Objects.
41 gst_object_ref_sink(gobj());
42 }
43
44 Object::Object(GstObject* castitem)
45 :
46 Glib::Object(reinterpret_cast<GObject*>(castitem))
47 {
48 if(G_LIKELY(g_object_is_floating(castitem)))
49 {
50 //The floating reference is convenience for C,
51 //but is useless and difficult for us:
52 gst_object_ref_sink(gobj());
53 }
54 }
55
56 bool Object::is_element() const
57 {
58 return GST_IS_ELEMENT(gobj());
59 }
60
61 bool Object::is_element_factory() const
62 {
63 return GST_IS_ELEMENT_FACTORY(gobj());
64 }
65
66 bool Object::is_pad() const
67 {
68 return GST_IS_PAD(gobj());
69 }
70
71 bool Object::is_pad_template() const
72 {
73 return GST_IS_PAD_TEMPLATE(gobj());
74 }
75
76 bool Object::is_bin() const
77 {
78 return GST_IS_BIN(gobj());
79 }
80
81 int Object::get_refcount() const
82 {
83 return GST_OBJECT_REFCOUNT(gobj());
84 }
85
86 } // namespace Gst
87
88 namespace
89 {
90
91
92 static void Object_signal_deep_notify_callback(GstObject* self, GstObject* p0,GParamSpec* p1,void* data)
93 {
94 using namespace Gst;
95 using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Object>&,GParamSpec* >;
96
97 auto obj = dynamic_cast<Object*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
98 // Do not try to call a signal on a disassociated wrapper.
99 if(obj)
100 {
101 try
102 {
103 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
104 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
105 , p1);
106 }
107 catch(...)
108 {
109 Glib::exception_handlers_invoke();
110 }
111 }
112 }
113
114 static const Glib::SignalProxyInfo Object_signal_deep_notify_info =
115 {
116 "deep-notify",
117 (GCallback) &Object_signal_deep_notify_callback,
118 (GCallback) &Object_signal_deep_notify_callback
119 };
120
121
122 } // anonymous namespace
123
124 // static
125 GType Glib::Value<Gst::ObjectFlags>::value_type()
126 {
127 return gst_object_flags_get_type();
128 }
129
130
131 namespace Glib
132 {
133
134 Glib::RefPtr<Gst::Object> wrap(GstObject* object, bool take_copy)
135 {
136 return Glib::RefPtr<Gst::Object>( dynamic_cast<Gst::Object*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
137 //We use dynamic_cast<> in case of multiple inheritance.
138 }
139
140 } /* namespace Glib */
141
142
143 namespace Gst
144 {
145
146
147 /* The *_Class implementation: */
148
149 const Glib::Class& Object_Class::init()
150 {
151 if(!gtype_) // create the GType if necessary
152 {
153 // Glib::Class has to know the class init function to clone custom types.
154 class_init_func_ = &Object_Class::class_init_function;
155
156 // This is actually just optimized away, apparently with no harm.
157 // Make sure that the parent type has been created.
158 //CppClassParent::CppObjectType::get_type();
159
160 // Create the wrapper type, with the same class/instance size as the base type.
161 register_derived_type(gst_object_get_type());
162
163 // Add derived versions of interfaces, if the C type implements any interfaces:
164
165 }
166
167 return *this;
168 }
169
170
171 void Object_Class::class_init_function(void* g_class, void* class_data)
172 {
173 const auto klass = static_cast<BaseClassType*>(g_class);
174 CppClassParent::class_init_function(klass, class_data);
175
176
177 klass->deep_notify = &deep_notify_callback;
178 }
179
180
181 void Object_Class::deep_notify_callback(GstObject* self, GstObject* p0, GParamSpec* p1)
182 {
183 const auto obj_base = static_cast<Glib::ObjectBase*>(
184 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
185
186 // Non-gtkmmproc-generated custom classes implicitly call the default
187 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
188 // generated classes can use this optimisation, which avoids the unnecessary
189 // parameter conversions if there is no possibility of the virtual function
190 // being overridden:
191 if(obj_base && obj_base->is_derived_())
192 {
193 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
194 if(obj) // This can be NULL during destruction.
195 {
196 try // Trap C++ exceptions which would normally be lost because this is a C callback.
197 {
198 // Call the virtual member method, which derived classes might override.
199 obj->on_deep_notify(Glib::wrap(p0, true)
200 , p1);
201 return;
202 }
203 catch(...)
204 {
205 Glib::exception_handlers_invoke();
206 }
207 }
208 }
209
210 const auto base = static_cast<BaseClassType*>(
211 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
212 );
213
214 // Call the original underlying C function:
215 if(base && base->deep_notify)
216 (*base->deep_notify)(self, p0, p1);
217 }
218
219
220 Glib::ObjectBase* Object_Class::wrap_new(GObject* object)
221 {
222 return new Object((GstObject*)object);
223 }
224
225
226 /* The implementation: */
227
228 GstObject* Object::gobj_copy()
229 {
230 reference();
231 return gobj();
232 }
233
234
235 Object::Object(Object&& src) noexcept
236 : Glib::Object(std::move(src))
237 {}
238
239 Object& Object::operator=(Object&& src) noexcept
240 {
241 Glib::Object::operator=(std::move(src));
242 return *this;
243 }
244
245
246 Object::~Object() noexcept
247 {}
248
249
250 Object::CppClassType Object::object_class_; // initialize static member
251
252 GType Object::get_type()
253 {
254 return object_class_.init().get_type();
255 }
256
257
258 GType Object::get_base_type()
259 {
260 return gst_object_get_type();
261 }
262
263
264 guint32 Object::get_flags() const
265 {
266 return gobj()->flags;
267 }
268
269 bool Object::set_name(const Glib::ustring& name)
270 {
271 return gst_object_set_name(gobj(), name.c_str());
272 }
273
274 Glib::ustring Object::get_name() const
275 {
276 return Glib::convert_return_gchar_ptr_to_ustring(gst_object_get_name(const_cast<GstObject*>(gobj())));
277 }
278
279 bool Object::set_parent(const Glib::RefPtr<Gst::Object>& parent)
280 {
281 return gst_object_set_parent(gobj(), Glib::unwrap(parent));
282 }
283
284 Glib::RefPtr<Gst::Object> Object::get_parent()
285 {
286 return Glib::wrap(gst_object_get_parent(gobj()));
287 }
288
289 Glib::RefPtr<const Gst::Object> Object::get_parent() const
290 {
291 return const_cast<Object*>(this)->get_parent();
292 }
293
294 void Object::unparent()
295 {
296 gst_object_unparent(gobj());
297 }
298
299 void Object::set_control_rate(Gst::ClockTime control_rate)
300 {
301 gst_object_set_control_rate(gobj(), ((GstClockTime)(control_rate)));
302 }
303
304 Gst::ClockTime Object::get_control_rate() const
305 {
306 return ((Gst::ClockTime)(gst_object_get_control_rate(const_cast<GstObject*>(gobj()))));
307 }
308
309 Gst::ClockTime Object::suggest_next_sync() const
310 {
311 return ((Gst::ClockTime)(gst_object_suggest_next_sync(const_cast<GstObject*>(gobj()))));
312 }
313
314 bool Object::sync_values(Gst::ClockTime timestamp)
315 {
316 return gst_object_sync_values(gobj(), ((GstClockTime)(timestamp)));
317 }
318
319 void Object::set_control_bindings_disabled(bool disabled)
320 {
321 gst_object_set_control_bindings_disabled(gobj(), static_cast<int>(disabled));
322 }
323
324 bool Object::has_asctive_control_bindings() const
325 {
326 return gst_object_has_active_control_bindings(const_cast<GstObject*>(gobj()));
327 }
328
329 bool Object::check_uniqueness(const Glib::ListHandle<const Gst::Object>& list, const Glib::ustring& name)
330 {
331 return gst_object_check_uniqueness((list).data(), name.c_str());
332 }
333
334 bool Object::has_ancestor(const Glib::RefPtr<const Gst::Object>& ancestor) const
335 {
336 return gst_object_has_ancestor(const_cast<GstObject*>(gobj()), const_cast<GstObject*>(Glib::unwrap(ancestor)));
337 }
338
339 bool Object::has_as_ancestor(const Glib::RefPtr<Gst::Object>& ancestor) const
340 {
341 return gst_object_has_as_ancestor(const_cast<GstObject*>(gobj()), Glib::unwrap(ancestor));
342 }
343
344 bool Object::has_as_parent(const Glib::RefPtr<Gst::Object>& parent) const
345 {
346 return gst_object_has_as_parent(const_cast<GstObject*>(gobj()), Glib::unwrap(parent));
347 }
348
349 Glib::ustring Object::get_path_string()
350 {
351 return Glib::convert_return_gchar_ptr_to_ustring(gst_object_get_path_string(gobj()));
352 }
353
354
355 Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,GParamSpec* > Object::signal_deep_notify()
356 {
357 return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Object>&,GParamSpec* >(this, &Object_signal_deep_notify_info);
358 }
359
360
361 Glib::PropertyProxy< Glib::ustring > Object::property_name()
362 {
363 return Glib::PropertyProxy< Glib::ustring >(this, "name");
364 }
365
366 Glib::PropertyProxy_ReadOnly< Glib::ustring > Object::property_name() const
367 {
368 return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name");
369 }
370
371 Glib::PropertyProxy< Glib::RefPtr<Gst::Object> > Object::property_parent()
372 {
373 return Glib::PropertyProxy< Glib::RefPtr<Gst::Object> >(this, "parent");
374 }
375
376 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Object> > Object::property_parent() const
377 {
378 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Object> >(this, "parent");
379 }
380
381
382 void Gst::Object::on_deep_notify(const Glib::RefPtr<Gst::Object>& prop_object, GParamSpec* prop)
383 {
384 const auto base = static_cast<BaseClassType*>(
385 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
386 );
387
388 if(base && base->deep_notify)
389 (*base->deep_notify)(gobj(),Glib::unwrap(prop_object),prop);
390 }
391
392
393 } // namespace Gst
394
395