Debian Codegraph @

gstreamer/src/object.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gst/gst.h>
21 #include <glibmm/threads.h>
22 _PINCLUDE(glibmm/private/object_p.h)
23
24 namespace Gst
25 {
26
27 Object::Object(const Glib::ConstructParams& construct_params)
28 :
29 Glib::Object(construct_params)
30 {
31 // Get rid of the floating reference for newly constructed Gst::Objects.
32 gst_object_ref_sink(gobj());
33 }
34
35 Object::Object(GstObject* castitem)
36 :
37 Glib::Object(reinterpret_cast<GObject*>(castitem))
38 {
39 if(G_LIKELY(g_object_is_floating(castitem)))
40 {
41 //The floating reference is convenience for C,
42 //but is useless and difficult for us:
43 gst_object_ref_sink(gobj());
44 }
45 }
46
47 bool Object::is_element() const
48 {
49 return GST_IS_ELEMENT(gobj());
50 }
51
52 bool Object::is_element_factory() const
53 {
54 return GST_IS_ELEMENT_FACTORY(gobj());
55 }
56
57 bool Object::is_pad() const
58 {
59 return GST_IS_PAD(gobj());
60 }
61
62 bool Object::is_pad_template() const
63 {
64 return GST_IS_PAD_TEMPLATE(gobj());
65 }
66
67 bool Object::is_bin() const
68 {
69 return GST_IS_BIN(gobj());
70 }
71
72 int Object::get_refcount() const
73 {
74 return GST_OBJECT_REFCOUNT(gobj());
75 }
76
77 } // namespace Gst