| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef PLAYERBACKEND_H |
| 4 | #define PLAYERBACKEND_H |
| 5 | |
| 6 | #include <QUrl> |
| 7 | #include <QWidget> |
| 8 | |
| 9 | class QVBoxLayout; |
| 10 | class Application; |
| 11 | |
| 12 | class PlayerBackend : public QWidget { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | enum class PlaybackState { |
| 17 | StoppedState, |
| 18 | PlayingState, |
| 19 | PausedState |
| 20 | }; |
| 21 | |
| 22 | explicit PlayerBackend(Application* app, QWidget* parent = nullptr); |
| 23 | |
| 24 | virtual QUrl url() const = 0; |
| 25 | virtual int position() const = 0; |
| 26 | virtual int duration() const = 0; |
| 27 | |
| 28 | signals: |
| 29 | void closed(); |
| 30 | void fullscreenChanged(bool fullscreen); |
| 31 | void mutedChanged(bool muted); |
| 32 | void speedChanged(int speed); |
| 33 | void durationChanged(int duration); |
| 34 | void positionChanged(int position); |
| 35 | void volumeChanged(int volume); |
| 36 | void audioAvailable(bool available); |
| 37 | void videoAvailable(bool available); |
| 38 | void seekableChanged(bool seekable); |
| 39 | |
| 40 | void errorOccurred(const QString& error_string); |
| 41 | void statusChanged(const QString& status); |
| 42 | void playbackStateChanged(PlayerBackend::PlaybackState state); |
| 43 | |
| 44 | public slots: |
| 45 | virtual void playUrl(const QUrl& url) = 0; |
| 46 | virtual void playPause() = 0; |
| 47 | virtual void pause() = 0; |
| 48 | virtual void stop() = 0; |
| 49 | |
| 50 | virtual void setFullscreen(bool fullscreen) = 0; |
| 51 | virtual void setMuted(bool muted) = 0; |
| 52 | virtual void setPlaybackSpeed(int speed) = 0; |
| 53 | virtual void setVolume(int volume) = 0; |
| 54 | virtual void setPosition(int position) = 0; |
| 55 | |
| 56 | protected: |
| 57 | Application* m_app; |
| 58 | |
| 59 | private: |
| 60 | QVBoxLayout* m_mainLayout; |
| 61 | }; |
| 62 | |
| 63 | #endif // PLAYERBACKEND_H |