QtGStreamer 1.2.0
Loading...
Searching...
No Matches
pad.cpp
1/*
2 Copyright (C) 2009 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 "pad.h"
18#include "caps.h"
19#include "element.h"
20#include "query.h"
21#include "event.h"
22#include <QtCore/QDebug>
23#include <gst/gst.h>
24
25namespace QGst {
26
27//static
28PadPtr Pad::create(PadDirection direction, const char *name)
29{
30 GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction));
31 if (pad) {
32 gst_object_ref_sink(pad);
33 }
34 return PadPtr::wrap(pad, false);
35}
36
37PadDirection Pad::direction() const
38{
39 return static_cast<PadDirection>(gst_pad_get_direction(object<GstPad>()));
40}
41
43{
44 return ElementPtr::wrap(gst_pad_get_parent_element(object<GstPad>()), false);
45}
46
47PadPtr Pad::peer() const
48{
49 return PadPtr::wrap(gst_pad_get_peer(object<GstPad>()), false);
50}
51
52bool Pad::isLinked() const
53{
54 return gst_pad_is_linked(object<GstPad>());
55}
56
57bool Pad::canLink(const PadPtr & sink) const
58{
59 return gst_pad_can_link(object<GstPad>(), sink);
60}
61
62PadLinkReturn Pad::link(const PadPtr & sink)
63{
64 return static_cast<PadLinkReturn>(gst_pad_link(object<GstPad>(), sink));
65}
66
67bool Pad::unlink(const PadPtr & sink)
68{
69 return gst_pad_unlink(object<GstPad>(), sink);
70}
71
72CapsPtr Pad::currentCaps() const
73{
74 return CapsPtr::wrap(gst_pad_get_current_caps(object<GstPad>()), false);
75}
76
77CapsPtr Pad::allowedCaps() const
78{
79 return CapsPtr::wrap(gst_pad_get_allowed_caps(object<GstPad>()), false);
80}
81
82CapsPtr Pad::padTemplateCaps() const
83{
84 return CapsPtr::wrap(gst_pad_get_pad_template_caps(object<GstPad>()), false);
85}
86
87bool Pad::isActive() const
88{
89 return gst_pad_is_active(object<GstPad>());
90}
91
92bool Pad::setActive(bool active)
93{
94 return gst_pad_set_active(object<GstPad>(), active);
95}
96
97bool Pad::isBlocked() const
98{
99 return gst_pad_is_blocked(object<GstPad>());
100}
101
102bool Pad::isBlocking() const
103{
104 return gst_pad_is_blocking(object<GstPad>());
105}
106
107bool Pad::query(const QueryPtr & query)
108{
109 return gst_pad_query(object<GstPad>(), query);
110}
111
112bool Pad::sendEvent(const EventPtr &event)
113{
114 return gst_pad_send_event(object<GstPad>(), event);
115}
116
117}
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Definition refpointer.h:328
ElementPtr parentElement() const
Definition pad.cpp:42
Wrappers for GStreamer classes.