QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
childproxy.cpp
00001 /*
00002     Copyright (C) 2010  George Kiagiadakis <kiagiadakis.george@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU Lesser General Public License as published
00006     by the Free Software Foundation; either version 2.1 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public License
00015     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 #include "childproxy.h"
00018 #include <gst/gstobject.h>
00019 #include <gst/gstchildproxy.h>
00020 
00021 namespace QGst {
00022 
00023 uint ChildProxy::childrenCount() const
00024 {
00025     return gst_child_proxy_get_children_count(object<GstChildProxy>());
00026 }
00027 
00028 ObjectPtr ChildProxy::childByName(const char *name) const
00029 {
00030     return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(object<GstChildProxy>(), name), false);
00031 }
00032 
00033 ObjectPtr ChildProxy::childByIndex(uint index) const
00034 {
00035     return ObjectPtr::wrap(gst_child_proxy_get_child_by_index(object<GstChildProxy>(), index), false);
00036 }
00037 
00038 bool ChildProxy::findChildProperty(const char *name, ObjectPtr *obj, QGlib::ParamSpecPtr *paramSpec) const
00039 {
00040     GstObject *op;
00041     GParamSpec *pp;
00042     bool result = gst_child_proxy_lookup(object<GstObject>(), name, &op, &pp);
00043     if (result) {
00044         *obj = ObjectPtr::wrap(op, false);
00045         *paramSpec = QGlib::ParamSpecPtr::wrap(pp, false);
00046     }
00047     return result;
00048 }
00049 
00050 QGlib::Value ChildProxy::childProperty(const char *name) const
00051 {
00052     QGlib::ParamSpecPtr param;
00053     ObjectPtr object;
00054     if (findChildProperty(name, &object, &param)) {
00055         return object->property(param->name().toUtf8());
00056     } else {
00057         return QGlib::Value();
00058     }
00059 }
00060 
00061 }