QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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/gstpad.h>
24 #include <gst/gstutils.h>
25 
26 namespace QGst {
27 
28 //static
29 PadPtr Pad::create(PadDirection direction, const char *name)
30 {
31  GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction));
32  if (pad) {
33  gst_object_ref_sink(pad);
34  }
35  return PadPtr::wrap(pad, false);
36 }
37 
38 PadDirection Pad::direction() const
39 {
40  return static_cast<PadDirection>(gst_pad_get_direction(object<GstPad>()));
41 }
42 
44 {
45  return ElementPtr::wrap(gst_pad_get_parent_element(object<GstPad>()), false);
46 }
47 
48 PadPtr Pad::peer() const
49 {
50  return PadPtr::wrap(gst_pad_get_peer(object<GstPad>()), false);
51 }
52 
53 bool Pad::isLinked() const
54 {
55  return gst_pad_is_linked(object<GstPad>());
56 }
57 
58 bool Pad::canLink(const PadPtr & sink) const
59 {
60  return gst_pad_can_link(object<GstPad>(), sink);
61 }
62 
63 PadLinkReturn Pad::link(const PadPtr & sink)
64 {
65  return static_cast<PadLinkReturn>(gst_pad_link(object<GstPad>(), sink));
66 }
67 
68 bool Pad::unlink(const PadPtr & sink)
69 {
70  return gst_pad_unlink(object<GstPad>(), sink);
71 }
72 
74 {
75  return CapsPtr::wrap(gst_pad_get_caps_reffed(object<GstPad>()), false);
76 }
77 
78 CapsPtr Pad::allowedCaps() const
79 {
80  return CapsPtr::wrap(gst_pad_get_allowed_caps(object<GstPad>()), false);
81 }
82 
83 CapsPtr Pad::negotiatedCaps() const
84 {
85  return CapsPtr::wrap(gst_pad_get_negotiated_caps(object<GstPad>()), false);
86 }
87 
88 bool Pad::setCaps(const CapsPtr & caps)
89 {
90  return gst_pad_set_caps(object<GstPad>(), caps);
91 }
92 
93 bool Pad::isActive() const
94 {
95  return gst_pad_is_active(object<GstPad>());
96 }
97 
98 bool Pad::setActive(bool active)
99 {
100  return gst_pad_set_active(object<GstPad>(), active);
101 }
102 
103 bool Pad::isBlocked() const
104 {
105  return gst_pad_is_blocked(object<GstPad>());
106 }
107 
108 bool Pad::isBlocking() const
109 {
110  return gst_pad_is_blocking(object<GstPad>());
111 }
112 
113 bool Pad::setBlocked(bool blocked)
114 {
115  return gst_pad_set_blocked(object<GstPad>(), blocked);
116 }
117 
118 bool Pad::query(const QueryPtr & query)
119 {
120  return gst_pad_query(object<GstPad>(), query);
121 }
122 
123 bool Pad::sendEvent(const EventPtr &event)
124 {
125  return gst_pad_send_event(object<GstPad>(), event);
126 }
127 
128 }