0
|
1 |
/* This file is part of the KDE project.
|
|
2 |
|
|
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
|
|
5 |
This library is free software: you can redistribute it and/or modify
|
|
6 |
it under the terms of the GNU Lesser General Public License as published by
|
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License.
|
|
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
|
|
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 library. If not, see <http://www.gnu.org/licenses/>.
|
|
16 |
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef PHONON_MMF_MEDIANODE_H
|
|
20 |
#define PHONON_MMF_MEDIANODE_H
|
|
21 |
|
|
22 |
#include <QObject>
|
|
23 |
#include <Phonon/EffectInterface>
|
|
24 |
#include "audioplayer.h"
|
|
25 |
|
|
26 |
QT_BEGIN_NAMESPACE
|
|
27 |
|
|
28 |
/**
|
|
29 |
* @file mmf_medianode.h mmf_medianode.cpp
|
|
30 |
*
|
|
31 |
* This file starts with mmf_ in order to avoid clash with Phonon's
|
|
32 |
* medianode.h. The GStreamer backend has a file named medianode.h, but it
|
|
33 |
* isn't compiled with ABLD build system, which have problems with separating
|
|
34 |
* user and system include paths.
|
|
35 |
*/
|
|
36 |
|
|
37 |
namespace Phonon
|
|
38 |
{
|
|
39 |
namespace MMF
|
|
40 |
{
|
|
41 |
class MediaObject;
|
|
42 |
|
|
43 |
/**
|
|
44 |
* @short Base class for all nodes in the MMF backend.
|
|
45 |
*
|
|
46 |
* MediaNode is the base class for all nodes in the chain for MMF. Currently
|
|
47 |
* they are:
|
|
48 |
*
|
|
49 |
* - MediaObject: a source of media
|
|
50 |
* - AbstractEffect: supplying audio effects
|
|
51 |
* - AudioOutput: pretty much a dummy interface, but is also MediaNode in order
|
|
52 |
* to simplify connection/disconnection.
|
|
53 |
*
|
|
54 |
* MediaNode provides spectatability into the chain, and also allows the
|
|
55 |
* connection code to be written in a polymorphic manner, instead of putting it
|
|
56 |
* all in the Backend class. Due to that MMF has no concept of chaining, the
|
|
57 |
* order of the nodes in the graph has no meaning.
|
|
58 |
*/
|
|
59 |
class MediaNode : public QObject
|
|
60 |
{
|
|
61 |
Q_OBJECT
|
|
62 |
public:
|
|
63 |
MediaNode(QObject *parent);
|
|
64 |
|
|
65 |
virtual bool connectMediaNode(MediaNode *target);
|
|
66 |
virtual bool disconnectMediaNode(MediaNode *target);
|
|
67 |
void setSource(MediaNode *source);
|
|
68 |
|
|
69 |
MediaNode *source() const;
|
|
70 |
MediaNode *target() const;
|
|
71 |
|
|
72 |
protected:
|
|
73 |
/**
|
|
74 |
* When connectMediaNode() is called and a MediaObject is part of
|
|
75 |
* the its graph, this function will be called for each MediaNode in the
|
|
76 |
* graph for which it hasn't been called yet.
|
|
77 |
*
|
|
78 |
* The caller guarantees that @p mo is always non-null.
|
|
79 |
*/
|
|
80 |
virtual bool activateOnMediaObject(MediaObject *mo) = 0;
|
|
81 |
|
|
82 |
private:
|
|
83 |
/**
|
|
84 |
* Finds a MediaObject anywhere in the graph @p target is apart of, and
|
|
85 |
* calls activateOnMediaObject() for all MediaNodes in the graph for which
|
|
86 |
* it hasn't been applied to already.
|
|
87 |
*/
|
|
88 |
bool applyNodesOnMediaObject(MediaNode *target);
|
|
89 |
|
|
90 |
MediaNode * m_source;
|
|
91 |
MediaNode * m_target;
|
|
92 |
bool m_isApplied;
|
|
93 |
};
|
|
94 |
}
|
|
95 |
}
|
|
96 |
|
|
97 |
QT_END_NAMESPACE
|
|
98 |
|
|
99 |
#endif
|
|
100 |
|