File indexing completed on 2024-04-28 16:01:48

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #ifndef MEDIAOBJECT_P_H
0024 #define MEDIAOBJECT_P_H
0025 
0026 #include <QString>
0027 #include <QQueue>
0028 
0029 #include "medianode_p.h"
0030 #include "medianodedestructionhandler_p.h"
0031 #include "mediaobject.h"
0032 #include "mediasource.h"
0033 #include "phonondefs_p.h"
0034 
0035 namespace Phonon
0036 {
0037 class FrontendInterfacePrivate;
0038 class StatesValidator;
0039 
0040 class MediaObjectPrivate : public MediaNodePrivate, private MediaNodeDestructionHandler
0041 {
0042     friend class KioFallbackImpl;
0043     friend class AbstractMediaStream;
0044     friend class AbstractMediaStreamPrivate;
0045     P_DECLARE_PUBLIC(MediaObject)
0046     public:
0047         QObject *qObject() override { return q_func(); }
0048 
0049     QList<FrontendInterfacePrivate *> interfaceList;
0050     protected:
0051         bool aboutToDeleteBackendObject() override;
0052         void createBackendObject() override;
0053         void phononObjectDestroyed(MediaNodePrivate *) override;
0054         PHONON_EXPORT void setupBackendObject();
0055 
0056         void _k_resumePlay();
0057         void _k_resumePause();
0058         void _k_metaDataChanged(const QMultiMap<QString, QString> &);
0059         void _k_aboutToFinish();
0060         void _k_currentSourceChanged(const MediaSource &);
0061         PHONON_EXPORT void _k_stateChanged(Phonon::State, Phonon::State);
0062 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0063         void streamError(Phonon::ErrorType, const QString &);
0064 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0065 
0066         MediaObjectPrivate()
0067             : currentTime(0),
0068             tickInterval(0),
0069             metaData(),
0070             errorString(),
0071             prefinishMark(0),
0072             transitionTime(0), // gapless playback
0073 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0074             abstractStream(nullptr),
0075 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0076             state(Phonon::LoadingState),
0077             playingQueuedSource(false)
0078 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0079             , errorType(Phonon::NormalError),
0080             errorOverride(false),
0081             ignoreLoadingToBufferingStateChange(false),
0082             ignoreErrorToLoadingStateChange(false),
0083             validateStates(!(qgetenv("PHONON_ASSERT_STATES").isEmpty())),
0084             validator(nullptr)
0085 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0086         {
0087         }
0088 
0089         ~MediaObjectPrivate() override
0090         {
0091         }
0092 
0093         qint64 currentTime;
0094         qint32 tickInterval;
0095         QMultiMap<QString, QString> metaData;
0096         QString errorString;
0097         qint32 prefinishMark;
0098         qint32 transitionTime;
0099 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0100         AbstractMediaStream *abstractStream;
0101 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0102         State state
0103 #ifdef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0104             ;
0105 #else
0106             : 8;
0107         bool playingQueuedSource;
0108         ErrorType errorType : 4;
0109         bool errorOverride : 1;
0110         bool ignoreLoadingToBufferingStateChange : 1;
0111         bool ignoreErrorToLoadingStateChange : 1;
0112 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0113         MediaSource mediaSource;
0114         QQueue<MediaSource> sourceQueue;
0115         bool validateStates;
0116         StatesValidator *validator;
0117 };
0118 }
0119 
0120 #endif // MEDIAOBJECT_P_H
0121 // vim: sw=4 ts=4 tw=80