Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Components
Broadcasting
StreamWriter.h
1
/* StreamWriter.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_WRITER_H
22
#define STREAM_WRITER_H
23
24
#include "StreamHttpParser.h"
25
#include "Interfaces/Engine/AudioDataReceiver.h"
26
#include "Utils/Pimpl.h"
27
28
#include <QObject>
29
30
class
MetaData
;
31
class
PlayManager
;
32
class
QTcpSocket;
33
class
RawAudioDataProvider
;
34
40
class
StreamWriter
:
41
public
QObject,
42
public
Engine::RawAudioDataReceiver
43
{
44
Q_OBJECT
45
PIMPL(
StreamWriter
)
46
47
signals:
48
void
sigNewConnection(
const
QString&
ip
);
49
void
sigDisconnected(
StreamWriter
* sw);
50
51
public
:
52
enum class
Type :
53
uint8_t
54
{
55
Undefined,
56
Standard,
57
Invalid,
58
Streaming
59
};
60
67
StreamWriter
(
PlayManager
* playManager,
RawAudioDataProvider
* audioDataProvider, QTcpSocket* socket,
68
const
QString&
ip
);
69
~StreamWriter
()
override
;
70
75
QString
ip
()
const
;
76
81
bool
sendPlaylist
();
82
87
bool
sendFavicon
();
88
93
bool
sendMetadata
();
94
99
bool
sendBackground
();
100
105
bool
sendHtml5
();
106
112
bool
sendHeader
(
bool
reject);
113
114
StreamHttpParser::HttpAnswer
parseMessage();
115
119
void
disconnect
();
120
124
void
dismiss
();
125
131
void
writeAudioData
(
const
QByteArray& data)
override
;
132
133
private
:
134
void
reset();
135
136
private
slots:
137
void
socketDisconnected();
138
void
dataAvailble();
139
void
clearSocket();
140
};
141
142
using
StreamWriterPtr = std::shared_ptr<StreamWriter>;
143
#endif
Engine::RawAudioDataReceiver
The RawSoundReceiver interface.
Definition
AudioDataReceiver.h:59
MetaData
Definition
MetaData.h:43
PlayManager
Definition
PlayManager.h:34
RawAudioDataProvider
Definition
AudioDataProvider.h:55
StreamHttpParser::HttpAnswer
HttpAnswer
The HttpAnswer enum.
Definition
StreamHttpParser.h:40
StreamWriter::sendHtml5
bool sendHtml5()
send a html5 website (see StreamDataSender)
StreamWriter::disconnect
void disconnect()
disconnect a client socket
StreamWriter::ip
QString ip() const
get client ip address
StreamWriter::sendFavicon
bool sendFavicon()
Send the http favicon (see StreamDataSender).
StreamWriter::writeAudioData
void writeAudioData(const QByteArray &data) override
new audio data has arrived and has to be forwarded to the socket
StreamWriter::sendMetadata
bool sendMetadata()
Send track information (see StreamDataSender).
StreamWriter::StreamWriter
StreamWriter(PlayManager *playManager, RawAudioDataProvider *audioDataProvider, QTcpSocket *socket, const QString &ip)
StreamWriter.
StreamWriter::sendBackground
bool sendBackground()
Send website background (see StreamDataSender).
StreamWriter::sendPlaylist
bool sendPlaylist()
Send a m3u playlist (see StreamDataSender).
StreamWriter::dismiss
void dismiss()
stop sending sound over the client socket
StreamWriter::sendHeader
bool sendHeader(bool reject)
send a appropriate header based on the type of request (see StreamDataSender)
Generated on
for Sayonara Player by
1.17.0