mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-06 03:28:09 +08:00
shell登录鉴权改成广播方式
删除rtsp/rtmp shell命令,添加media命令 加载配置文件后发送广播
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <Util/NoticeCenter.h>
|
||||
#include "Common/config.h"
|
||||
#include "Util/util.h"
|
||||
#include "Util/onceToken.h"
|
||||
@@ -33,12 +34,20 @@ using namespace ZL::Network;
|
||||
|
||||
namespace Config {
|
||||
|
||||
void loadIniConfig(){
|
||||
auto &ini = ZL::Util::mINI::Instance();
|
||||
bool loadIniConfig(const char *ini_path){
|
||||
string ini;
|
||||
if(ini_path){
|
||||
ini = ini_path;
|
||||
}else{
|
||||
ini = exePath() + ".ini";
|
||||
}
|
||||
try{
|
||||
ini.parseFile(exePath() + ".ini");
|
||||
mINI::Instance().parseFile(ini);
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastUpdateConfig);
|
||||
return true;
|
||||
}catch (std::exception &ex) {
|
||||
ini.dumpFile(exePath() + ".ini");
|
||||
mINI::Instance().dumpFile(ini);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
////////////广播名称///////////
|
||||
@@ -51,7 +60,11 @@ const char kBroadcastOnRtspAuth[] = "kBroadcastOnRtspAuth";
|
||||
const char kBroadcastMediaPlayed[] = "kBroadcastMediaPlayed";
|
||||
const char kBroadcastRtmpPublish[] = "kBroadcastRtmpPublish";
|
||||
const char kBroadcastFlowReport[] = "kBroadcastFlowReport";
|
||||
const char kFlowThreshold[] = "Broadcast.flowThreshold";
|
||||
const char kBroadcastUpdateConfig[] = "kBroadcastUpdateConfig";
|
||||
const char kBroadcastShellLogin[] = "kBroadcastShellLogin";
|
||||
|
||||
const char kFlowThreshold[] = "broadcast.flowThreshold";
|
||||
|
||||
onceToken token([](){
|
||||
mINI::Instance()[kFlowThreshold] = 1024;
|
||||
},nullptr);
|
||||
|
||||
@@ -29,13 +29,19 @@
|
||||
#define COMMON_CONFIG_H
|
||||
|
||||
#include "Util/mini.h"
|
||||
#include "Util/onceToken.h"
|
||||
#include <functional>
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
|
||||
namespace Config {
|
||||
|
||||
void loadIniConfig();
|
||||
//加载配置文件,如果配置文件不存在,那么会导出默认配置并生成配置文件
|
||||
//加载配置文件成功后会触发kBroadcastUpdateConfig广播
|
||||
//如果指定的文件名(ini_path)为空,那么会加载默认配置文件
|
||||
//默认配置文件名为 /path/to/your/exe.ini
|
||||
//加载配置文件成功后返回true,否则返回false
|
||||
bool loadIniConfig(const char *ini_path = nullptr);
|
||||
////////////TCP最大连接数///////////
|
||||
#define MAX_TCP_SESSION 100000
|
||||
////////////其他宏定义///////////
|
||||
@@ -96,12 +102,22 @@ extern const char kBroadcastRtmpPublish[];
|
||||
extern const char kBroadcastMediaPlayed[];
|
||||
#define BroadcastMediaPlayedArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker
|
||||
|
||||
//shell登录鉴权
|
||||
extern const char kBroadcastShellLogin[];
|
||||
#define BroadcastShellLoginArgs const string &user_name,const string &passwd,const Broadcast::AuthInvoker &invoker
|
||||
|
||||
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播
|
||||
extern const char kBroadcastFlowReport[];
|
||||
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes
|
||||
|
||||
//流量汇报事件流量阈值,单位KB,默认1MB
|
||||
extern const char kFlowThreshold[];
|
||||
|
||||
//更新配置文件事件广播,执行loadIniConfig函数加载配置文件成功后会触发该广播
|
||||
extern const char kBroadcastUpdateConfig[];
|
||||
#define BroadcastUpdateConfigArgs void
|
||||
#define ReloadConfigTag ((void *)(0xFF))
|
||||
|
||||
} //namespace Broadcast
|
||||
|
||||
////////////HTTP配置///////////
|
||||
|
||||
Reference in New Issue
Block a user