summaryrefslogtreecommitdiff
path: root/src/QGst/elementfactory.cpp
blob: a2b687c0273ab0592ba78c52a2eb7e2ea60a0334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
    Copyright (C) 2009-2010  George Kiagiadakis <kiagiadakis.george@gmail.com>

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "elementfactory.h"
#include "element.h"
#include <gst/gst.h>

namespace QGst {

//static
ElementFactoryPtr ElementFactory::find(const char *factoryName)
{
    return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
}

//static
ElementPtr ElementFactory::make(const char *factoryName, const char *elementName)
{
    GstElement *e = gst_element_factory_make(factoryName, elementName);
    if (e) {
        gst_object_ref_sink(e);
    }
    return ElementPtr::wrap(e, false);
}

QGlib::Type ElementFactory::elementType() const
{
    return gst_element_factory_get_element_type(object<GstElementFactory>());
}

QString ElementFactory::metadata(const char *key) const
{
    return QString::fromUtf8(gst_element_factory_get_metadata(object<GstElementFactory>(), key));
}

uint ElementFactory::padTemplatesCount() const
{
    return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
}

int ElementFactory::uriType() const
{
    return gst_element_factory_get_uri_type(object<GstElementFactory>());
}

bool ElementFactory::hasInterface(const char *interfaceName) const
{
    return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
}

bool ElementFactory::canSinkAllCaps(const CapsPtr & caps) const
{
    return gst_element_factory_can_sink_all_caps(object<GstElementFactory>(), caps);
}

bool ElementFactory::canSrcAllCaps(const CapsPtr & caps) const
{
    return gst_element_factory_can_src_all_caps(object<GstElementFactory>(), caps);
}

bool ElementFactory::canSinkAnyCaps(const CapsPtr & caps) const
{
    return gst_element_factory_can_sink_any_caps(object<GstElementFactory>(), caps);
}

bool ElementFactory::canSrcAnyCaps(const CapsPtr & caps) const
{
    return gst_element_factory_can_src_any_caps(object<GstElementFactory>(), caps);
}

ElementPtr ElementFactory::create(const char *elementName) const
{
    GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
    if (e) {
        gst_object_ref_sink(e);
    }
    return ElementPtr::wrap(e, false);
}

}