QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
object.cpp
1 /*
2  Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include "object.h"
18 #include "../QGlib/string_p.h"
19 #include <gst/gst.h>
20 
21 namespace QGst {
22 
23 QString Object::name() const
24 {
25  return QGlib::Private::stringFromGCharPtr(gst_object_get_name(object<GstObject>()));
26 }
27 
28 bool Object::setName(const char *name)
29 {
30  return gst_object_set_name(object<GstObject>(), name);
31 }
32 
33 ObjectPtr Object::parent() const
34 {
35  return ObjectPtr::wrap(gst_object_get_parent(object<GstObject>()), false);
36 }
37 
38 bool Object::setParent(const ObjectPtr & parent)
39 {
40  return gst_object_set_parent(object<GstObject>(), parent);
41 }
42 
43 void Object::unparent()
44 {
45  gst_object_unparent(object<GstObject>());
46 }
47 
48 bool Object::isAncestorOf(const ObjectPtr & obj) const
49 {
50  return gst_object_has_ancestor(obj, object<GstObject>());
51 }
52 
53 QString Object::pathString() const
54 {
55  return QGlib::Private::stringFromGCharPtr(gst_object_get_path_string(object<GstObject>()));
56 }
57 
58 void Object::ref(bool increaseRef)
59 {
60  if (increaseRef) {
61  gst_object_ref(m_object);
62  }
63 }
64 
65 void Object::unref()
66 {
67  gst_object_unref(m_object);
68 }
69 
70 }
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Definition: refpointer.h:326