| 1 | /* This file is part of the KDE project |
| 2 | Copyright (C) 2006 Matthias Kretz <kretz@kde.org> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) version 3, or any |
| 8 | later version accepted by the membership of KDE e.V. (or its |
| 9 | successor approved by the membership of KDE e.V.), Nokia Corporation |
| 10 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
| 11 | act as a proxy defined in Section 6 of version 3 of the license. |
| 12 | |
| 13 | This library is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | Lesser General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU Lesser General Public |
| 19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | #ifndef AUDIOOUTPUT_P_H |
| 24 | #define AUDIOOUTPUT_P_H |
| 25 | |
| 26 | #include "audiooutput.h" |
| 27 | #include "abstractaudiooutput_p.h" |
| 28 | #include "phononconfig_p.h" |
| 29 | #include "platform_p.h" |
| 30 | |
| 31 | namespace Phonon |
| 32 | { |
| 33 | class AudioOutputAdaptor; |
| 34 | |
| 35 | class AudioOutputPrivate : public AbstractAudioOutputPrivate |
| 36 | { |
| 37 | P_DECLARE_PUBLIC(AudioOutput) |
| 38 | PHONON_PRIVATECLASS |
| 39 | public: |
| 40 | inline static AudioOutputPrivate *cast(MediaNodePrivate *x) |
| 41 | { |
| 42 | if (x && x->castId == MediaNodePrivate::AudioOutputType) { |
| 43 | return static_cast<AudioOutputPrivate *>(x); |
| 44 | } |
| 45 | return nullptr; |
| 46 | } |
| 47 | void init(Phonon::Category c); |
| 48 | QString getStreamUuid(); |
| 49 | |
| 50 | |
| 51 | protected: |
| 52 | AudioOutputPrivate(CastId castId = MediaNodePrivate::AudioOutputType) |
| 53 | : AbstractAudioOutputPrivate(castId), |
| 54 | name(Platform::applicationName()), |
| 55 | volume(Platform::loadVolume(outputName: name)), |
| 56 | deviceBeforeFallback(-1), |
| 57 | outputDeviceOverridden(false), |
| 58 | forceMove(false), |
| 59 | muted(false) |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | ~AudioOutputPrivate() override; |
| 64 | |
| 65 | enum DeviceChangeType { |
| 66 | FallbackChange, |
| 67 | HigherPreferenceChange, |
| 68 | SoundSystemChange |
| 69 | }; |
| 70 | void handleAutomaticDeviceChange(const AudioOutputDevice &newDev, DeviceChangeType type); |
| 71 | |
| 72 | void _k_volumeChanged(qreal); |
| 73 | void _k_mutedChanged(bool); |
| 74 | void _k_revertFallback(); |
| 75 | void _k_audioDeviceFailed(); |
| 76 | void _k_deviceListChanged(); |
| 77 | void _k_deviceChanged(int deviceIndex); |
| 78 | |
| 79 | private: |
| 80 | QString name; |
| 81 | Phonon::AudioOutputDevice device; |
| 82 | qreal volume; |
| 83 | QString streamUuid; |
| 84 | Category category; |
| 85 | int deviceBeforeFallback; |
| 86 | bool outputDeviceOverridden; |
| 87 | bool forceMove; |
| 88 | bool muted; |
| 89 | }; |
| 90 | } //namespace Phonon |
| 91 | |
| 92 | #endif // AUDIOOUTPUT_P_H |
| 93 | // vim: sw=4 ts=4 tw=80 |
| 94 | |