QtGStreamer  1.2.0
 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/gst.h>
20 
21 namespace QGst {
22 
23 //static
24 ElementFactoryPtr ElementFactory::find(const char *factoryName)
25 {
26  return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
27 }
28 
29 //static
30 ElementPtr ElementFactory::make(const char *factoryName, const char *elementName)
31 {
32  GstElement *e = gst_element_factory_make(factoryName, elementName);
33  if (e) {
34  gst_object_ref_sink(e);
35  }
36  return ElementPtr::wrap(e, false);
37 }
38 
39 QGlib::Type ElementFactory::elementType() const
40 {
41  return gst_element_factory_get_element_type(object<GstElementFactory>());
42 }
43 
44 QString ElementFactory::metadata(const char *key) const
45 {
46  return QString::fromUtf8(gst_element_factory_get_metadata(object<GstElementFactory>(), key));
47 }
48 
49 uint ElementFactory::padTemplatesCount() const
50 {
51  return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
52 }
53 
54 int ElementFactory::uriType() const
55 {
56  return gst_element_factory_get_uri_type(object<GstElementFactory>());
57 }
58 
59 bool ElementFactory::hasInterface(const char *interfaceName) const
60 {
61  return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
62 }
63 
64 bool ElementFactory::canSinkAllCaps(const CapsPtr & caps) const
65 {
66  return gst_element_factory_can_sink_all_caps(object<GstElementFactory>(), caps);
67 }
68 
69 bool ElementFactory::canSrcAllCaps(const CapsPtr & caps) const
70 {
71  return gst_element_factory_can_src_all_caps(object<GstElementFactory>(), caps);
72 }
73 
74 bool ElementFactory::canSinkAnyCaps(const CapsPtr & caps) const
75 {
76  return gst_element_factory_can_sink_any_caps(object<GstElementFactory>(), caps);
77 }
78 
79 bool ElementFactory::canSrcAnyCaps(const CapsPtr & caps) const
80 {
81  return gst_element_factory_can_src_any_caps(object<GstElementFactory>(), caps);
82 }
83 
84 ElementPtr ElementFactory::create(const char *elementName) const
85 {
86  GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
87  if (e) {
88  gst_object_ref_sink(e);
89  }
90  return ElementPtr::wrap(e, false);
91 }
92 
93 }
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Definition: refpointer.h:326
Wrapper class for GType.
Definition: type.h:63