Qmmp
mediaplayer.h
1 /***************************************************************************
2  * Copyright (C) 2008-2020 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef MEDIAPLAYER_H
21 #define MEDIAPLAYER_H
22 
23 #include <QObject>
24 #include <qmmp/soundcore.h>
25 #include "playlistmanager.h"
26 #include "qmmpui_export.h"
27 
28 class QmmpUiSettings;
29 class QTimer;
30 
31 
35 class QMMPUI_EXPORT MediaPlayer : public QObject
36 {
37  Q_OBJECT
38 public:
43  MediaPlayer(QObject *parent = nullptr);
47  ~MediaPlayer();
51  static MediaPlayer* instance();
55  PlayListManager *playListManager();
56 
57 signals:
62  void playbackFinished();
63 
64 public slots:
68  void play(qint64 offset = -1);
72  void stop();
76  void next();
80  void previous();
81 
82 private slots:
83  void playNext();
84  void updateNextUrl();
85  void processState(Qmmp::State state);
86  void updateMetaData();
87 
88 private:
89  QmmpUiSettings *m_settings;
90  PlayListManager *m_pl_manager;
91  SoundCore *m_core;
92  static MediaPlayer* m_instance;
93  int m_skips;
94  QString m_nextUrl;
95  QTimer *m_finishTimer;
96 };
97 
98 #endif
State
Definition: qmmp.h:61
The PlayListManager class is used to handle multiple playlists.
Definition: playlistmanager.h:36
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:36
The SoundCore class provides a simple interface for audio playback.
Definition: soundcore.h:44
The MediaPlayer class provides a simple way to use SoundCore and PlayListModel together.
Definition: mediaplayer.h:35