| 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 "common.h"
 | 
|---|
| 23 | #include "medianode.h"
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #include <phonon/audiooutputinterface.h>
 | 
|---|
| 26 | #include <phonon/phononnamespace.h>
 | 
|---|
| 27 | 
 | 
|---|
| 28 | #include <QtCore/QFile>
 | 
|---|
| 29 | 
 | 
|---|
| 30 | #include <gst/gst.h>
 | 
|---|
| 31 | 
 | 
|---|
| 32 | QT_BEGIN_NAMESPACE
 | 
|---|
| 33 | 
 | 
|---|
| 34 | namespace Phonon
 | 
|---|
| 35 | {
 | 
|---|
| 36 | namespace Gstreamer
 | 
|---|
| 37 | {
 | 
|---|
| 38 | class AudioOutput : public QObject, public AudioOutputInterface, public MediaNode
 | 
|---|
| 39 | {
 | 
|---|
| 40 |     Q_OBJECT
 | 
|---|
| 41 |     Q_INTERFACES(Phonon::AudioOutputInterface Phonon::Gstreamer::MediaNode)
 | 
|---|
| 42 | public:
 | 
|---|
| 43 |     AudioOutput(Backend *backend, QObject *parent);
 | 
|---|
| 44 |     ~AudioOutput();
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     qreal volume() const;
 | 
|---|
| 47 |     int outputDevice() const;
 | 
|---|
| 48 |     void setVolume(qreal newVolume);
 | 
|---|
| 49 |     bool setOutputDevice(int newDevice);
 | 
|---|
| 50 | #if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
 | 
|---|
| 51 |     bool setOutputDevice(const AudioOutputDevice &newDevice);
 | 
|---|
| 52 | #endif
 | 
|---|
| 53 | 
 | 
|---|
| 54 | public:
 | 
|---|
| 55 |     GstElement *audioElement()
 | 
|---|
| 56 |     {
 | 
|---|
| 57 |         Q_ASSERT(m_audioBin);
 | 
|---|
| 58 |         return m_audioBin;
 | 
|---|
| 59 |     }
 | 
|---|
| 60 | 
 | 
|---|
| 61 |     void mediaNodeEvent(const MediaNodeEvent *event);
 | 
|---|
| 62 | 
 | 
|---|
| 63 | Q_SIGNALS:
 | 
|---|
| 64 |     void volumeChanged(qreal newVolume);
 | 
|---|
| 65 |     void audioDeviceFailed();
 | 
|---|
| 66 | 
 | 
|---|
| 67 | private:
 | 
|---|
| 68 | 
 | 
|---|
| 69 |     qreal m_volumeLevel;
 | 
|---|
| 70 |     int m_device;
 | 
|---|
| 71 | 
 | 
|---|
| 72 |     GstElement *m_volumeElement;
 | 
|---|
| 73 |     GstElement *m_audioBin;
 | 
|---|
| 74 |     GstElement *m_audioSink;
 | 
|---|
| 75 |     GstElement *m_conv;
 | 
|---|
| 76 | };
 | 
|---|
| 77 | }
 | 
|---|
| 78 | } //namespace Phonon::Gstreamer
 | 
|---|
| 79 | 
 | 
|---|
| 80 | QT_END_NAMESPACE
 | 
|---|
| 81 | 
 | 
|---|
| 82 | #endif // Phonon_GSTREAMER_AUDIOOUTPUT_H
 | 
|---|