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_AUDIOOUTPUT_H
|
|
20 |
#define PHONON_MMF_AUDIOOUTPUT_H
|
|
21 |
|
|
22 |
#include <QHash>
|
|
23 |
|
|
24 |
#include "mmf_medianode.h"
|
|
25 |
#include <phonon/audiooutputinterface.h>
|
|
26 |
|
|
27 |
QT_BEGIN_NAMESPACE
|
|
28 |
|
|
29 |
namespace Phonon
|
|
30 |
{
|
|
31 |
namespace MMF
|
|
32 |
{
|
|
33 |
class Backend;
|
|
34 |
class VolumeObserver;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* @short AudioOutputInterface implementation for MMF.
|
|
38 |
*
|
|
39 |
* Forwards volume commands to the VolumeObserver instance,
|
|
40 |
* which is provided by the backend when MediaNode objects are
|
|
41 |
* connected.
|
|
42 |
*
|
|
43 |
* \section volume Volume
|
|
44 |
*
|
|
45 |
* Phonon's concept on volume is from 0.0 to 1.0, and from 1< it does
|
|
46 |
* voltage multiplication. CDrmPlayerUtility goes from 1 to
|
|
47 |
* CDrmPlayerUtility::MaxVolume(). We apply some basic math to convert
|
|
48 |
* between the two.
|
|
49 |
*
|
|
50 |
* @author Frans Englich<frans.englich@nokia.com>
|
|
51 |
*/
|
|
52 |
class AudioOutput : public MediaNode
|
|
53 |
, public AudioOutputInterface
|
|
54 |
{
|
|
55 |
Q_OBJECT
|
|
56 |
Q_INTERFACES(Phonon::AudioOutputInterface)
|
|
57 |
|
|
58 |
public:
|
|
59 |
AudioOutput(Backend *backend, QObject *parent);
|
|
60 |
virtual qreal volume() const;
|
|
61 |
virtual void setVolume(qreal volume);
|
|
62 |
|
|
63 |
virtual int outputDevice() const;
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Has no effect.
|
|
67 |
*/
|
|
68 |
virtual bool setOutputDevice(int);
|
|
69 |
|
|
70 |
static QHash<QByteArray, QVariant> audioOutputDescription(int index);
|
|
71 |
|
|
72 |
enum Constants
|
|
73 |
{
|
|
74 |
AudioOutputDeviceID = 0
|
|
75 |
};
|
|
76 |
|
|
77 |
protected:
|
|
78 |
virtual bool activateOnMediaObject(MediaObject *mo);
|
|
79 |
|
|
80 |
Q_SIGNALS:
|
|
81 |
void volumeChanged(qreal volume);
|
|
82 |
void audioDeviceFailed();
|
|
83 |
|
|
84 |
private:
|
|
85 |
|
|
86 |
void setVolumeObserver(VolumeObserver* observer);
|
|
87 |
|
|
88 |
qreal m_volume;
|
|
89 |
|
|
90 |
// Not owned
|
|
91 |
VolumeObserver* m_observer;
|
|
92 |
};
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
QT_END_NAMESPACE
|
|
97 |
|
|
98 |
#endif
|