修改常量命名

This commit is contained in:
ziyue 2021-10-16 16:58:03 +08:00
parent 8769ea83a9
commit f5f58196b5
12 changed files with 19 additions and 19 deletions

View File

@ -138,7 +138,7 @@ onceToken token([](){
"<body bgcolor=\"white\">"
"<center><h1>您访问的资源不存在!</h1></center>"
"<hr><center>"
<< SERVER_NAME
<< kServerName
<< "</center>"
"</body>"
"</html>"

View File

@ -37,9 +37,9 @@ void printArgs(std::ostream &out) {}
//请遵循MIT协议勿修改服务器声明
#if !defined(ENABLE_VERSION)
const char SERVER_NAME[] = "ZLMediaKit-6.0(build in " __DATE__ " " __TIME__ ")";
const char kServerName[] = "ZLMediaKit-6.0(build in " __DATE__ " " __TIME__ ")";
#else
const char SERVER_NAME[] = "ZLMediaKit(git hash:" COMMIT_HASH ",branch:" BRANCH_NAME ",build time:" __DATE__ " " __TIME__ ")";
const char kServerName[] = "ZLMediaKit(git hash:" COMMIT_HASH ",branch:" BRANCH_NAME ",build time:" __DATE__ " " __TIME__ ")";
#endif
}//namespace mediakit

View File

@ -74,7 +74,7 @@ extern void Assert_Throw(int failed, const char *exp, const char *func, const ch
namespace mediakit {
extern const char SERVER_NAME[];
extern const char kServerName[];
void printArgs(std::ostream &out);

View File

@ -49,7 +49,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) {
host = FindField(host.data(), NULL, ":");
}
_header.emplace("Host", host_header);
_header.emplace("Tools", SERVER_NAME);
_header.emplace("Tools", kServerName);
_header.emplace("Connection", "keep-alive");
_header.emplace("Accept", "*/*");
_header.emplace("Accept-Language", "zh-CN,zh;q=0.8");

View File

@ -537,7 +537,7 @@ void HttpSession::sendResponse(int code,
HttpSession::KeyValue &headerOut = const_cast<HttpSession::KeyValue &>(header);
headerOut.emplace(kDate, dateStr());
headerOut.emplace(kServer, SERVER_NAME);
headerOut.emplace(kServer, kServerName);
headerOut.emplace(kConnection, bClose ? "close" : "keep-alive");
if(!bClose){
string keepAliveString = "timeout=";

View File

@ -306,7 +306,7 @@ public:
const map<string,string> &header = map<string,string>()){
_metadata.set("duration", dur_sec);
_metadata.set("fileSize", (int)fileSize);
_metadata.set("server",SERVER_NAME);
_metadata.set("server",kServerName);
for (auto &pr : header){
_metadata.set(pr.first, pr.second);
}

View File

@ -101,7 +101,7 @@ public:
*/
virtual void setMetaData(const AMFValue &metadata) {
_metadata = metadata;
_metadata.set("server", SERVER_NAME);
_metadata.set("server", kServerName);
_have_video = _metadata["videocodecid"];
_have_audio = _metadata["audiocodecid"];
if (_ring) {

View File

@ -346,7 +346,7 @@ public:
}
} else {
_printer << "o=- 0 0 IN IP4 0.0.0.0\r\n";
_printer << "s=Streamed by " << SERVER_NAME << "\r\n";
_printer << "s=Streamed by " << kServerName << "\r\n";
_printer << "c=IN IP4 0.0.0.0\r\n";
_printer << "t=0 0\r\n";
}

View File

@ -551,7 +551,7 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std
void RtspPlayer::sendRtspRequest(const string &cmd, const string &url,const StrCaseMap &header_const) {
auto header = header_const;
header.emplace("CSeq",StrPrinter << _cseq_send++);
header.emplace("User-Agent",SERVER_NAME);
header.emplace("User-Agent",kServerName);
if(!_session_id.empty()){
header.emplace("Session", _session_id);
@ -637,7 +637,7 @@ void RtspPlayer::onBeforeRtpSorted(const RtpPacket::Ptr &rtp, int track_idx){
auto ssrc = rtp->getSSRC();
auto rtcp = rtcp_ctx->createRtcpRR(ssrc + 1, ssrc);
auto rtcp_sdes = RtcpSdes::create({SERVER_NAME});
auto rtcp_sdes = RtcpSdes::create({kServerName});
rtcp_sdes->chunks.type = (uint8_t) SdesType::RTCP_SDES_CNAME;
rtcp_sdes->chunks.ssrc = htonl(ssrc);
send_rtcp(this, track_idx, std::move(rtcp));

View File

@ -377,7 +377,7 @@ void RtspPusher::updateRtcpContext(const RtpPacket::Ptr &rtp){
auto ssrc = rtp->getSSRC();
auto rtcp = rtcp_ctx->createRtcpSR(ssrc + 1);
auto rtcp_sdes = RtcpSdes::create({SERVER_NAME});
auto rtcp_sdes = RtcpSdes::create({kServerName});
rtcp_sdes->chunks.type = (uint8_t) SdesType::RTCP_SDES_CNAME;
rtcp_sdes->chunks.ssrc = htonl(ssrc);
send_rtcp(this, track_index, std::move(rtcp));
@ -511,7 +511,7 @@ void RtspPusher::sendRtspRequest(const string &cmd, const string &url, const std
void RtspPusher::sendRtspRequest(const string &cmd, const string &url,const StrCaseMap &header_const,const string &sdp ) {
auto header = header_const;
header.emplace("CSeq", StrPrinter << _cseq++);
header.emplace("User-Agent", SERVER_NAME);
header.emplace("User-Agent", kServerName);
if (!_session_id.empty()) {
header.emplace("Session", _session_id);

View File

@ -1028,7 +1028,7 @@ bool RtspSession::sendRtspResponse(const string &res_code, const StrCaseMap &hea
header.emplace("Session", _sessionid);
}
header.emplace("Server",SERVER_NAME);
header.emplace("Server",kServerName);
header.emplace("Date",dateStr());
if(!sdp.empty()){
@ -1163,7 +1163,7 @@ void RtspSession::updateRtcpContext(const RtpPacket::Ptr &rtp){
auto ssrc = rtp->getSSRC();
auto rtcp = _push_src ? rtcp_ctx->createRtcpRR(ssrc + 1, ssrc) : rtcp_ctx->createRtcpSR(ssrc);
auto rtcp_sdes = RtcpSdes::create({SERVER_NAME});
auto rtcp_sdes = RtcpSdes::create({kServerName});
rtcp_sdes->chunks.type = (uint8_t)SdesType::RTCP_SDES_CNAME;
rtcp_sdes->chunks.ssrc = htonl(ssrc);
send_rtcp(this, track_index, std::move(rtcp));

View File

@ -91,7 +91,7 @@ inline bool ShellSession::onCommandLine(const string& line) {
inline void ShellSession::pleaseInputUser() {
SockSender::send("\033[0m");
SockSender::send(StrPrinter << SERVER_NAME << " login: " << endl);
SockSender::send(StrPrinter << kServerName << " login: " << endl);
_loginInterceptor = [this](const string &user_name) {
_strUserName=user_name;
pleaseInputPasswd();
@ -108,14 +108,14 @@ inline void ShellSession::pleaseInputPasswd() {
<< "\033[0mAuth failed("
<< errMessage
<< "), please try again.\r\n"
<< _strUserName << "@" << SERVER_NAME
<< _strUserName << "@" << kServerName
<< "'s password: \033[8m"
<< endl);
return;
}
SockSender::send("\033[0m");
SockSender::send("-----------------------------------------\r\n");
SockSender::send(StrPrinter<<"欢迎来到"<<SERVER_NAME<<", 你可输入\"help\"查看帮助.\r\n"<<endl);
SockSender::send(StrPrinter<<"欢迎来到"<<kServerName<<", 你可输入\"help\"查看帮助.\r\n"<<endl);
SockSender::send("-----------------------------------------\r\n");
printShellPrefix();
_loginInterceptor=nullptr;
@ -146,7 +146,7 @@ inline void ShellSession::pleaseInputPasswd() {
}
inline void ShellSession::printShellPrefix() {
SockSender::send(StrPrinter << _strUserName << "@" << SERVER_NAME << "# " << endl);
SockSender::send(StrPrinter << _strUserName << "@" << kServerName << "# " << endl);
}
}/* namespace mediakit */