12 std::string
GetEnv(
const std::string& name)
14 char *data=getenv(name.c_str());
16 return std::string(data);
23 bool stopthread=
false;
25 #if defined(_WIN32) || defined(WIN32)
27 _setmode(_fileno(stdin), _O_BINARY);
28 _setmode(_fileno(stdout), _O_BINARY);
35 std::cerr <<
"ProcessLoop: input stopped"<< std::endl;
39 if (stopthread)
break;
44 std::cerr <<
"Failed to write audio output" << std::endl;
52 std::cerr << msg << std::endl;
55 int main(
int argc,
const char **argv)
61 int listen_port = 8080;
64 auto LoginKey=
GetEnv(
"S4LOGINKEY");
65 if (LoginKey.empty()) {
66 LoginKey=
GetEnv(
"S4USERID");
68 auto RadioName=
GetEnv(
"RADIO_NAME");
69 auto KeyId=
GetEnv(
"S4_AWS_ACCESS_KEY_ID");
70 auto AccessKey=
GetEnv(
"S4_AWS_SECRET_ACCESS_KEY");
72 instance.
SetParam(
"ADMIN_USER",
"admin");
73 instance.
SetParam(
"ADMIN_SECRET",
"admin");
75 std::cout <<
"Creating" << std::endl;
76 if (!instance.
Create(LoginKey, RadioName, KeyId, AccessKey, std::filesystem::path())) {
77 std::cerr <<
"Failed to create the processing instance" << std::endl;
81 std::cout <<
"Starting web server" << std::endl;
83 std::cerr <<
"Failed to create the web server on port " << listen_port << std::endl;
89 std::cout <<
"Stopping now" << std::endl;
92 std::cout <<
"End" << std::endl;
void SetParam(const std::string &name, const std::string &value)
bool StartWebServer(int http_port, int https_port=0)
bool Create(const std::string &LoginKey, const std::string &RadioName, const std::string &AWS_Access_ID, const std::string &AWS_Access_Secret, const std::filesystem::path &save_path)
const size_t OutputSampleSize
void SetLogSeverity(LogSeverity severity)
const size_t InputSampleSize
void SetLoggerCallback(log_cb_t cb)
void ProcessLoop(CInstance &instance)
int main(int argc, const char **argv)
std::string GetEnv(const std::string &name)
void DoLog(LogSeverity severity, const std::string &msg)