-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbackmanager.h
61 lines (45 loc) · 1.25 KB
/
playbackmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PLAYBACKMANAGER_H
#define PLAYBACKMANAGER_H
# include <QObject>
# include <QMediaPlayer>
# include <QMediaPlaylist>
class PlaybackManager : public QObject
{
Q_OBJECT
public:
explicit PlaybackManager(QObject *parent = 0);
~PlaybackManager();
qint64 getDuration();
bool isPlaying();
bool isUrlStillValid(const QUrl &url);
void playUrl(const QUrl& url);
public slots:
void play();
void pause();
void next();
void previous();
void requestNewPosition(int p);
void playSound(int id);
void enqueueSound(int id);
signals:
void finished(); // emitted when the last song has finished playing
void paused();
void started();
void nextSongStarted(); // emitted when the next song is begun
void playTimeElapsed(int duration);
void newSongDuration(int begin, int duration);
private slots:
void handlePlayerStateChange(QMediaPlayer::State state);
void receiveStreamUrl(int id, QUrl url);
void handleNewDuration(qint64 d);
void handleNewPosition(qint64 p);
// --- attributes ---
public:
private:
QMediaPlayer* player;
QMediaPlaylist* playlist;
QHash<int, QUrl> idsForUrls;
QString streamLocation;
int lastRequestedSong;
};
#endif // PLAYBACKMANAGER_H