QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
elementfactory.cpp
1 /*
2  Copyright (C) 2009-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 "elementfactory.h"
18 #include "element.h"
19 #include <gst/gstelement.h>
20 #include <gst/gstelementfactory.h>
21 #include <gst/gstutils.h>
22 
23 namespace QGst {
24 
25 //static
26 ElementFactoryPtr ElementFactory::find(const char *factoryName)
27 {
28  return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
29 }
30 
31 //static
32 ElementPtr ElementFactory::make(const char *factoryName, const char *elementName)
33 {
34  GstElement *e = gst_element_factory_make(factoryName, elementName);
35  if (e) {
36  gst_object_ref_sink(e);
37  }
38  return ElementPtr::wrap(e, false);
39 }
40 
41 QGlib::Type ElementFactory::elementType() const
42 {
43  return gst_element_factory_get_element_type(object<GstElementFactory>());
44 }
45 
46 QString ElementFactory::longName() const
47 {
48  return QString::fromUtf8(gst_element_factory_get_longname(object<GstElementFactory>()));
49 }
50 
51 QString ElementFactory::klass() const
52 {
53  return QString::fromUtf8(gst_element_factory_get_klass(object<GstElementFactory>()));
54 }
55 
56 QString ElementFactory::description() const
57 {
58  return QString::fromUtf8(gst_element_factory_get_description(object<GstElementFactory>()));
59 }
60 
61 QString ElementFactory::author() const
62 {
63  return QString::fromUtf8(gst_element_factory_get_author(object<GstElementFactory>()));
64 }
65 
66 QString ElementFactory::documentationUri() const
67 {
68  return QString::fromUtf8(gst_element_factory_get_documentation_uri(object<GstElementFactory>()));
69 }
70 
71 QString ElementFactory::iconName() const
72 {
73  return QString::fromUtf8(gst_element_factory_get_icon_name(object<GstElementFactory>()));
74 }
75 
76 uint ElementFactory::padTemplatesCount() const
77 {
78  return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
79 }
80 
81 int ElementFactory::uriType() const
82 {
83  return gst_element_factory_get_uri_type(object<GstElementFactory>());
84 }
85 
86 bool ElementFactory::hasInterface(const char *interfaceName) const
87 {
88  return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
89 }
90 
91 bool ElementFactory::canSinkCaps(const CapsPtr & caps) const
92 {
93  return gst_element_factory_can_sink_caps(object<GstElementFactory>(), caps);
94 }
95 
96 bool ElementFactory::canSrcCaps(const CapsPtr & caps) const
97 {
98  return gst_element_factory_can_src_caps(object<GstElementFactory>(), caps);
99 }
100 
101 ElementPtr ElementFactory::create(const char *elementName) const
102 {
103  GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
104  if (e) {
105  gst_object_ref_sink(e);
106  }
107  return ElementPtr::wrap(e, false);
108 }
109 
110 }