QtGStreamer 1.2.0
Loading...
Searching...
No Matches
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
21namespace QGst {
22
23//static
24ElementFactoryPtr ElementFactory::find(const char *factoryName)
25{
26 return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
27}
28
29//static
30ElementPtr 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
39QGlib::Type ElementFactory::elementType() const
40{
41 return gst_element_factory_get_element_type(object<GstElementFactory>());
42}
43
44QString ElementFactory::metadata(const char *key) const
45{
46 return QString::fromUtf8(gst_element_factory_get_metadata(object<GstElementFactory>(), key));
47}
48
49uint ElementFactory::padTemplatesCount() const
50{
51 return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
52}
53
54int ElementFactory::uriType() const
55{
56 return gst_element_factory_get_uri_type(object<GstElementFactory>());
57}
58
59bool ElementFactory::hasInterface(const char *interfaceName) const
60{
61 return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
62}
63
64bool ElementFactory::canSinkAllCaps(const CapsPtr & caps) const
65{
66 return gst_element_factory_can_sink_all_caps(object<GstElementFactory>(), caps);
67}
68
69bool ElementFactory::canSrcAllCaps(const CapsPtr & caps) const
70{
71 return gst_element_factory_can_src_all_caps(object<GstElementFactory>(), caps);
72}
73
74bool ElementFactory::canSinkAnyCaps(const CapsPtr & caps) const
75{
76 return gst_element_factory_can_sink_any_caps(object<GstElementFactory>(), caps);
77}
78
79bool ElementFactory::canSrcAnyCaps(const CapsPtr & caps) const
80{
81 return gst_element_factory_can_src_any_caps(object<GstElementFactory>(), caps);
82}
83
84ElementPtr 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:328
Wrapper class for GType.
Definition type.h:64
Wrappers for GStreamer classes.