Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
player_implementation.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013-2015 Canonical Ltd.
3 * Copyright © 2022 UBports Foundation.
4 *
5 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License version 3,
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authored by: Thomas Voß <thomas.voss@canonical.com>
20 */
21
22#ifndef LOMIRI_MEDIAHUBSERVICE_PLAYER_IMPLEMENTATION_H
23#define LOMIRI_MEDIAHUBSERVICE_PLAYER_IMPLEMENTATION_H
24
25#include "apparmor/lomiri.h"
27#include "player.h"
29#include "track.h"
30
31#include <QMap>
32#include <QObject>
33#include <QScopedPointer>
34#include <QString>
35
36namespace lomiri
37{
38namespace MediaHubService
39{
40class Engine;
41class Service;
42
43class PlayerImplementationPrivate;
45{
46 Q_OBJECT
47
48public:
50
51 // All creation time arguments go here
53 {
54 // The unique client identifying the player instance.
56 // Functional dependencies
58 };
59
60 PlayerImplementation(const Configuration& configuration,
61 QObject *parent = nullptr);
63
65 const Player::Client &client() const;
66
67 bool canPlay() const;
68 bool canPause() const;
69 bool canSeek() const;
70 bool canGoPrevious() const;
71 bool canGoNext() const;
72
73 void setPlaybackRate(double rate);
74 double playbackRate() const;
75 double minimumRate() const;
76 double maximumRate() const;
77
80
81 void setShuffle(bool shuffle);
82 bool shuffle() const;
83
84 void setVolume(double volume);
85 double volume() const;
86
88
89 bool isVideoSource() const;
90 bool isAudioSource() const;
91 QSize videoDimension() const;
94
95 uint64_t position() const;
96 uint64_t duration() const;
97
100
103
104 void reconnect();
105 void abandon();
106
107 QSharedPointer<TrackListImplementation> trackList();
108 Player::PlayerKey key() const;
109
110 void create_gl_texture_video_sink(std::uint32_t texture_id);
111
112 bool open_uri(const QUrl &uri);
113 bool open_uri(const QUrl &uri, const Headers &headers);
114 void next();
115 void previous();
116 void play();
117 void pause();
118 void stop();
119 void seek_to(const std::chrono::microseconds& offset);
120
121Q_SIGNALS:
126
131
134
137 void seekedTo(uint64_t offset);
141 /* TODO: the Service should pause all other players and set this one as the current one */
143
144private:
145 Q_DECLARE_PRIVATE(PlayerImplementation)
146 QScopedPointer<PlayerImplementationPrivate> d_ptr;
147};
148
149}
150}
151
152#endif // LOMIRI_MEDIAHUBSERVICE_PLAYER_IMPLEMENTATION_H
QSharedPointer< ClientDeathObserver > Ptr
void create_gl_texture_video_sink(std::uint32_t texture_id)
void setAudioStreamRole(Player::AudioStreamRole role)
void seek_to(const std::chrono::microseconds &offset)
QSharedPointer< TrackListImplementation > trackList()
QMap< QString, QString > HeadersType
Definition player.h:57