-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshoutcast.hpp
74 lines (49 loc) · 1.94 KB
/
shoutcast.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef SCDShoutcast_H
#define SCDShoutcast_H
#include <QString>
#include "libshoutcast.hpp"
#include <shout/shout.h>
class SCDShoutcast
{
private:
QString ice_username;
QString ice_password;
QString ice_mount;
QString ice_host;
int ice_port;
unsigned int ice_protocol;
unsigned int ice_format;
shout_t *shout_handle = 0;
QString lastError = "";
public:
enum AudioFormat {OGG = SHOUT_FORMAT_OGG,
MP3 = SHOUT_FORMAT_MP3,
WEBM = SHOUT_FORMAT_WEBM};
enum ShoutProtocol {HTTP = SHOUT_PROTOCOL_HTTP,
XAUDIOCAST = SHOUT_PROTOCOL_XAUDIOCAST,
ICY = SHOUT_PROTOCOL_ICY};
SCDShoutcast(QString host = "localhost",
int port = 8000,
QString username = "source",
QString password = "hackme",
ShoutProtocol protocol = HTTP,
AudioFormat format = OGG);
QString lastErrorString() {return lastError;}
bool connected() {return shout_handle!=0;}
int open(const char *mountPoint, bool nonblocking=false);
int open(QString mountPoint="Shoutcast", bool nonblocking=false);
int send(const char *buff, int buff_size, unsigned int sync=1);
int send(const char *buff, int buff_size, int startFromByte, unsigned int sync=1);
int send(QByteArray *buff, int startFromByte, unsigned int sync=1);
int send(QByteArray *buff, unsigned int sync=1);
int streamFile(QString filename);
int close();
QString iceHost() {return ice_host;}
int icePort() {return ice_port;}
QString iceUsername() {return ice_username;}
QString icePassword() {return ice_password;}
QString iceMount() {return ice_mount;}
ShoutProtocol iceProtocol() {return (ShoutProtocol) ice_protocol;}
AudioFormat iceFormat() {return (AudioFormat) ice_format;}
};
#endif // SCDShoutcast_H