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
qqnxmediaplayer_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QQnxMediaPlayer_H
4#define QQnxMediaPlayer_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qqnxmediametadata_p.h"
18#include "mmrenderertypes.h"
19
20#include <private/qplatformmediaplayer_p.h>
21#include <QtCore/qabstractnativeeventfilter.h>
22#include <QtCore/qpointer.h>
23#include <QtCore/qtimer.h>
24
25#include <mm/renderer.h>
26#include <mm/renderer/types.h>
27
28#include <optional>
29
31
32class QQnxVideoSink;
35
38{
40public:
41 explicit QQnxMediaPlayer(QMediaPlayer *parent = nullptr);
43
44 qint64 duration() const override;
45
46 qint64 position() const override;
47 void setPosition(qint64 position) override;
48
49 void setAudioOutput(QPlatformAudioOutput *) override;
50
51 float bufferProgress() const override;
52
53 bool isAudioAvailable() const override;
54 bool isVideoAvailable() const override;
55
56 bool isSeekable() const override;
57
59
60 qreal playbackRate() const override;
61 void setPlaybackRate(qreal rate) override;
62
63 QUrl media() const override;
64 const QIODevice *mediaStream() const override;
65 void setMedia(const QUrl &media, QIODevice *stream) override;
66
67 void play() override;
68 void pause() override;
69 void stop() override;
70
71 void setVideoSink(QVideoSink *videoSink);
72
73private Q_SLOTS:
74 void setVolume(float volume);
75 void setMuted(bool muted);
76 void readEvents();
77
78private:
79 void startMonitoring();
80 void stopMonitoring();
81 void resetMonitoring();
82
83 void openConnection();
84 void emitMmError(const char *msg);
85 void emitMmError(const QString &msg);
86 void emitPError(const QString &msg);
87
88 void handleMmPositionChanged(qint64 newPosition);
89 void updateBufferLevel(int level, int capacity);
90 void updateMetaData(const strm_dict_t *dict);
91
92 void handleMmEventState(const mmr_event_t *event);
93 void handleMmEventStatus(const mmr_event_t *event);
94 void handleMmEventStatusData(const strm_dict_t *data);
95 void handleMmEventError(const mmr_event_t *event);
96
97 QByteArray resourcePathForUrl(const QUrl &url);
98
99 void closeConnection();
100 void attach();
101
102 bool attachVideoOutput();
103 bool attachAudioOutput();
104 bool attachInput();
105
106 void detach();
107 void detachVideoOutput();
108 void detachAudioOutput();
109 void detachInput();
110
111 bool isVideoOutputAttached() const;
112 bool isAudioOutputAttached() const;
113 bool isInputAttached() const;
114
115 void updateScene(const QSize &size);
116
117 void updateVolume();
118
119 void setPositionInternal(qint64 position);
120 void flushPosition();
121
122 bool isPendingPositionFlush() const;
123
124 void setDeferredSpeedEnabled(bool enabled);
125 bool isDeferredSpeedEnabled() const;
126
127 mmr_context_t *m_context = nullptr;
128 mmr_connection_t *m_connection = nullptr;
129
130 QString m_contextName;
131
132 int m_id = -1;
133 int m_audioId = -1;
134 int m_volume = 50; // range is 0-100
135
136 QUrl m_media;
137 QPointer<QAudioOutput> m_audioOutput;
138 QPointer<QQnxVideoSink> m_platformVideoSink;
139
140 QQnxMediaMetaData m_metaData;
141
142 qint64 m_position = 0;
143 qint64 m_pendingPosition = 0;
144
145 int m_bufferLevel = 0;
146
147 int m_videoId = -1;
148
149 QTimer m_flushPositionTimer;
150
151 QQnxMediaEventThread *m_eventThread = nullptr;
152
153 int m_speed = 1000;
154 int m_configuredSpeed = 1000;
155
156 std::optional<int> m_deferredSpeed;
157
158 QQnxWindowGrabber* m_windowGrabber = nullptr;
159
160 bool m_inputAttached = false;
161 bool m_muted = false;
162 bool m_deferredSpeedEnabled = false;
163};
164
166
167#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QMediaPlayer class allows the playing of a media files.
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
void pause() override
const QIODevice * mediaStream() const override
bool isSeekable() const override
void setVideoSink(QVideoSink *videoSink)
void setAudioOutput(QPlatformAudioOutput *) override
void play() override
void setPlaybackRate(qreal rate) override
qint64 position() const override
QMediaTimeRange availablePlaybackRanges() const override
bool isAudioAvailable() const override
QQnxMediaPlayer(QMediaPlayer *parent=nullptr)
float bufferProgress() const override
qint64 duration() const override
void stop() override
qreal playbackRate() const override
QUrl media() const override
bool isVideoAvailable() const override
void setMedia(const QUrl &media, QIODevice *stream) override
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qtimer.h:20
\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
NSUInteger capacity
n void setPosition(void) \n\
GLenum GLuint GLint level
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
struct _cl_event * event
GLuint GLenum * rate
typedefQT_BEGIN_NAMESPACE struct mmr_context mmr_context_t
struct strm_dict strm_dict_t
#define Q_OBJECT
#define Q_SLOTS
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QUrl url("example.com")
[constructor-url-reference]