Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qandroidmediaplayer_p.h
Go to the documentation of this file.
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 QANDROIDMEDIAPLAYERCONTROL_H
5#define QANDROIDMEDIAPLAYERCONTROL_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 <qglobal.h>
19#include <private/qplatformmediaplayer_p.h>
20#include <qandroidmetadata_p.h>
21#include <qmap.h>
22#include <qsize.h>
23#include <qurl.h>
24
25QT_BEGIN_NAMESPACE
26
27class AndroidMediaPlayer;
29class QAndroidMediaPlayerVideoRendererControl;
30class QAndroidAudioOutput;
31
33{
35
36public:
39
40 qint64 duration() const override;
41 qint64 position() const override;
42 float bufferProgress() const override;
43 bool isAudioAvailable() const override;
44 bool isVideoAvailable() const override;
46 qreal playbackRate() const override;
47 void setPlaybackRate(qreal rate) override;
48 QUrl media() const override;
49 const QIODevice *mediaStream() const override;
50 void setMedia(const QUrl &mediaContent, QIODevice *stream) override;
51
52 QMediaMetaData metaData() const override;
53
54 void setVideoSink(QVideoSink *surface) override;
55
56 void setAudioOutput(QPlatformAudioOutput *output) override;
57 void updateAudioDevice();
58
59 void setPosition(qint64 position) override;
60 void play() override;
61 void pause() override;
62 void stop() override;
63
64 int trackCount(TrackType trackType) override;
65 QMediaMetaData trackMetaData(TrackType trackType, int streamNumber) override;
66 int activeTrack(TrackType trackType) override;
67 void setActiveTrack(TrackType trackType, int streamNumber) override;
68
69private Q_SLOTS:
70 void setVolume(float volume);
71 void setMuted(bool muted);
72 void onVideoOutputReady(bool ready);
73 void onError(qint32 what, qint32 extra);
74 void onInfo(qint32 what, qint32 extra);
75 void onBufferingChanged(qint32 percent);
76 void onVideoSizeChanged(qint32 width, qint32 height);
77 void onStateChanged(qint32 state);
78 void positionChanged(qint64 position);
79 void durationChanged(qint64 duration);
80
81private:
82 AndroidMediaPlayer *mMediaPlayer = nullptr;
83 QAndroidAudioOutput *m_audioOutput = nullptr;
84 QUrl mMediaContent;
85 QIODevice *mMediaStream = nullptr;
86 QAndroidTextureVideoOutput *mVideoOutput = nullptr;
87 QVideoSink *m_videoSink = nullptr;
88 int mBufferPercent = -1;
89 bool mBufferFilled = false;
90 bool mAudioAvailable = false;
91 bool mVideoAvailable = false;
92 QSize mVideoSize;
93 bool mBuffering = false;
94 QMediaTimeRange mAvailablePlaybackRange;
95 int mState;
96 int mPendingState = -1;
97 qint64 mPendingPosition = -1;
98 bool mPendingSetMedia = false;
99 float mPendingVolume = -1;
100 int mPendingMute = -1;
101 bool mReloadingMedia = false;
102 int mActiveStateChangeNotifiers = 0;
103 qreal mCurrentPlaybackRate = 1.;
104 bool mHasPendingPlaybackRate = false; // we need this because the rate can theoretically be negative
106
107 bool mIsVideoTrackEnabled = true;
108 bool mIsAudioTrackEnabled = true;
109
110 void setMediaStatus(QMediaPlayer::MediaStatus status);
111 void setAudioAvailable(bool available);
112 void setVideoAvailable(bool available);
113 void updateAvailablePlaybackRanges();
114 void resetBufferingProgress();
115 void flushPendingStates();
116 void updateBufferStatus();
117 void updateTrackInfo();
118 void setSubtitle(QString subtitle);
119 void disableTrack(TrackType trackType);
120
121 int convertTrackNumber(int androidTrackNumber);
123};
124
125QT_END_NAMESPACE
126
127#endif // QANDROIDMEDIAPLAYERCONTROL_H
void deselectTrack(int trackNumber)
void selectTrack(int trackNumber)
void setDisplay(AndroidSurfaceTexture *surfaceTexture)
int activeTrack(TrackType trackType)
void setVolume(int volume)
bool isAudioAvailable() const override
void setPlaybackRate(qreal rate) override
const QIODevice * mediaStream() const override
qreal playbackRate() const override
qint64 duration() const override
QMediaMetaData metaData() const override
int activeTrack(TrackType trackType) override
void setVideoSink(QVideoSink *surface) override
bool isVideoAvailable() const override
void setAudioOutput(QPlatformAudioOutput *output) override
int trackCount(TrackType trackType) override
qint64 position() const override
float bufferProgress() const override
void setMedia(const QUrl &mediaContent, QIODevice *stream) override
QUrl media() const override
void setActiveTrack(TrackType trackType, int streamNumber) override
void setPosition(qint64 position) override
QMediaMetaData trackMetaData(TrackType trackType, int streamNumber) override
QMediaTimeRange availablePlaybackRanges() const override
AndroidSurfaceTexture * surfaceTexture() override
\inmodule QtCore
Definition qsize.h:26
StateChangeNotifier(QAndroidMediaPlayer *mp)
QPlatformMediaPlayer::TrackType convertTrackType(AndroidMediaPlayer::TrackType type)
#define qCWarning(category,...)
#define Q_STATIC_LOGGING_CATEGORY(name,...)