Send boot-up progress percentages to status websocket for HLS input

This commit is contained in:
Thulinma 2023-03-09 16:00:38 +01:00
parent 52a10fc177
commit d96524968d
5 changed files with 43 additions and 16 deletions

View file

@ -850,11 +850,19 @@ pid_t Util::startPush(const std::string &streamname, std::string &target, int de
uint8_t Util::getStreamStatus(const std::string &streamname){
char pageName[NAME_BUFFER_SIZE];
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_STATE, streamname.c_str());
IPC::sharedPage streamStatus(pageName, 1, false, false);
IPC::sharedPage streamStatus(pageName, 2, false, false);
if (!streamStatus){return STRMSTAT_OFF;}
return streamStatus.mapped[0];
}
uint8_t Util::getStreamStatusPercentage(const std::string &streamname){
char pageName[NAME_BUFFER_SIZE];
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_STATE, streamname.c_str());
IPC::sharedPage streamStatus(pageName, 2, false, false);
if (!streamStatus || streamStatus.len < 2){return 0;}
return streamStatus.mapped[1];
}
/// Checks if a given user agent is allowed according to the given exception.
bool Util::checkException(const JSON::Value &ex, const std::string &useragent){
// No user agent? Always allow everything.

View file

@ -27,6 +27,7 @@ namespace Util{
JSON::Value getGlobalConfig(const std::string &optionName);
JSON::Value getInputBySource(const std::string &filename, bool isProvider = false);
uint8_t getStreamStatus(const std::string &streamname);
uint8_t getStreamStatusPercentage(const std::string &streamname);
bool checkException(const JSON::Value &ex, const std::string &useragent);
std::string codecString(const std::string &codec, const std::string &initData = "");