Music Hub ..
A session-wide music playback service
Loading...
Searching...
No Matches
player.h
Go to the documentation of this file.
1/*
2 * Copyright © 2021-2022 UBports Foundation.
3 *
4 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3,
8 * as published by the Free Software Foundation.
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 Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef LOMIRI_MEDIAHUBSERVICE_PLAYER_H
19#define LOMIRI_MEDIAHUBSERVICE_PLAYER_H
20
21#include <QMap>
22#include <QMetaType>
23#include <QString>
24
25#include <cstdint>
26#include <stdexcept>
27
28namespace lomiri {
29namespace MediaHubService {
30
31class Service;
33
35{
37 {
41 };
42
47 static Backend get_backend_type();
48};
49
50class Player
51{
52public:
53 typedef double PlaybackRate;
54 typedef double Volume;
55 typedef uint32_t PlayerKey;
57 typedef QMap<QString,QString> HeadersType;
58
59 static const PlayerKey invalidKey = 0xffffffff;
60
61 struct Client {
63 QString name; // D-Bus unique connection ID
64
65 bool operator==(const Client &o) const {
66 return key == o.key && name == o.name;
67 }
68 };
69
70 struct Errors
71 {
72 Errors() = delete;
73
74 struct ExceptionBase: public std::runtime_error {
75 ExceptionBase(const QString &msg = {}):
76 std::runtime_error(msg.toStdString()) {}
77 };
78
82
86
87 struct UriNotFound: public ExceptionBase {
89 };
90 };
91
100
107
120
128
134
144};
145
146}
147}
148
150
151#endif // LOMIRI_MEDIAHUBSERVICE_PLAYER_H
static const PlayerKey invalidKey
Definition player.h:59
QMap< QString, QString > HeadersType
Definition player.h:57
static Backend get_backend_type()
Returns the type of audio/video decoding/encoding backend being used.
Definition backend.cpp:28
bool operator==(const Client &o) const
Definition player.h:65