QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
elementfactory.cpp
00001 /*
00002     Copyright (C) 2009-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 "elementfactory.h"
00018 #include "element.h"
00019 #include <gst/gstelement.h>
00020 #include <gst/gstelementfactory.h>
00021 #include <gst/gstutils.h>
00022 
00023 namespace QGst {
00024 
00025 //static
00026 ElementFactoryPtr ElementFactory::find(const char *factoryName)
00027 {
00028     return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
00029 }
00030 
00031 //static
00032 ElementPtr ElementFactory::make(const char *factoryName, const char *elementName)
00033 {
00034     GstElement *e = gst_element_factory_make(factoryName, elementName);
00035     if (e) {
00036         gst_object_ref_sink(e);
00037     }
00038     return ElementPtr::wrap(e, false);
00039 }
00040 
00041 QGlib::Type ElementFactory::elementType() const
00042 {
00043     return gst_element_factory_get_element_type(object<GstElementFactory>());
00044 }
00045 
00046 QString ElementFactory::longName() const
00047 {
00048     return QString::fromUtf8(gst_element_factory_get_longname(object<GstElementFactory>()));
00049 }
00050 
00051 QString ElementFactory::klass() const
00052 {
00053     return QString::fromUtf8(gst_element_factory_get_klass(object<GstElementFactory>()));
00054 }
00055 
00056 QString ElementFactory::description() const
00057 {
00058     return QString::fromUtf8(gst_element_factory_get_description(object<GstElementFactory>()));
00059 }
00060 
00061 QString ElementFactory::author() const
00062 {
00063     return QString::fromUtf8(gst_element_factory_get_author(object<GstElementFactory>()));
00064 }
00065 
00066 QString ElementFactory::documentationUri() const
00067 {
00068     return QString::fromUtf8(gst_element_factory_get_documentation_uri(object<GstElementFactory>()));
00069 }
00070 
00071 QString ElementFactory::iconName() const
00072 {
00073     return QString::fromUtf8(gst_element_factory_get_icon_name(object<GstElementFactory>()));
00074 }
00075 
00076 uint ElementFactory::padTemplatesCount() const
00077 {
00078     return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
00079 }
00080 
00081 int ElementFactory::uriType() const
00082 {
00083     return gst_element_factory_get_uri_type(object<GstElementFactory>());
00084 }
00085 
00086 bool ElementFactory::hasInterface(const char *interfaceName) const
00087 {
00088     return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
00089 }
00090 
00091 bool ElementFactory::canSinkCaps(const CapsPtr & caps) const
00092 {
00093     return gst_element_factory_can_sink_caps(object<GstElementFactory>(), caps);
00094 }
00095 
00096 bool ElementFactory::canSrcCaps(const CapsPtr & caps) const
00097 {
00098     return gst_element_factory_can_src_caps(object<GstElementFactory>(), caps);
00099 }
00100 
00101 ElementPtr ElementFactory::create(const char *elementName) const
00102 {
00103     GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
00104     if (e) {
00105         gst_object_ref_sink(e);
00106     }
00107     return ElementPtr::wrap(e, false);
00108 }
00109 
00110 }