File indexing completed on 2025-01-05 04:29:51

0001 /**
0002  * SPDX-FileCopyrightText: 2022-2023 Bart De Vries <bart@mogwai.be>
0003  * SPDX-FileCopyrightText: 2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
0004  *
0005  * SPDX-License-Identifier: LGPL-3.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include <memory>
0011 
0012 #include <QObject>
0013 #include <QString>
0014 #include <QUrl>
0015 
0016 #include "abstractmediabackend.h"
0017 #include "kmediasession.h"
0018 
0019 class VlcMediaBackendPrivate;
0020 
0021 class VlcMediaBackend : public AbstractMediaBackend
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     VlcMediaBackend(QObject *parent);
0027     ~VlcMediaBackend();
0028 
0029     KMediaSession::MediaBackends backend() const override;
0030 
0031     bool muted() const override;
0032     qreal volume() const override;
0033     QUrl source() const override;
0034     KMediaSession::MediaStatus mediaStatus() const override;
0035     KMediaSession::PlaybackState playbackState() const override;
0036     qreal playbackRate() const override;
0037     KMediaSession::Error error() const override;
0038     qint64 duration() const override;
0039     qint64 position() const override;
0040     bool seekable() const override;
0041 
0042 public Q_SLOTS:
0043     void setMuted(bool muted) override;
0044     void setVolume(qreal volume) override;
0045     void setSource(const QUrl &source) override;
0046     void setPosition(qint64 position) override;
0047     void setPlaybackRate(qreal rate) override;
0048 
0049     void play() override;
0050     void pause() override;
0051     void stop() override;
0052 
0053 private:
0054     friend class VlcMediaBackendPrivate;
0055     std::unique_ptr<VlcMediaBackendPrivate> d;
0056 
0057     void playerStateSignalChanges(KMediaSession::PlaybackState newState);
0058     void mediaStatusSignalChanges(KMediaSession::MediaStatus newStatus);
0059     void playerErrorSignalChanges(KMediaSession::Error error);
0060     void playerDurationSignalChanges(qint64 newDuration);
0061     void playerPositionSignalChanges(qint64 newPosition);
0062     void playerVolumeSignalChanges(qreal volume);
0063     void playerMutedSignalChanges(bool isMuted);
0064     void playerSeekableSignalChanges(bool isSeekable);
0065 
0066     void setPlayerName(const QString &name);
0067     void setDesktopEntryName(const QString &name);
0068 };