BluezQt

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

KDE's Doxygen guidelines are available online.