File indexing completed on 2025-02-09 05:31:53
0001 /* 0002 Copyright (C) 2012 Trever Fischer <tdfischer@fedoraproject.org> 0003 Copyright (C) 2012 Harald Sitter <sitter@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Lesser General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) version 3, or any 0009 later version accepted by the membership of KDE e.V. (or its 0010 successor approved by the membership of KDE e.V.), Nokia Corporation 0011 (or its successors, if any) and the KDE Free Qt Foundation, which shall 0012 act as a proxy defined in Section 6 of version 3 of the license. 0013 0014 This library is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 Lesser General Public License for more details. 0018 0019 You should have received a copy of the GNU Lesser General Public 0020 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef PHONON_STATESVALIDATOR_P_H 0024 #define PHONON_STATESVALIDATOR_P_H 0025 0026 #include <QObject> 0027 0028 #include "phononnamespace.h" 0029 0030 namespace Phonon 0031 { 0032 0033 class MediaObject; 0034 0035 class StatesValidator : public QObject 0036 { 0037 Q_OBJECT 0038 public: 0039 explicit StatesValidator(MediaObject *parent = nullptr); 0040 ~StatesValidator() override; 0041 0042 inline void sourceQueued() { m_sourceQueued = true; } 0043 0044 private slots: 0045 void validateStateChange(Phonon::State, Phonon::State); 0046 void validateTick(qint64 tick); 0047 void validateAboutToFinish(); 0048 void validateFinished(); 0049 void validateBufferStatus(); 0050 void validateSourceChange(); 0051 0052 private: 0053 bool validateStateTransition(Phonon::State newstate, Phonon::State oldstate); 0054 0055 MediaObject *m_mediaObject; 0056 0057 Phonon::State m_prevState; /** < Track prev state to do a better job at Buffering validation */ 0058 0059 bool m_sourceQueued; /** < Track whether a source was queued in the backend */ 0060 qint64 m_pos; /** < Track position for abouttofinish validation */ 0061 0062 bool m_aboutToFinishEmitted; 0063 bool m_aboutToFinishBeforeSeek; /** < True when a seek was conducted before a source change */ 0064 qint64 m_aboutToFinishPos; /** < Position when abouttofinish was emitted */ 0065 }; 0066 0067 } // namespace Phonon 0068 0069 #endif // PHONON_STATESVALIDATOR_P_H