1/* This file is part of the KDE project.
2
3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
5
6 This library is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 2.1 or 3 of the License.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef Phonon_GSTREAMER_AUDIOOUTPUT_H
20#define Phonon_GSTREAMER_AUDIOOUTPUT_H
21
22#include "medianode.h"
23
24#include <phonon/audiooutputinterface.h>
25
26namespace Phonon
27{
28namespace Gstreamer
29{
30class AudioOutput : public QObject, public AudioOutputInterface, public MediaNode
31{
32 Q_OBJECT
33 Q_INTERFACES(Phonon::AudioOutputInterface Phonon::Gstreamer::MediaNode)
34public:
35 AudioOutput(Backend *backend, QObject *parent);
36 ~AudioOutput();
37
38 qreal volume() const;
39 int outputDevice() const;
40 void setVolume(qreal newVolume);
41 bool setOutputDevice(int newDevice);
42
43#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
44 bool setOutputDevice(const AudioOutputDevice &newDevice);
45#endif
46
47#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 6, 50))
48 void setStreamUuid(QString uuid);
49#endif
50
51public:
52 GstElement *audioElement()
53 {
54 Q_ASSERT(m_audioBin);
55 return m_audioBin;
56 }
57
58Q_SIGNALS:
59 void volumeChanged(qreal newVolume);
60 void audioDeviceFailed();
61
62private:
63 bool setOutputDevice(const QByteArray &, const QString &, const GstState);
64
65private:
66 qreal m_volumeLevel;
67 int m_device;
68
69 GstElement *m_volumeElement;
70 GstElement *m_audioBin;
71 GstElement *m_audioSink;
72 GstElement *m_conv;
73
74 QString m_streamUuid;
75};
76}
77} //namespace Phonon::Gstreamer
78
79#endif // Phonon_GSTREAMER_AUDIOOUTPUT_H
80