| 1 | // Copyright (C) 2016 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 3 | |
| 4 | #ifndef QMEDIAPLAYER_P_H | 
| 5 | #define QMEDIAPLAYER_P_H | 
| 6 | |
| 7 | // | 
| 8 | // W A R N I N G | 
| 9 | // ------------- | 
| 10 | // | 
| 11 | // This file is not part of the Qt API. It exists purely as an | 
| 12 | // implementation detail. This header file may change from version to | 
| 13 | // version without notice, or even be removed. | 
| 14 | // | 
| 15 | // We mean it. | 
| 16 | // | 
| 17 | |
| 18 | #include "qmediaplayer.h" | 
| 19 | #include "qmediametadata.h" | 
| 20 | #include "qvideosink.h" | 
| 21 | #include "qaudiooutput.h" | 
| 22 | #include "qaudiobufferoutput.h" | 
| 23 | #include <private/qplatformmediaplayer_p.h> | 
| 24 | #include <private/qerrorinfo_p.h> | 
| 25 | |
| 26 | #include "private/qobject_p.h" | 
| 27 | #include <QtCore/qobject.h> | 
| 28 | #include <QtCore/qpointer.h> | 
| 29 | #include <QtCore/qurl.h> | 
| 30 | #include <QtCore/qfile.h> | 
| 31 | #include <QtCore/qtimer.h> | 
| 32 | |
| 33 | #include <memory> | 
| 34 | |
| 35 | QT_BEGIN_NAMESPACE | 
| 36 | |
| 37 | class QPlatformMediaPlayer; | 
| 38 | |
| 39 | class QMediaPlayerPrivate : public QObjectPrivate | 
| 40 | { | 
| 41 | Q_DECLARE_PUBLIC(QMediaPlayer) | 
| 42 | |
| 43 | public: | 
| 44 | static QMediaPlayerPrivate *get(QMediaPlayer *session) | 
| 45 | { | 
| 46 | return reinterpret_cast<QMediaPlayerPrivate *>(QObjectPrivate::get(o: session)); | 
| 47 | } | 
| 48 | |
| 49 | QMediaPlayerPrivate() = default; | 
| 50 | QPlatformMediaPlayer *control = nullptr; | 
| 51 | |
| 52 | QPointer<QAudioBufferOutput> audioBufferOutput; | 
| 53 | QPointer<QAudioOutput> audioOutput; | 
| 54 | QPointer<QVideoSink> videoSink; | 
| 55 | QPointer<QObject> videoOutput; | 
| 56 | QUrl qrcMedia; | 
| 57 | std::unique_ptr<QFile> qrcFile; | 
| 58 | QUrl source; | 
| 59 | QIODevice *stream = nullptr; | 
| 60 | |
| 61 | QMediaPlayer::PlaybackState state = QMediaPlayer::StoppedState; | 
| 62 | QErrorInfo<QMediaPlayer::Error> error; | 
| 63 | |
| 64 | void setMedia(const QUrl &media, QIODevice *stream = nullptr); | 
| 65 | |
| 66 | QList<QMediaMetaData> trackMetaData(QPlatformMediaPlayer::TrackType s) const; | 
| 67 | |
| 68 | void setState(QMediaPlayer::PlaybackState state); | 
| 69 | void setStatus(QMediaPlayer::MediaStatus status); | 
| 70 | void setError(QMediaPlayer::Error error, const QString &errorString); | 
| 71 | |
| 72 | void setVideoSink(QVideoSink *sink) | 
| 73 | { | 
| 74 | Q_Q(QMediaPlayer); | 
| 75 | if (sink == videoSink) | 
| 76 | return; | 
| 77 | if (videoSink) | 
| 78 | videoSink->setSource(nullptr); | 
| 79 | videoSink = sink; | 
| 80 | if (sink) | 
| 81 | sink->setSource(q); | 
| 82 | if (control) | 
| 83 | control->setVideoSink(sink); | 
| 84 | emit q->videoOutputChanged(); | 
| 85 | } | 
| 86 | }; | 
| 87 | |
| 88 | QT_END_NAMESPACE | 
| 89 | |
| 90 | #endif | 
| 91 | 
