~ubuntu-branches/ubuntu/oneiric/phonon/oneiric-201108111512

« back to all changes in this revision

Viewing changes to xine/sourcenode.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-01-24 10:12:11 UTC
  • mfrom: (0.5.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110124101211-w9rew7q0dmwbwhqx
Tags: 4:4.7.0really4.4.4-0ubuntu1
* New upstream release
* Xine and GStreamer backends now split out source, remove build-deps and
  binary packages from debian/control
* Remove 02_no_rpath.patch, now upstream
* Disable kubuntu04_no_va_mangle.patch, no longer applies
* Remove kubuntu_05_gst_codec_installer_window_id.diff, kubuntu_06_forward_events.diff,
  kubuntu_07_include_fix.diff, gstreamer now separate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  This file is part of the KDE project
2
 
    Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
3
 
 
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.
8
 
 
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.
13
 
 
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.
18
 
 
19
 
*/
20
 
 
21
 
#ifndef SOURCENODE_H
22
 
#define SOURCENODE_H
23
 
 
24
 
#include <QtCore/QExplicitlySharedDataPointer>
25
 
#include <QtCore/QSet>
26
 
#include <xine.h>
27
 
#include "backend.h"
28
 
#include "shareddata.h"
29
 
 
30
 
// the gcc 4.0 STL includes assert.h
31
 
#undef assert
32
 
 
33
 
namespace Phonon
34
 
{
35
 
namespace Xine
36
 
{
37
 
class SinkNode;
38
 
class Event;
39
 
class SinkNodeXT;
40
 
 
41
 
class SourceNodeXT : virtual public SharedData
42
 
{
43
 
    public:
44
 
        SourceNodeXT(const char *name = "SourceNode");
45
 
        virtual ~SourceNodeXT();
46
 
        virtual xine_post_out_t *audioOutputPort() const;
47
 
        virtual xine_post_out_t *videoOutputPort() const;
48
 
        void assert() { Q_ASSERT(!deleted); }
49
 
 
50
 
        const char *const className;
51
 
 
52
 
    private:
53
 
        bool deleted;
54
 
 
55
 
        friend class XineThread;
56
 
        friend class AudioDataOutputXT;
57
 
 
58
 
        // hold a ref to the sink that we're connected to to make 100% sure it's always valid
59
 
        QExplicitlySharedDataPointer<SinkNodeXT> m_xtSink;
60
 
};
61
 
 
62
 
class SourceNode
63
 
{
64
 
    friend class WireCall;
65
 
    public:
66
 
        SourceNode(SourceNodeXT *_xt);
67
 
        virtual ~SourceNode();
68
 
        virtual MediaStreamTypes outputMediaStreamTypes() const = 0;
69
 
        void addSink(SinkNode *s);
70
 
        void removeSink(SinkNode *s);
71
 
        QSet<SinkNode *> sinks() const;
72
 
        virtual SinkNode *sinkInterface();
73
 
 
74
 
        virtual void upstreamEvent(Event *);
75
 
        virtual void downstreamEvent(Event *);
76
 
 
77
 
        inline QExplicitlySharedDataPointer<SourceNodeXT> threadSafeObject() const { return m_threadSafeObject; }
78
 
 
79
 
    protected:
80
 
        QExplicitlySharedDataPointer<SourceNodeXT> m_threadSafeObject;
81
 
    private:
82
 
        QSet<SinkNode *> m_sinks;
83
 
};
84
 
} // namespace Xine
85
 
} // namespace Phonon
86
 
 
87
 
Q_DECLARE_INTERFACE(Phonon::Xine::SourceNode, "XineSourceNode.phonon.kde.org")
88
 
 
89
 
inline QDebug operator<<(QDebug &s, const Phonon::Xine::SourceNodeXT *const node)
90
 
{
91
 
    if (node->className) {
92
 
        s.nospace() << node->className << '(' << static_cast<const void *>(node) << ')';
93
 
    } else {
94
 
        s.nospace() << "no classname: " << static_cast<const void *>(node);
95
 
    }
96
 
    return s.space();
97
 
}
98
 
 
99
 
#endif // SOURCENODE_H