BluezQt

mediaplayer.h
1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2015 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_MEDIAPLAYER_H
10#define BLUEZQT_MEDIAPLAYER_H
11
12#include <QObject>
13
14#include "bluezqt_export.h"
15#include "mediaplayertrack.h"
16#include "types.h"
17
18#include <memory>
19
20namespace BluezQt
21{
22class PendingCall;
23
24/**
25 * @class BluezQt::MediaPlayer mediaplayer.h <BluezQt/MediaPlayer>
26 *
27 * Media player.
28 *
29 * This class represents a media player interface.
30 */
31class BLUEZQT_EXPORT MediaPlayer : public QObject
32{
33 Q_OBJECT
34 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
35 Q_PROPERTY(Equalizer equalizer READ equalizer WRITE setEqualizer NOTIFY equalizerChanged)
36 Q_PROPERTY(Repeat repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
37 Q_PROPERTY(Shuffle shuffle READ shuffle WRITE setShuffle NOTIFY shuffleChanged)
38 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
39 Q_PROPERTY(MediaPlayerTrack track READ track NOTIFY trackChanged)
40 Q_PROPERTY(quint32 position READ position NOTIFY positionChanged)
41
42public:
43 /** Equalizer state. */
44 enum Equalizer {
45 /** Equalizer on. */
47 /** Equalizer off. */
49 };
50 Q_ENUM(Equalizer)
51
52 /** Repeat state. */
53 enum Repeat {
54 /** Repeat off. */
56 /** Repeat single track. */
58 /** Repeat all tracks. */
60 /** Repeat group. */
62 };
63 Q_ENUM(Repeat)
64
65 /** Shuffle state. */
66 enum Shuffle {
67 /** Shuffle off. */
69 /** Shuffle all tracks. */
71 /** Shuffle group. */
73 };
74 Q_ENUM(Shuffle)
75
76 /** Player status. */
77 enum Status {
78 /** Player is playing. */
80 /** Player is stopped. */
82 /** Player is paused. */
84 /** Player is forward seeking. */
86 /** Player is reverse seeking. */
88 /** Error */
90 };
91 Q_ENUM(Status)
92
93 /**
94 * Destroys a MediaPlayer object.
95 */
96 ~MediaPlayer() override;
97
98 /**
99 * Returns a shared pointer from this.
100 *
101 * @return MediaPlayerPtr
102 */
103 MediaPlayerPtr toSharedPtr() const;
104
105 /**
106 * Returns the name of the player.
107 *
108 * @return name of player
109 */
110 QString name() const;
111
112 /**
113 * Returns the equalizer state of the player.
114 *
115 * @return equalizer state of player
116 */
117 Equalizer equalizer() const;
118
119 /**
120 * Sets the equalizer state of the player.
121 *
122 * @param equalizer equalizer state
123 * @return void pending call
124 */
125 PendingCall *setEqualizer(Equalizer equalizer);
126
127 /**
128 * Returns the repeat state of the player.
129 *
130 * @return repeat state of player
131 */
132 Repeat repeat() const;
133
134 /**
135 * Sets the repeat state of the player.
136 *
137 * @param repeat repeat state
138 * @return void pending call
139 */
140 PendingCall *setRepeat(Repeat repeat);
141
142 /**
143 * Returns the shuffle state of the player.
144 *
145 * @return shuffle state of player
146 */
147 Shuffle shuffle() const;
148
149 /**
150 * Sets the shuffle state of the player.
151 *
152 * @param shuffle shuffle state
153 * @return void pending call
154 */
155 PendingCall *setShuffle(Shuffle shuffle);
156
157 /**
158 * Returns the status of the player.
159 *
160 * @return status of player
161 */
162 Status status() const;
163
164 /**
165 * Returns the current track.
166 *
167 * @return current track
168 */
169 MediaPlayerTrack track() const;
170
171 /**
172 * Returns the playback position in milliseconds.
173 *
174 * @return playback position
175 */
176 quint32 position() const;
177
178public Q_SLOTS:
179 /**
180 * Resumes playback.
181 *
182 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
183 *
184 * @return void pending call
185 */
186 PendingCall *play();
187
188 /**
189 * Pauses playback.
190 *
191 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
192 *
193 * @return void pending call
194 */
196
197 /**
198 * Stops playback.
199 *
200 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
201 *
202 * @return void pending call
203 */
204 PendingCall *stop();
205
206 /**
207 * Switch to next track.
208 *
209 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
210 *
211 * @return void pending call
212 */
213 PendingCall *next();
214
215 /**
216 * Switch to previous track.
217 *
218 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
219 *
220 * @return void pending call
221 */
222 PendingCall *previous();
223
224 /**
225 * Fast forwards playback.
226 *
227 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
228 *
229 * @return void pending call
230 */
231 PendingCall *fastForward();
232
233 /**
234 * Rewinds playback.
235 *
236 * Possible errors: PendingCall::NotSupported, PendingCall::Failed
237 *
238 * @return void pending call
239 */
240 PendingCall *rewind();
241
242Q_SIGNALS:
243 /**
244 * Indicates that player's name have changed.
245 */
246 void nameChanged(const QString &name);
247
248 /**
249 * Indicates that player's equalizer state have changed.
250 */
252
253 /**
254 * Indicates that player's repeat state have changed.
255 */
256 void repeatChanged(Repeat repeat);
257
258 /**
259 * Indicates that player's shuffle state have changed.
260 */
261 void shuffleChanged(Shuffle shuffle);
262
263 /**
264 * Indicates that player's status have changed.
265 */
267
268 /**
269 * Indicates that player's current track have changed.
270 */
272
273 /**
274 * Indicates that player's playback position have changed.
275 */
276 void positionChanged(quint32 position);
277
278private:
279 BLUEZQT_NO_EXPORT explicit MediaPlayer(const QString &path, const QVariantMap &properties);
280
281 std::unique_ptr<class MediaPlayerPrivate> const d;
282
283 friend class MediaPlayerPrivate;
284 friend class DevicePrivate;
285};
286
287} // namespace BluezQt
288
289#endif // BLUEZQT_MEDIAPLAYER_H
Media player track.
Repeat
Repeat state.
Definition mediaplayer.h:53
@ RepeatGroup
Repeat group.
Definition mediaplayer.h:61
@ RepeatSingleTrack
Repeat single track.
Definition mediaplayer.h:57
@ RepeatOff
Repeat off.
Definition mediaplayer.h:55
@ RepeatAllTracks
Repeat all tracks.
Definition mediaplayer.h:59
void equalizerChanged(Equalizer equalizer)
Indicates that player's equalizer state have changed.
Shuffle
Shuffle state.
Definition mediaplayer.h:66
@ ShuffleGroup
Shuffle group.
Definition mediaplayer.h:72
@ ShuffleOff
Shuffle off.
Definition mediaplayer.h:68
@ ShuffleAllTracks
Shuffle all tracks.
Definition mediaplayer.h:70
void trackChanged(MediaPlayerTrack track)
Indicates that player's current track have changed.
Equalizer
Equalizer state.
Definition mediaplayer.h:44
@ EqualizerOff
Equalizer off.
Definition mediaplayer.h:48
@ EqualizerOn
Equalizer on.
Definition mediaplayer.h:46
Status
Player status.
Definition mediaplayer.h:77
@ Playing
Player is playing.
Definition mediaplayer.h:79
@ Stopped
Player is stopped.
Definition mediaplayer.h:81
@ ReverseSeek
Player is reverse seeking.
Definition mediaplayer.h:87
@ Paused
Player is paused.
Definition mediaplayer.h:83
@ ForwardSeek
Player is forward seeking.
Definition mediaplayer.h:85
void shuffleChanged(Shuffle shuffle)
Indicates that player's shuffle state have changed.
~MediaPlayer() override
Destroys a MediaPlayer object.
void repeatChanged(Repeat repeat)
Indicates that player's repeat state have changed.
void positionChanged(quint32 position)
Indicates that player's playback position have changed.
void nameChanged(const QString &name)
Indicates that player's name have changed.
void statusChanged(Status status)
Indicates that player's status have changed.
Pending method call.
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE Q_NOREPLY void pause()
Q_SCRIPTABLE CaptureState status()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.