QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
childproxy.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 "childproxy.h"
18 #include <gst/gst.h>
19 
20 namespace QGst {
21 
22 uint ChildProxy::childrenCount() const
23 {
24  return gst_child_proxy_get_children_count(object<GstChildProxy>());
25 }
26 
27 QGlib::ObjectPtr ChildProxy::childByName(const char *name) const
28 {
29  return QGlib::ObjectPtr::wrap(gst_child_proxy_get_child_by_name(object<GstChildProxy>(), name), false);
30 }
31 
32 QGlib::ObjectPtr ChildProxy::childByIndex(uint index) const
33 {
34  return QGlib::ObjectPtr::wrap(gst_child_proxy_get_child_by_index(object<GstChildProxy>(), index), false);
35 }
36 
37 bool ChildProxy::findChildProperty(const char *name, QGlib::ObjectPtr *obj,
38  QGlib::ParamSpecPtr *paramSpec) const
39 {
40  GObject *op;
41  GParamSpec *pp;
42  bool result = gst_child_proxy_lookup(object<GstChildProxy>(), name, &op, &pp);
43  if (result) {
44  *obj = QGlib::ObjectPtr::wrap(op, false);
45  *paramSpec = QGlib::ParamSpecPtr::wrap(pp, false);
46  }
47  return result;
48 }
49 
50 QGlib::Value ChildProxy::childProperty(const char *name) const
51 {
52  QGlib::ParamSpecPtr param;
53  QGlib::ObjectPtr object;
54  if (findChildProperty(name, &object, &param)) {
55  return object->property(param->name().toUtf8());
56  } else {
57  return QGlib::Value();
58  }
59 }
60 
61 }
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Definition: refpointer.h:326
Smart pointer class for working with wrapper classes that support reference counting.
Definition: global.h:56
Wrapper class for GValue.
Definition: value.h:74