QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
pad.cpp
00001 /*
00002     Copyright (C) 2009  George Kiagiadakis <kiagiadakis.george@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU Lesser General Public License as published
00006     by the Free Software Foundation; either version 2.1 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public License
00015     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 #include "pad.h"
00018 #include "caps.h"
00019 #include "element.h"
00020 #include "query.h"
00021 #include "event.h"
00022 #include <QtCore/QDebug>
00023 #include <gst/gstpad.h>
00024 #include <gst/gstutils.h>
00025 
00026 namespace QGst {
00027 
00028 //static
00029 PadPtr Pad::create(PadDirection direction, const char *name)
00030 {
00031     GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction));
00032     if (pad) {
00033         gst_object_ref_sink(pad);
00034     }
00035     return PadPtr::wrap(pad, false);
00036 }
00037 
00038 PadDirection Pad::direction() const
00039 {
00040     return static_cast<PadDirection>(gst_pad_get_direction(object<GstPad>()));
00041 }
00042 
00043 ElementPtr Pad::parentElement() const
00044 {
00045     return ElementPtr::wrap(gst_pad_get_parent_element(object<GstPad>()), false);
00046 }
00047 
00048 PadPtr Pad::peer() const
00049 {
00050     return PadPtr::wrap(gst_pad_get_peer(object<GstPad>()), false);
00051 }
00052 
00053 bool Pad::isLinked() const
00054 {
00055     return gst_pad_is_linked(object<GstPad>());
00056 }
00057 
00058 bool Pad::canLink(const PadPtr & sink) const
00059 {
00060     return gst_pad_can_link(object<GstPad>(), sink);
00061 }
00062 
00063 PadLinkReturn Pad::link(const PadPtr & sink)
00064 {
00065     return static_cast<PadLinkReturn>(gst_pad_link(object<GstPad>(), sink));
00066 }
00067 
00068 bool Pad::unlink(const PadPtr & sink)
00069 {
00070     return gst_pad_unlink(object<GstPad>(), sink);
00071 }
00072 
00073 CapsPtr Pad::caps() const
00074 {
00075     return CapsPtr::wrap(gst_pad_get_caps_reffed(object<GstPad>()), false);
00076 }
00077 
00078 CapsPtr Pad::allowedCaps() const
00079 {
00080     return CapsPtr::wrap(gst_pad_get_allowed_caps(object<GstPad>()), false);
00081 }
00082 
00083 CapsPtr Pad::negotiatedCaps() const
00084 {
00085     return CapsPtr::wrap(gst_pad_get_negotiated_caps(object<GstPad>()), false);
00086 }
00087 
00088 bool Pad::setCaps(const CapsPtr & caps)
00089 {
00090     return gst_pad_set_caps(object<GstPad>(), caps);
00091 }
00092 
00093 bool Pad::isActive() const
00094 {
00095     return gst_pad_is_active(object<GstPad>());
00096 }
00097 
00098 bool Pad::setActive(bool active)
00099 {
00100     return gst_pad_set_active(object<GstPad>(), active);
00101 }
00102 
00103 bool Pad::isBlocked() const
00104 {
00105     return gst_pad_is_blocked(object<GstPad>());
00106 }
00107 
00108 bool Pad::isBlocking() const
00109 {
00110     return gst_pad_is_blocking(object<GstPad>());
00111 }
00112 
00113 bool Pad::setBlocked(bool blocked)
00114 {
00115     return gst_pad_set_blocked(object<GstPad>(), blocked);
00116 }
00117 
00118 bool Pad::query(const QueryPtr & query)
00119 {
00120     return gst_pad_query(object<GstPad>(), query);
00121 }
00122 
00123 bool Pad::sendEvent(const EventPtr &event)
00124 {
00125     return gst_pad_send_event(object<GstPad>(), event);
00126 }
00127 
00128 }