Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / phonon / xine / sinknode.cpp
blob9c15be9e263ce8165b53fe027effd24738bfd4ea
1 /* This file is part of the KDE project
2 Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "sinknode.h"
22 #include "sourcenode.h"
23 #include "events.h"
25 namespace Phonon
27 namespace Xine
30 SinkNodeXT::~SinkNodeXT()
32 deleted = true;
35 AudioPort SinkNodeXT::audioPort() const
37 return AudioPort();
40 xine_video_port_t *SinkNodeXT::videoPort() const
42 return 0;
45 SinkNode::SinkNode(SinkNodeXT *_xt)
46 : m_threadSafeObject(_xt), m_source(0)
48 Q_ASSERT(_xt);
51 SinkNode::~SinkNode()
53 if (m_source) {
54 m_source->removeSink(this);
58 void SinkNode::setSource(SourceNode *s)
60 Q_ASSERT(m_source == 0);
61 m_source = s;
64 void SinkNode::unsetSource(SourceNode *s)
66 Q_ASSERT(m_source == s);
67 m_source = 0;
70 SourceNode *SinkNode::source() const
72 return m_source;
75 SourceNode *SinkNode::sourceInterface()
77 return 0;
80 void SinkNode::upstreamEvent(Event *e)
82 Q_ASSERT(e);
83 if (m_source) {
84 m_source->upstreamEvent(e);
85 } else {
86 if (!--e->ref) {
87 delete e;
92 void SinkNode::downstreamEvent(Event *e)
94 Q_ASSERT(e);
95 SourceNode *iface = sourceInterface();
96 if (iface) {
97 iface->downstreamEvent(e);
98 } else {
99 if (!--e->ref) {
100 delete e;
105 } // namespace Xine
106 } // namespace Phonon