QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
childproxy.h
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 #ifndef QGST_CHILDPROXY_H
18 #define QGST_CHILDPROXY_H
19 
20 #include "object.h"
21 
22 namespace QGst {
23 
27 class QTGSTREAMER_EXPORT ChildProxy : public QGlib::Interface
28 {
29  QGST_WRAPPER(ChildProxy)
30 public:
31  uint childrenCount() const;
32  QGlib::ObjectPtr childByName(const char *name) const;
33  QGlib::ObjectPtr childByIndex(uint index) const;
34 
35  bool findChildProperty(const char *name, QGlib::ObjectPtr *object,
36  QGlib::ParamSpecPtr *paramSpec) const;
37  QGlib::Value childProperty(const char *name) const;
38  template <typename T> void setChildProperty(const char *name, const T & value);
39 };
40 
41 template <typename T>
42 void ChildProxy::setChildProperty(const char *name, const T & value)
43 {
44  QGlib::ParamSpecPtr param;
45  QGlib::ObjectPtr object;
46  if (findChildProperty(name, &object, &param)) {
47  QGlib::Value v;
48  v.init(param->valueType());
49  v.set<T>(value);
50  object->setProperty(param->name(), value);
51  }
52 }
53 
54 }
55 
56 QGST_REGISTER_TYPE(QGst::ChildProxy)
57 QGLIB_REGISTER_INTERFACE(QGst::ChildProxy)
58 
59 #endif // QGST_CHILDPROXY_H
Smart pointer class for working with wrapper classes that support reference counting.
Definition: global.h:56
Wrapper class for GValue.
Definition: value.h:74
Base class for interface wrappers.
Definition: object.h:99
void init(Type type)
Definition: value.cpp:239
void set(const T &data)
Definition: value.h:325
Wrapper class for GstChildProxy.
Definition: childproxy.h:27