Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
26
29class QAndroidMediaPlayerVideoRendererControl;
31
33{
35
36public:
38 ~QAndroidMediaPlayer() override;
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
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
105 QMap<TrackType, QList<QAndroidMetaData>> mTracksMetadata;
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
126
127#endif // QANDROIDMEDIAPLAYERCONTROL_H
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
QAndroidMediaPlayer(QMediaPlayer *parent=0)
QMediaMetaData trackMetaData(TrackType trackType, int streamNumber) override
QMediaTimeRange availablePlaybackRanges() const override
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtMultimedia
The QMediaPlayer class allows the playing of a media files.
MediaStatus
\qmlproperty enumeration QtMultimedia::MediaPlayer::playbackState
The QMediaTimeRange class represents a set of zero or more disjoint time intervals.
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
virtual QMediaPlayer::PlaybackState state() const
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
The QVideoSink class represents a generic sink for video data.
Definition qvideosink.h:22
Combined button and popup list for selecting options.
EGLStreamKHR stream
n void setPosition(void) \n\
GLint GLsizei GLsizei height
GLint GLsizei width
GLuint GLenum * rate
#define Q_OBJECT
#define Q_SLOTS
int qint32
Definition qtypes.h:49
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QT_BEGIN_NAMESPACE typedef uchar * output