winlin

complete the consts refine

... ... @@ -69,10 +69,10 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
{
int ret = ERROR_SUCCESS;
if (nb_sample_units >= SRS_MAX_CODEC_SAMPLE) {
if (nb_sample_units >= __SRS_SRS_MAX_CODEC_SAMPLE) {
ret = ERROR_HLS_DECODE_ERROR;
srs_error("hls decode samples error, "
"exceed the max count: %d, ret=%d", SRS_MAX_CODEC_SAMPLE, ret);
"exceed the max count: %d, ret=%d", __SRS_SRS_MAX_CODEC_SAMPLE, ret);
return ret;
}
... ... @@ -97,7 +97,7 @@ SrsAvcAacCodec::SrsAvcAacCodec()
avc_profile = 0;
avc_level = 0;
aac_profile = 0;
aac_sample_rate = _SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored
aac_sample_rate = __SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored
aac_channels = 0;
avc_extra_size = 0;
avc_extra_data = NULL;
... ... @@ -283,7 +283,7 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
}
// reset the sample rate by sequence header
if (aac_sample_rate != _SRS_AAC_SAMPLE_RATE_UNSET) {
if (aac_sample_rate != __SRS_AAC_SAMPLE_RATE_UNSET) {
static int aac_sample_rates[] = {
96000, 88200, 64000, 48000,
44100, 32000, 24000, 22050,
... ...
... ... @@ -35,8 +35,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class SrsStream;
class SrsAmf0Object;
#define SRS_MAX_CODEC_SAMPLE 128
#define _SRS_AAC_SAMPLE_RATE_UNSET 15
#define __SRS_SRS_MAX_CODEC_SAMPLE 128
#define __SRS_AAC_SAMPLE_RATE_UNSET 15
/**
* the FLV/RTMP supported audio sample rate.
... ... @@ -133,7 +133,7 @@ public:
* where avc/h264 video packet may contains multiple buffer.
*/
int nb_sample_units;
SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE];
SrsCodecSampleUnit sample_units[__SRS_SRS_MAX_CODEC_SAMPLE];
public:
/**
* whether the sample is video sample which demux from video packet.
... ...
... ... @@ -65,14 +65,14 @@ void SrsHttpHeartbeat::heartbeat()
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("device_id", device_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip);
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("device_id", device_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip);
if (_srs_config->get_heartbeat_summaries()) {
ss << JFIELD_CONT << JFIELD_ORG("summaries", "");
ss << __SRS_JFIELD_CONT << __SRS_JFIELD_ORG("summaries", "");
srs_api_dump_summaries(ss);
}
ss << JOBJECT_END;
ss << __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ...
... ... @@ -404,7 +404,7 @@ int64_t SrsHlsAacJitter::on_buffer_start(int64_t flv_pts, int sample_rate, int a
int flv_sample_rate = flv_sample_rates[sample_rate & 0x03];
// override the sample rate by sequence header
if (aac_sample_rate != _SRS_AAC_SAMPLE_RATE_UNSET) {
if (aac_sample_rate != __SRS_AAC_SAMPLE_RATE_UNSET) {
flv_sample_rate = aac_sample_rates[aac_sample_rate];
}
... ...
... ... @@ -109,14 +109,14 @@ int SrsHttpHandler::process_request(SrsSocket* skt, SrsHttpMessage* req)
if (!is_handler_valid(req, status_code, reason_phrase)) {
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_HTTP_HANDLER_INVALID) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("status_code", status_code) << JFIELD_CONT
<< JFIELD_STR("reason_phrase", reason_phrase) << JFIELD_CONT
<< JFIELD_STR("url", req->url())
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_HTTP_HANDLER_INVALID) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("status_code", status_code) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("reason_phrase", reason_phrase) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("url", req->url())
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_error(skt, req, status_code, reason_phrase, ss.str());
}
... ... @@ -145,10 +145,10 @@ int SrsHttpHandler::do_process_request(SrsSocket* /*skt*/, SrsHttpMessage* /*req
int SrsHttpHandler::response_error(SrsSocket* skt, SrsHttpMessage* req, int code, string desc)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(code) << JFIELD_CONT
<< JFIELD_STR("desc", desc)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(code) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("desc", desc)
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ...
... ... @@ -76,12 +76,12 @@ int SrsApiRoot::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("urls", JOBJECT_START)
<< JFIELD_STR("api", "the api root")
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("api", "the api root")
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -104,12 +104,12 @@ int SrsApiApi::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("urls", JOBJECT_START)
<< JFIELD_STR("v1", "the api version 1.0")
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("v1", "the api version 1.0")
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -139,19 +139,19 @@ int SrsApiV1::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("urls", JOBJECT_START)
<< JFIELD_STR("versions", "the version of SRS") << JFIELD_CONT
<< JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << JFIELD_CONT
<< JFIELD_STR("rusages", "the rusage of SRS") << JFIELD_CONT
<< JFIELD_STR("self_proc_stats", "the self process stats") << JFIELD_CONT
<< JFIELD_STR("system_proc_stats", "the system process stats") << JFIELD_CONT
<< JFIELD_STR("meminfos", "the meminfo of system") << JFIELD_CONT
<< JFIELD_STR("authors", "the primary authors and contributors") << JFIELD_CONT
<< JFIELD_STR("requests", "the request itself, for http debug")
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("versions", "the version of SRS") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("rusages", "the rusage of SRS") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("self_proc_stats", "the self process stats") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("system_proc_stats", "the system process stats") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("meminfos", "the meminfo of system") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("authors", "the primary authors and contributors") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("requests", "the request itself, for http debug")
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -173,49 +173,49 @@ int SrsApiRequests::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_STR("uri", req->uri()) << JFIELD_CONT
<< JFIELD_STR("path", req->path()) << JFIELD_CONT;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("uri", req->uri()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("path", req->path()) << __SRS_JFIELD_CONT;
// method
if (req->is_http_get()) {
ss << JFIELD_STR("METHOD", "GET");
ss << __SRS_JFIELD_STR("METHOD", "GET");
} else if (req->is_http_post()) {
ss << JFIELD_STR("METHOD", "POST");
ss << __SRS_JFIELD_STR("METHOD", "POST");
} else if (req->is_http_put()) {
ss << JFIELD_STR("METHOD", "PUT");
ss << __SRS_JFIELD_STR("METHOD", "PUT");
} else if (req->is_http_delete()) {
ss << JFIELD_STR("METHOD", "DELETE");
ss << __SRS_JFIELD_STR("METHOD", "DELETE");
} else {
ss << JFIELD_ORG("METHOD", req->method());
ss << __SRS_JFIELD_ORG("METHOD", req->method());
}
ss << JFIELD_CONT;
ss << __SRS_JFIELD_CONT;
// request headers
ss << JFIELD_NAME("headers") << JOBJECT_START;
ss << __SRS_JFIELD_NAME("headers") << __SRS_JOBJECT_START;
for (int i = 0; i < req->request_header_count(); i++) {
std::string key = req->request_header_key_at(i);
std::string value = req->request_header_value_at(i);
if ( i < req->request_header_count() - 1) {
ss << JFIELD_STR(key, value) << JFIELD_CONT;
ss << __SRS_JFIELD_STR(key, value) << __SRS_JFIELD_CONT;
} else {
ss << JFIELD_STR(key, value);
ss << __SRS_JFIELD_STR(key, value);
}
}
ss << JOBJECT_END << JFIELD_CONT;
ss << __SRS_JOBJECT_END << __SRS_JFIELD_CONT;
// server informations
ss << JFIELD_NAME("server") << JOBJECT_START
<< JFIELD_STR("sigature", RTMP_SIG_SRS_KEY) << JFIELD_CONT
<< JFIELD_STR("name", RTMP_SIG_SRS_NAME) << JFIELD_CONT
<< JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << JFIELD_CONT
<< JFIELD_STR("link", RTMP_SIG_SRS_URL) << JFIELD_CONT
<< JFIELD_ORG("time", srs_get_system_time_ms())
<< JOBJECT_END
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JFIELD_NAME("server") << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("sigature", RTMP_SIG_SRS_KEY) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("name", RTMP_SIG_SRS_NAME) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("link", RTMP_SIG_SRS_URL) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("time", srs_get_system_time_ms())
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -237,15 +237,15 @@ int SrsApiVersion::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("major", VERSION_MAJOR) << JFIELD_CONT
<< JFIELD_ORG("minor", VERSION_MINOR) << JFIELD_CONT
<< JFIELD_ORG("revision", VERSION_REVISION) << JFIELD_CONT
<< JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("major", VERSION_MAJOR) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("minor", VERSION_MINOR) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("revision", VERSION_REVISION) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -289,29 +289,29 @@ int SrsApiRusages::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
SrsRusage* r = srs_get_system_rusage();
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("ok", (r->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("sample_time", r->sample_time) << JFIELD_CONT
<< JFIELD_ORG("ru_utime", r->r.ru_utime.tv_sec) << JFIELD_CONT
<< JFIELD_ORG("ru_stime", r->r.ru_stime.tv_sec) << JFIELD_CONT
<< JFIELD_ORG("ru_maxrss", r->r.ru_maxrss) << JFIELD_CONT
<< JFIELD_ORG("ru_ixrss", r->r.ru_ixrss) << JFIELD_CONT
<< JFIELD_ORG("ru_idrss", r->r.ru_idrss) << JFIELD_CONT
<< JFIELD_ORG("ru_isrss", r->r.ru_isrss) << JFIELD_CONT
<< JFIELD_ORG("ru_minflt", r->r.ru_minflt) << JFIELD_CONT
<< JFIELD_ORG("ru_majflt", r->r.ru_majflt) << JFIELD_CONT
<< JFIELD_ORG("ru_nswap", r->r.ru_nswap) << JFIELD_CONT
<< JFIELD_ORG("ru_inblock", r->r.ru_inblock) << JFIELD_CONT
<< JFIELD_ORG("ru_oublock", r->r.ru_oublock) << JFIELD_CONT
<< JFIELD_ORG("ru_msgsnd", r->r.ru_msgsnd) << JFIELD_CONT
<< JFIELD_ORG("ru_msgrcv", r->r.ru_msgrcv) << JFIELD_CONT
<< JFIELD_ORG("ru_nsignals", r->r.ru_nsignals) << JFIELD_CONT
<< JFIELD_ORG("ru_nvcsw", r->r.ru_nvcsw) << JFIELD_CONT
<< JFIELD_ORG("ru_nivcsw", r->r.ru_nivcsw)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("ok", (r->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sample_time", r->sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_utime", r->r.ru_utime.tv_sec) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_stime", r->r.ru_stime.tv_sec) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_maxrss", r->r.ru_maxrss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_ixrss", r->r.ru_ixrss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_idrss", r->r.ru_idrss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_isrss", r->r.ru_isrss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_minflt", r->r.ru_minflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_majflt", r->r.ru_majflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_nswap", r->r.ru_nswap) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_inblock", r->r.ru_inblock) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_oublock", r->r.ru_oublock) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_msgsnd", r->r.ru_msgsnd) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_msgrcv", r->r.ru_msgrcv) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_nsignals", r->r.ru_nsignals) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_nvcsw", r->r.ru_nvcsw) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ru_nivcsw", r->r.ru_nivcsw)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -335,58 +335,58 @@ int SrsApiSelfProcStats::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
SrsProcSelfStat* u = srs_get_self_proc_stat();
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("ok", (u->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("sample_time", u->sample_time) << JFIELD_CONT
<< JFIELD_ORG("percent", u->percent) << JFIELD_CONT
<< JFIELD_ORG("pid", u->pid) << JFIELD_CONT
<< JFIELD_STR("comm", u->comm) << JFIELD_CONT
<< JFIELD_STR("state", u->state) << JFIELD_CONT
<< JFIELD_ORG("ppid", u->ppid) << JFIELD_CONT
<< JFIELD_ORG("pgrp", u->pgrp) << JFIELD_CONT
<< JFIELD_ORG("session", u->session) << JFIELD_CONT
<< JFIELD_ORG("tty_nr", u->tty_nr) << JFIELD_CONT
<< JFIELD_ORG("tpgid", u->tpgid) << JFIELD_CONT
<< JFIELD_ORG("flags", u->flags) << JFIELD_CONT
<< JFIELD_ORG("minflt", u->minflt) << JFIELD_CONT
<< JFIELD_ORG("cminflt", u->cminflt) << JFIELD_CONT
<< JFIELD_ORG("majflt", u->majflt) << JFIELD_CONT
<< JFIELD_ORG("cmajflt", u->cmajflt) << JFIELD_CONT
<< JFIELD_ORG("utime", u->utime) << JFIELD_CONT
<< JFIELD_ORG("stime", u->stime) << JFIELD_CONT
<< JFIELD_ORG("cutime", u->cutime) << JFIELD_CONT
<< JFIELD_ORG("cstime", u->cstime) << JFIELD_CONT
<< JFIELD_ORG("priority", u->priority) << JFIELD_CONT
<< JFIELD_ORG("nice", u->nice) << JFIELD_CONT
<< JFIELD_ORG("num_threads", u->num_threads) << JFIELD_CONT
<< JFIELD_ORG("itrealvalue", u->itrealvalue) << JFIELD_CONT
<< JFIELD_ORG("starttime", u->starttime) << JFIELD_CONT
<< JFIELD_ORG("vsize", u->vsize) << JFIELD_CONT
<< JFIELD_ORG("rss", u->rss) << JFIELD_CONT
<< JFIELD_ORG("rsslim", u->rsslim) << JFIELD_CONT
<< JFIELD_ORG("startcode", u->startcode) << JFIELD_CONT
<< JFIELD_ORG("endcode", u->endcode) << JFIELD_CONT
<< JFIELD_ORG("startstack", u->startstack) << JFIELD_CONT
<< JFIELD_ORG("kstkesp", u->kstkesp) << JFIELD_CONT
<< JFIELD_ORG("kstkeip", u->kstkeip) << JFIELD_CONT
<< JFIELD_ORG("signal", u->signal) << JFIELD_CONT
<< JFIELD_ORG("blocked", u->blocked) << JFIELD_CONT
<< JFIELD_ORG("sigignore", u->sigignore) << JFIELD_CONT
<< JFIELD_ORG("sigcatch", u->sigcatch) << JFIELD_CONT
<< JFIELD_ORG("wchan", u->wchan) << JFIELD_CONT
<< JFIELD_ORG("nswap", u->nswap) << JFIELD_CONT
<< JFIELD_ORG("cnswap", u->cnswap) << JFIELD_CONT
<< JFIELD_ORG("exit_signal", u->exit_signal) << JFIELD_CONT
<< JFIELD_ORG("processor", u->processor) << JFIELD_CONT
<< JFIELD_ORG("rt_priority", u->rt_priority) << JFIELD_CONT
<< JFIELD_ORG("policy", u->policy) << JFIELD_CONT
<< JFIELD_ORG("delayacct_blkio_ticks", u->delayacct_blkio_ticks) << JFIELD_CONT
<< JFIELD_ORG("guest_time", u->guest_time) << JFIELD_CONT
<< JFIELD_ORG("cguest_time", u->cguest_time)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("ok", (u->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sample_time", u->sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("percent", u->percent) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("pid", u->pid) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("comm", u->comm) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("state", u->state) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ppid", u->ppid) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("pgrp", u->pgrp) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("session", u->session) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("tty_nr", u->tty_nr) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("tpgid", u->tpgid) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("flags", u->flags) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("minflt", u->minflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cminflt", u->cminflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("majflt", u->majflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cmajflt", u->cmajflt) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("utime", u->utime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("stime", u->stime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cutime", u->cutime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cstime", u->cstime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("priority", u->priority) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("nice", u->nice) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("num_threads", u->num_threads) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("itrealvalue", u->itrealvalue) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("starttime", u->starttime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("vsize", u->vsize) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("rss", u->rss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("rsslim", u->rsslim) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("startcode", u->startcode) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("endcode", u->endcode) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("startstack", u->startstack) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("kstkesp", u->kstkesp) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("kstkeip", u->kstkeip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("signal", u->signal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("blocked", u->blocked) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sigignore", u->sigignore) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sigcatch", u->sigcatch) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("wchan", u->wchan) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("nswap", u->nswap) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cnswap", u->cnswap) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("exit_signal", u->exit_signal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("processor", u->processor) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("rt_priority", u->rt_priority) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("policy", u->policy) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("delayacct_blkio_ticks", u->delayacct_blkio_ticks) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("guest_time", u->guest_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cguest_time", u->cguest_time)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -410,23 +410,23 @@ int SrsApiSystemProcStats::do_process_request(SrsSocket* skt, SrsHttpMessage* re
SrsProcSystemStat* s = srs_get_system_proc_stat();
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("ok", (s->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("sample_time", s->sample_time) << JFIELD_CONT
<< JFIELD_ORG("percent", s->percent) << JFIELD_CONT
<< JFIELD_ORG("user", s->user) << JFIELD_CONT
<< JFIELD_ORG("nice", s->nice) << JFIELD_CONT
<< JFIELD_ORG("sys", s->sys) << JFIELD_CONT
<< JFIELD_ORG("idle", s->idle) << JFIELD_CONT
<< JFIELD_ORG("iowait", s->iowait) << JFIELD_CONT
<< JFIELD_ORG("irq", s->irq) << JFIELD_CONT
<< JFIELD_ORG("softirq", s->softirq) << JFIELD_CONT
<< JFIELD_ORG("steal", s->steal) << JFIELD_CONT
<< JFIELD_ORG("guest", s->guest)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("ok", (s->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sample_time", s->sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("percent", s->percent) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("user", s->user) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("nice", s->nice) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sys", s->sys) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("idle", s->idle) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("iowait", s->iowait) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("irq", s->irq) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("softirq", s->softirq) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("steal", s->steal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("guest", s->guest)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -450,24 +450,24 @@ int SrsApiMemInfos::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
SrsMemInfo* m = srs_get_meminfo();
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("ok", (m->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("sample_time", m->sample_time) << JFIELD_CONT
<< JFIELD_ORG("percent_ram", m->percent_ram) << JFIELD_CONT
<< JFIELD_ORG("percent_swap", m->percent_swap) << JFIELD_CONT
<< JFIELD_ORG("MemActive", m->MemActive) << JFIELD_CONT
<< JFIELD_ORG("RealInUse", m->RealInUse) << JFIELD_CONT
<< JFIELD_ORG("NotInUse", m->NotInUse) << JFIELD_CONT
<< JFIELD_ORG("MemTotal", m->MemTotal) << JFIELD_CONT
<< JFIELD_ORG("MemFree", m->MemFree) << JFIELD_CONT
<< JFIELD_ORG("Buffers", m->Buffers) << JFIELD_CONT
<< JFIELD_ORG("Cached", m->Cached) << JFIELD_CONT
<< JFIELD_ORG("SwapTotal", m->SwapTotal) << JFIELD_CONT
<< JFIELD_ORG("SwapFree", m->SwapFree)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("ok", (m->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("sample_time", m->sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("percent_ram", m->percent_ram) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("percent_swap", m->percent_swap) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("MemActive", m->MemActive) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("RealInUse", m->RealInUse) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("NotInUse", m->NotInUse) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("MemTotal", m->MemTotal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("MemFree", m->MemFree) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("Buffers", m->Buffers) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("Cached", m->Cached) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("SwapTotal", m->SwapTotal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("SwapFree", m->SwapFree)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ... @@ -489,14 +489,14 @@ int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT
<< JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT
<< JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
return res_json(skt, req, ss.str());
}
... ...
... ... @@ -63,15 +63,15 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_connect") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("tcUrl", req->tcUrl) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_connect") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("tcUrl", req->tcUrl) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -109,14 +109,14 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_close") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_close") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -154,15 +154,15 @@ int SrsHttpHooks::on_publish(string url, int client_id, string ip, SrsRequest* r
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_publish") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_publish") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -200,15 +200,15 @@ void SrsHttpHooks::on_unpublish(string url, int client_id, string ip, SrsRequest
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_unpublish") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_unpublish") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -246,15 +246,15 @@ int SrsHttpHooks::on_play(string url, int client_id, string ip, SrsRequest* req)
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_play") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_play") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -292,15 +292,15 @@ void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_stop") << JFIELD_CONT
<< JFIELD_ORG("client_id", client_id) << JFIELD_CONT
<< JFIELD_STR("ip", ip) << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("pageUrl", req->pageUrl) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream)
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_stop") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream)
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -342,16 +342,16 @@ void SrsHttpHooks::on_dvr_hss_reap_flv_header(std::string url, SrsRequest* req,
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_dvr_hss_reap_flv_header") << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream) << JFIELD_CONT
<< JFIELD_NAME("segment") << JOBJECT_START
<< JFIELD_STR("cwd", _srs_config->cwd()) << JFIELD_CONT
<< JFIELD_STR("path", header_file)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_dvr_hss_reap_flv_header") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_NAME("segment") << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("path", header_file)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ... @@ -395,20 +395,20 @@ void SrsHttpHooks::on_dvr_hss_reap_flv(string url, SrsRequest* req, SrsFlvSegmen
}
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_STR("action", "on_dvr_hss_reap_flv") << JFIELD_CONT
<< JFIELD_STR("vhost", req->vhost) << JFIELD_CONT
<< JFIELD_STR("app", req->app) << JFIELD_CONT
<< JFIELD_STR("stream", req->stream) << JFIELD_CONT
<< JFIELD_NAME("segment") << JOBJECT_START
<< JFIELD_STR("cwd", _srs_config->cwd()) << JFIELD_CONT
<< JFIELD_STR("path", segment->path) << JFIELD_CONT
<< JFIELD_ORG("duration", segment->duration) << JFIELD_CONT
<< JFIELD_ORG("offset", segment->sequence_header_offset) << JFIELD_CONT
<< JFIELD_ORG("has_keyframe", (segment->has_keyframe? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("pts", segment->stream_starttime + segment->starttime)
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("action", "on_dvr_hss_reap_flv") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_NAME("segment") << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("path", segment->path) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("duration", segment->duration) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("offset", segment->sequence_header_offset) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("has_keyframe", (segment->has_keyframe? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("pts", segment->stream_starttime + segment->starttime)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
std::string data = ss.str();
std::string res;
... ...
... ... @@ -172,16 +172,16 @@ public:
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/* json encode
cout<< JOBJECT_START
<< JFIELD_STR("name", "srs") << JFIELD_CONT
<< JFIELD_ORG("version", 100) << JFIELD_CONT
<< JFIELD_NAME("features") << JOBJECT_START
<< JFIELD_STR("rtmp", "released") << JFIELD_CONT
<< JFIELD_STR("hls", "released") << JFIELD_CONT
<< JFIELD_STR("dash", "plan")
<< JOBJECT_END << JFIELD_CONT
<< JFIELD_STR("author", "srs team")
<< JOBJECT_END
cout<< __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("name", "srs") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("version", 100) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_NAME("features") << __SRS_JOBJECT_START
<< __SRS_JFIELD_STR("rtmp", "released") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("hls", "released") << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("dash", "plan")
<< __SRS_JOBJECT_END << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("author", "srs team")
<< __SRS_JOBJECT_END
it's:
cont<< "{"
<< "name:" << "srs" << ","
... ... @@ -210,14 +210,14 @@ that is:
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#define JOBJECT_START "{"
#define JFIELD_NAME(k) "\"" << k << "\":"
#define JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
#define JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
#define JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
#define JFIELD_CONT ","
#define JOBJECT_END "}"
#define JARRAY_START "["
#define JARRAY_END "]"
#define __SRS_JOBJECT_START "{"
#define __SRS_JFIELD_NAME(k) "\"" << k << "\":"
#define __SRS_JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
#define __SRS_JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
#define __SRS_JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
#define __SRS_JFIELD_CONT ","
#define __SRS_JOBJECT_END "}"
#define __SRS_JARRAY_START "["
#define __SRS_JARRAY_END "]"
#endif
\ No newline at end of file
... ...
... ... @@ -821,56 +821,56 @@ void srs_api_dump_summaries(std::stringstream& ss)
n_sample_time = o.sample_time;
}
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_ORG("rusage_ok", (r->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("self_cpu_stat_ok", (u->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("system_cpu_stat_ok", (s->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("cpuinfo_ok", (c->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("meminfo_ok", (m->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("platform_ok", (p->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("network_ok", (n_ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("network_srs_ok", (nrs->ok? "true":"false")) << JFIELD_CONT
<< JFIELD_ORG("now_ms", now) << JFIELD_CONT
<< JFIELD_ORG("self", JOBJECT_START)
<< JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << JFIELD_CONT
<< JFIELD_ORG("pid", getpid()) << JFIELD_CONT
<< JFIELD_ORG("ppid", u->ppid) << JFIELD_CONT
<< JFIELD_STR("argv", _srs_config->argv()) << JFIELD_CONT
<< JFIELD_STR("cwd", _srs_config->cwd()) << JFIELD_CONT
<< JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << JFIELD_CONT
<< JFIELD_ORG("mem_percent", self_mem_percent) << JFIELD_CONT
<< JFIELD_ORG("cpu_percent", u->percent) << JFIELD_CONT
<< JFIELD_ORG("srs_uptime", srs_uptime)
<< JOBJECT_END << JFIELD_CONT
<< JFIELD_ORG("system", JOBJECT_START)
<< JFIELD_ORG("cpu_percent", s->percent) << JFIELD_CONT
<< JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << JFIELD_CONT
<< JFIELD_ORG("mem_ram_percent", m->percent_ram) << JFIELD_CONT
<< JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << JFIELD_CONT
<< JFIELD_ORG("mem_swap_percent", m->percent_swap) << JFIELD_CONT
<< JFIELD_ORG("cpus", c->nb_processors) << JFIELD_CONT
<< JFIELD_ORG("cpus_online", c->nb_processors_online) << JFIELD_CONT
<< JFIELD_ORG("uptime", p->os_uptime) << JFIELD_CONT
<< JFIELD_ORG("ilde_time", p->os_ilde_time) << JFIELD_CONT
<< JFIELD_ORG("load_1m", p->load_one_minutes) << JFIELD_CONT
<< JFIELD_ORG("load_5m", p->load_five_minutes) << JFIELD_CONT
<< JFIELD_ORG("load_15m", p->load_fifteen_minutes) << JFIELD_CONT
<< JFIELD_ORG("net_sample_time", n_sample_time) << JFIELD_CONT
<< JFIELD_ORG("net_recv_bytes", nr_bytes) << JFIELD_CONT
<< JFIELD_ORG("net_send_bytes", ns_bytes) << JFIELD_CONT
<< JFIELD_ORG("srs_sample_time", nrs->sample_time) << JFIELD_CONT
<< JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << JFIELD_CONT
<< JFIELD_ORG("srs_recv_kbps", nrs->rkbps) << JFIELD_CONT
<< JFIELD_ORG("srs_send_bytes", nrs->sbytes) << JFIELD_CONT
<< JFIELD_ORG("srs_send_kbps", nrs->skbps) << JFIELD_CONT
<< JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << JFIELD_CONT
<< JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << JFIELD_CONT
<< JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << JFIELD_CONT
<< JFIELD_ORG("conn_sys_ls", nrs->nb_conn_sys_ls) << JFIELD_CONT
<< JFIELD_ORG("conn_srs", nrs->nb_conn_srs)
<< JOBJECT_END
<< JOBJECT_END
<< JOBJECT_END;
ss << __SRS_JOBJECT_START
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("rusage_ok", (r->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("self_cpu_stat_ok", (u->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("system_cpu_stat_ok", (s->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cpuinfo_ok", (c->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("meminfo_ok", (m->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("platform_ok", (p->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("network_ok", (n_ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("network_srs_ok", (nrs->ok? "true":"false")) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("now_ms", now) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("self", __SRS_JOBJECT_START)
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("pid", getpid()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ppid", u->ppid) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("argv", _srs_config->argv()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_percent", self_mem_percent) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cpu_percent", u->percent) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_uptime", srs_uptime)
<< __SRS_JOBJECT_END << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("system", __SRS_JOBJECT_START)
<< __SRS_JFIELD_ORG("cpu_percent", s->percent) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_ram_percent", m->percent_ram) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("mem_swap_percent", m->percent_swap) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cpus", c->nb_processors) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("cpus_online", c->nb_processors_online) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("uptime", p->os_uptime) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("ilde_time", p->os_ilde_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("load_1m", p->load_one_minutes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("load_5m", p->load_five_minutes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("load_15m", p->load_fifteen_minutes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("net_sample_time", n_sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("net_recv_bytes", nr_bytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("net_send_bytes", ns_bytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_sample_time", nrs->sample_time) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_recv_kbps", nrs->rkbps) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_send_bytes", nrs->sbytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("srs_send_kbps", nrs->skbps) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("conn_sys_ls", nrs->nb_conn_sys_ls) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("conn_srs", nrs->nb_conn_srs)
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END
<< __SRS_JOBJECT_END;
}
... ...