| 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.h> |
| 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 created by the MMF |
| 47 |
* backend. |
| 48 |
* |
| 49 |
* These nodes may be one of the following types: |
| 50 |
* |
| 51 |
* - MediaObject |
| 52 |
* This represents the source of media data. It encapsulates the |
| 53 |
* appropriate MMF client API for playing audio or video. |
| 54 |
* - AudioOutput |
| 55 |
* This represents the audio output device. Since the MMF client API |
| 56 |
* does not expose the output device directly, this backend node |
| 57 |
* simply forwards volume control commands to the MediaObject. |
| 58 |
* - VideoWidget |
| 59 |
* A native widget on which video will be rendered. |
| 60 |
* - An audio effect, derived form AbstractAudioEffect |
| 61 |
* |
| 62 |
* Because the MMF API does not support the concept of a media filter graph, |
| 63 |
* this class must ensure the following: |
| 64 |
* |
| 65 |
* - Each media graph contains at most one MediaObject instance. |
| 66 |
* - Every non-MediaObject node holds a reference to the MediaObject. This |
| 67 |
* allows commands to be sent through the graph to the encapsulated MMF client |
| 68 |
* API. |
| 69 |
*/ |
| 70 |
class MediaNode : public QObject |
| 71 |
{ |
| 72 |
Q_OBJECT |
| 73 |
public: |
| 74 |
MediaNode(QObject *parent); |
| 75 |
~MediaNode(); |
| 76 |
|
| 77 |
bool connectOutput(MediaNode *output); |
| 78 |
bool disconnectOutput(MediaNode *output); |
| 79 |
|
| 80 |
virtual void connectMediaObject(MediaObject *mediaObject) = 0; |
| 81 |
virtual void disconnectMediaObject(MediaObject *mediaObject) = 0; |
| 82 |
|
| 83 |
private: |
| 84 |
bool isMediaObject() const; |
| 85 |
|
| 86 |
void updateMediaObject(); |
| 87 |
void setMediaObject(MediaObject *mediaObject); |
| 88 |
|
| 89 |
typedef QList<const MediaNode *> NodeList; |
| 90 |
void visit(QList<MediaNode *>& visited, MediaObject*& mediaObject); |
| 91 |
|
| 92 |
private: |
| 93 |
MediaObject * m_mediaObject; |
| 94 |
|
| 95 |
// All nodes except MediaObject may have an input |
| 96 |
MediaNode * m_input; |
| 97 |
|
| 98 |
// Only MediaObject can have more than one output |
| 99 |
QList<MediaNode *> m_outputs; |
| 100 |
}; |
| 101 |
|
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
QT_END_NAMESPACE |
| 106 |
|
| 107 |
#endif |