Sayonara Player
Loading...
Searching...
No Matches
StreamServer.h
1/* StreamServer.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef STREAM_SERVER_H
22#define STREAM_SERVER_H
23
24#include "StreamWriter.h"
25#include "Utils/Pimpl.h"
26
27// also needed for AcceptError
28#include <QTcpSocket>
29
30class PlayManager;
32
38 public QObject
39{
40 Q_OBJECT
41 PIMPL(StreamServer)
42
43 signals:
44 void sigNewConnection(const QString& ip);
45 void sigConnectionClosed(const QString& ip);
46 void sigListening(bool);
47
48 public:
49 explicit StreamServer(PlayManager* playManager, RawAudioDataProvider* audioDataProvider,
50 QObject* parent = nullptr);
52
53 QStringList connectedClients() const;
54
55 public slots:
56 void dismiss(int idx);
57
58 void disconnect(StreamWriterPtr sw);
59 void disconnectAll();
60
61 bool listen();
62 void close();
63 void restart();
64
65 private slots:
66 void acceptClient(QTcpSocket* socket, const QString& ip);
67 void rejectClient(QTcpSocket* socket, const QString& ip);
68
69 void serverDestroyed();
70
71 void newClientRequest();
72 void newClientRequestError(QAbstractSocket::SocketError socketError);
73
74 void disconnected(StreamWriter* sw);
75 void newConnection(const QString& ip);
76
77 void activeChanged();
78 void portChanged();
79};
80
81#endif
Definition PlayManager.h:34
Definition AudioDataProvider.h:55
The StreamServer class. This class is listening for new connections and holds and administrates curre...
Definition StreamServer.h:39
The StreamWriter class. This class is the interface between StreamDataSender and StreamServer....
Definition StreamWriter.h:43