Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
remotejellyfinplayback.h
Go to the documentation of this file.
1/*
2 * Sailfin: a Jellyfin client written using Qt
3 * Copyright (C) 2023 Chris Josten and the Sailfin Contributors.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#ifndef JELLYFIN_MODEL_REMOTEJELLYFINPLAYBACK_H
20#define JELLYFIN_MODEL_REMOTEJELLYFINPLAYBACK_H
21
28
29#include <QJsonObject>
30#include <QSharedPointer>
31#include <QTimer>
32
33#include <optional>
34
35namespace Jellyfin {
36
37class ApiClient;
38
39namespace Model {
40
42public:
43 RemoteJellyfinPlayback(ApiClient &apiClient, QString sessionId, QObject *parent = nullptr);
45
46 // PlaybackManager
47 PlayerState playbackState() const override;
48 MediaStatus mediaStatus() const override;
49 bool hasNext() const override;
50 bool hasPrevious() const override;
51 PlaybackManagerError error() const override;
52 const QString &errorString() const override;
53 qint64 position() const override;
54 qint64 duration() const override;
55 bool seekable() const override;
56 bool hasAudio() const override;
57 bool hasVideo() const override;
58 void playItem(QSharedPointer<Item> item) override;
59 void playItemInList(const QList<QSharedPointer<Item> > &items, int index) override;
60
61public slots:
62 void pause() override;
63 void play() override;
64 void playItemId(const QString &id) override;
65 void previous() override;
66 void next() override;
67 void goTo(int index) override;
68 void stop() override;
69 void seek(qint64 pos) override;
70private slots:
71 void onPositionTimerFired();
72 void onSessionInfoUpdated(const QString &sessionId, const DTO::SessionInfo &sessionInfo);
73private:
74 void sendPlaystateCommand(DTO::PlaystateCommand command, qint64 seekTicks = -1);
75 void sendGeneralCommand(DTO::GeneralCommandType command, QJsonObject arguments = QJsonObject());
76 void sendCommand(Support::LoaderBase *loader);
77 void playItemInList(const QStringList &items, int index, qint64 resumeTicks = -1);
83 bool isQueueSame(QList<QueueItem> itemIds);
88 void updateQueue(QList<QueueItem> itemIds);
89 ApiClient &m_apiClient;
90 QString m_sessionId;
91 std::optional<DTO::SessionInfo> m_lastSessionInfo;
92 QTimer *m_positionTimer;
93 qint64 m_position = 0;
94};
95
96
97} // NS Model
98} // NS Jellyfin
99
100
101#endif // JELLYFIN_MODEL_REMOTEJELLYFINPLAYBACK_H
An Api client for Jellyfin. Handles requests and authentication.
Definition apiclient.h:90
Value
Definition generalcommandtype.h:49
Value
Definition playstatecommand.h:49
Definition sessioninfo.h:60
Value
Definition player.h:48
Value
Definition playbackmanager.h:40
Base class for a playback manager.
Definition playbackmanager.h:59
ApiClient * apiClient() const
Definition playbackmanager.cpp:131
Value
Definition player.h:35
Definition remotejellyfinplayback.h:41
qint64 duration() const override
Definition remotejellyfinplayback.cpp:85
void playItemInList(const QList< QSharedPointer< Item > > &items, int index) override
Definition remotejellyfinplayback.cpp:113
MediaStatus mediaStatus() const override
Definition remotejellyfinplayback.cpp:61
bool hasPrevious() const override
Definition remotejellyfinplayback.cpp:69
void playItemId(const QString &id) override
Definition remotejellyfinplayback.cpp:141
virtual ~RemoteJellyfinPlayback()
Definition remotejellyfinplayback.cpp:49
void play() override
Definition remotejellyfinplayback.cpp:137
PlaybackManagerError error() const override
Definition remotejellyfinplayback.cpp:73
void stop() override
Definition remotejellyfinplayback.cpp:158
void pause() override
Definition remotejellyfinplayback.cpp:133
bool hasVideo() const override
Definition remotejellyfinplayback.cpp:105
void seek(qint64 pos) override
Definition remotejellyfinplayback.cpp:168
bool hasNext() const override
Definition remotejellyfinplayback.cpp:65
PlayerState playbackState() const override
Definition remotejellyfinplayback.cpp:53
qint64 position() const override
Definition remotejellyfinplayback.cpp:81
bool hasAudio() const override
Definition remotejellyfinplayback.cpp:101
void goTo(int index) override
Definition remotejellyfinplayback.cpp:153
RemoteJellyfinPlayback(ApiClient &apiClient, QString sessionId, QObject *parent=nullptr)
Definition remotejellyfinplayback.cpp:38
void next() override
Definition remotejellyfinplayback.cpp:149
bool seekable() const override
Definition remotejellyfinplayback.cpp:93
const QString & errorString() const override
Definition remotejellyfinplayback.cpp:77
void previous() override
Definition remotejellyfinplayback.cpp:145
void playItem(QSharedPointer< Item > item) override
Definition remotejellyfinplayback.cpp:109
Base class for loaders that defines available signals.
Definition loader.h:63
Definition mediaplayer2.h:20