2017-10-09 22:11:01 +08:00
|
|
|
|
/*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
2017-09-27 16:20:30 +08:00
|
|
|
|
*
|
2021-01-17 18:31:50 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
2017-09-27 16:20:30 +08:00
|
|
|
|
*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2017-09-27 16:20:30 +08:00
|
|
|
|
*/
|
|
|
|
|
|
2017-04-01 16:35:56 +08:00
|
|
|
|
|
2018-02-02 18:06:08 +08:00
|
|
|
|
#ifndef COMMON_CONFIG_H
|
|
|
|
|
#define COMMON_CONFIG_H
|
2017-04-01 16:35:56 +08:00
|
|
|
|
|
2018-02-09 11:42:55 +08:00
|
|
|
|
#include <functional>
|
2017-04-25 11:35:41 +08:00
|
|
|
|
#include "Util/mini.h"
|
2018-02-08 17:24:42 +08:00
|
|
|
|
#include "Util/onceToken.h"
|
2018-02-09 11:42:55 +08:00
|
|
|
|
#include "Util/NoticeCenter.h"
|
2021-06-28 20:29:56 +08:00
|
|
|
|
#include "macros.h"
|
2018-02-09 11:42:55 +08:00
|
|
|
|
|
2018-02-05 16:28:15 +08:00
|
|
|
|
using namespace std;
|
2018-10-24 17:17:55 +08:00
|
|
|
|
using namespace toolkit;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
|
2021-06-28 20:12:07 +08:00
|
|
|
|
namespace mediakit {
|
|
|
|
|
|
|
|
|
|
//加载配置文件,如果配置文件不存在,那么会导出默认配置并生成配置文件
|
|
|
|
|
//加载配置文件成功后会触发kBroadcastUpdateConfig广播
|
|
|
|
|
//如果指定的文件名(ini_path)为空,那么会加载默认配置文件
|
|
|
|
|
//默认配置文件名为 /path/to/your/exe.ini
|
|
|
|
|
//加载配置文件成功后返回true,否则返回false
|
|
|
|
|
bool loadIniConfig(const char *ini_path = nullptr);
|
|
|
|
|
|
2017-04-01 16:35:56 +08:00
|
|
|
|
////////////广播名称///////////
|
|
|
|
|
namespace Broadcast {
|
2017-04-10 17:24:06 +08:00
|
|
|
|
|
2018-02-05 15:56:44 +08:00
|
|
|
|
//注册或反注册MediaSource事件广播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastMediaChanged;
|
2019-12-24 14:08:16 +08:00
|
|
|
|
#define BroadcastMediaChangedArgs const bool &bRegist, MediaSource &sender
|
2017-04-10 17:24:06 +08:00
|
|
|
|
|
2018-02-05 15:56:44 +08:00
|
|
|
|
//录制mp4文件成功后广播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastRecordMP4;
|
2020-09-15 19:09:26 +08:00
|
|
|
|
#define BroadcastRecordMP4Args const RecordInfo &info
|
2017-04-10 17:24:06 +08:00
|
|
|
|
|
2020-09-13 14:08:05 +08:00
|
|
|
|
// 录制 ts 文件后广播
|
|
|
|
|
extern const string kBroadcastRecordTs;
|
2020-09-15 19:09:26 +08:00
|
|
|
|
#define BroadcastRecordTsArgs const RecordInfo &info
|
2020-09-13 14:08:05 +08:00
|
|
|
|
|
2018-02-05 15:56:44 +08:00
|
|
|
|
//收到http api请求广播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastHttpRequest;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastHttpRequestArgs const Parser &parser,const HttpSession::HttpResponseInvoker &invoker,bool &consumed,SockInfo &sender
|
2017-04-10 17:24:06 +08:00
|
|
|
|
|
2019-12-23 12:47:04 +08:00
|
|
|
|
//在http文件服务器中,收到http访问文件或目录的广播,通过该事件控制访问http目录的权限
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastHttpAccess;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastHttpAccessArgs const Parser &parser,const string &path,const bool &is_dir,const HttpSession::HttpAccessPathInvoker &invoker,SockInfo &sender
|
2019-06-12 17:53:48 +08:00
|
|
|
|
|
2019-12-23 12:47:04 +08:00
|
|
|
|
//在http文件服务器中,收到http访问文件或目录前的广播,通过该事件可以控制http url到文件路径的映射
|
|
|
|
|
//在该事件中通过自行覆盖path参数,可以做到譬如根据虚拟主机或者app选择不同http根目录的目的
|
|
|
|
|
extern const string kBroadcastHttpBeforeAccess;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastHttpBeforeAccessArgs const Parser &parser,string &path,SockInfo &sender
|
2019-12-23 12:47:04 +08:00
|
|
|
|
|
2017-12-10 01:34:43 +08:00
|
|
|
|
//该流是否需要认证?是的话调用invoker并传入realm,否则传入空的realm.如果该事件不监听则不认证
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastOnGetRtspRealm;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastOnGetRtspRealmArgs const MediaInfo &args,const RtspSession::onGetRealm &invoker,SockInfo &sender
|
2017-12-10 01:34:43 +08:00
|
|
|
|
|
|
|
|
|
//请求认证用户密码事件,user_name为用户名,must_no_encrypt如果为true,则必须提供明文密码(因为此时是base64认证方式),否则会导致认证失败
|
|
|
|
|
//获取到密码后请调用invoker并输入对应类型的密码和密码类型,invoker执行时会匹配密码
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastOnRtspAuth;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastOnRtspAuthArgs const MediaInfo &args,const string &realm,const string &user_name,const bool &must_no_encrypt,const RtspSession::onAuth &invoker,SockInfo &sender
|
2018-02-05 15:56:44 +08:00
|
|
|
|
|
2019-09-10 11:06:31 +08:00
|
|
|
|
//推流鉴权结果回调对象
|
2018-02-06 16:17:37 +08:00
|
|
|
|
//如果errMessage为空则代表鉴权成功
|
2019-09-10 11:06:31 +08:00
|
|
|
|
//enableHls: 是否允许转换hls
|
|
|
|
|
//enableMP4: 是否运行MP4录制
|
2020-09-12 19:09:56 +08:00
|
|
|
|
typedef std::function<void(const string &errMessage, bool enableHls, bool enableMP4)> PublishAuthInvoker;
|
2018-02-05 15:56:44 +08:00
|
|
|
|
|
2018-12-14 17:10:24 +08:00
|
|
|
|
//收到rtsp/rtmp推流事件广播,通过该事件控制推流鉴权
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastMediaPublish;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastMediaPublishArgs const MediaInfo &args,const Broadcast::PublishAuthInvoker &invoker,SockInfo &sender
|
2019-09-10 11:06:31 +08:00
|
|
|
|
|
|
|
|
|
//播放鉴权结果回调对象
|
|
|
|
|
//如果errMessage为空则代表鉴权成功
|
|
|
|
|
typedef std::function<void(const string &errMessage)> AuthInvoker;
|
2018-12-14 17:10:24 +08:00
|
|
|
|
|
2018-02-06 15:28:27 +08:00
|
|
|
|
//播放rtsp/rtmp/http-flv事件广播,通过该事件控制播放鉴权
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastMediaPlayed;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastMediaPlayedArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker,SockInfo &sender
|
2018-02-05 15:56:44 +08:00
|
|
|
|
|
2018-02-08 17:24:42 +08:00
|
|
|
|
//shell登录鉴权
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastShellLogin;
|
2020-04-23 21:38:44 +08:00
|
|
|
|
#define BroadcastShellLoginArgs const string &user_name,const string &passwd,const Broadcast::AuthInvoker &invoker,SockInfo &sender
|
2018-02-08 17:24:42 +08:00
|
|
|
|
|
2018-02-06 15:28:27 +08:00
|
|
|
|
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastFlowReport;
|
2020-04-23 22:04:59 +08:00
|
|
|
|
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer, SockInfo &sender
|
2018-02-06 15:28:27 +08:00
|
|
|
|
|
2018-10-31 12:11:14 +08:00
|
|
|
|
//未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastNotFoundStream;
|
2020-07-16 16:00:31 +08:00
|
|
|
|
#define BroadcastNotFoundStreamArgs const MediaInfo &args,SockInfo &sender, const function<void()> &closePlayer
|
2018-10-31 12:11:14 +08:00
|
|
|
|
|
2019-05-27 18:39:43 +08:00
|
|
|
|
//某个流无人消费时触发,目的为了实现无人观看时主动断开拉流等业务逻辑
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastStreamNoneReader;
|
2019-05-27 18:39:43 +08:00
|
|
|
|
#define BroadcastStreamNoneReaderArgs MediaSource &sender
|
|
|
|
|
|
2018-02-08 17:24:42 +08:00
|
|
|
|
//更新配置文件事件广播,执行loadIniConfig函数加载配置文件成功后会触发该广播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBroadcastReloadConfig;
|
2018-02-09 11:42:55 +08:00
|
|
|
|
#define BroadcastReloadConfigArgs void
|
2018-02-08 17:24:42 +08:00
|
|
|
|
|
2019-05-28 17:14:36 +08:00
|
|
|
|
#define ReloadConfigTag ((void *)(0xFF))
|
2021-08-27 11:05:26 +08:00
|
|
|
|
#define RELOAD_KEY(arg,key) \
|
|
|
|
|
do { \
|
|
|
|
|
decltype(arg) arg##_tmp = mINI::Instance()[key]; \
|
|
|
|
|
if (arg == arg##_tmp) { \
|
|
|
|
|
return; \
|
|
|
|
|
} \
|
|
|
|
|
arg = arg##_tmp; \
|
|
|
|
|
InfoL << "reload config:" << key << "=" << arg; \
|
|
|
|
|
} while(0)
|
2018-02-09 11:42:55 +08:00
|
|
|
|
|
|
|
|
|
//监听某个配置发送变更
|
2021-08-27 11:05:26 +08:00
|
|
|
|
#define LISTEN_RELOAD_KEY(arg, key, ...) \
|
|
|
|
|
do { \
|
|
|
|
|
static onceToken s_token_listen([](){ \
|
|
|
|
|
NoticeCenter::Instance().addListener(ReloadConfigTag, \
|
|
|
|
|
Broadcast::kBroadcastReloadConfig,[](BroadcastReloadConfigArgs) { \
|
|
|
|
|
__VA_ARGS__; \
|
|
|
|
|
}); \
|
|
|
|
|
}); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define GET_CONFIG(type, arg, key) \
|
|
|
|
|
static type arg = mINI::Instance()[key]; \
|
|
|
|
|
LISTEN_RELOAD_KEY(arg, key, { \
|
|
|
|
|
RELOAD_KEY(arg, key); \
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
#define GET_CONFIG_FUNC(type, arg, key, ...) \
|
|
|
|
|
static type arg; \
|
|
|
|
|
do { \
|
|
|
|
|
static onceToken s_token_set([](){ \
|
|
|
|
|
static auto lam = __VA_ARGS__ ; \
|
|
|
|
|
static auto arg##_str = mINI::Instance()[key]; \
|
|
|
|
|
arg = lam(arg##_str); \
|
|
|
|
|
LISTEN_RELOAD_KEY(arg, key, { \
|
|
|
|
|
RELOAD_KEY(arg##_str, key); \
|
|
|
|
|
arg = lam(arg##_str); \
|
|
|
|
|
}); \
|
|
|
|
|
}); \
|
|
|
|
|
} while(0)
|
2018-02-09 11:42:55 +08:00
|
|
|
|
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Broadcast
|
|
|
|
|
|
2019-05-28 17:14:36 +08:00
|
|
|
|
////////////通用配置///////////
|
|
|
|
|
namespace General{
|
2020-09-28 10:45:59 +08:00
|
|
|
|
//每个流媒体服务器的ID(GUID)
|
|
|
|
|
extern const string kMediaServerId;
|
2019-05-28 17:14:36 +08:00
|
|
|
|
//流量汇报事件流量阈值,单位KB,默认1MB
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kFlowThreshold;
|
2019-05-28 17:14:36 +08:00
|
|
|
|
//流无人观看并且超过若干时间后才触发kBroadcastStreamNoneReader事件
|
|
|
|
|
//默认连续5秒无人观看然后触发kBroadcastStreamNoneReader事件
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kStreamNoneReaderDelayMS;
|
2019-05-28 17:14:36 +08:00
|
|
|
|
//等待流注册超时时间,收到播放器后请求后,如果未找到相关流,服务器会等待一定时间,
|
|
|
|
|
//如果在这个时间内,相关流注册上了,那么服务器会立即响应播放器播放成功,
|
|
|
|
|
//否则会最多等待kMaxStreamWaitTimeMS毫秒,然后响应播放器播放失败
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kMaxStreamWaitTimeMS;
|
2019-05-28 17:14:36 +08:00
|
|
|
|
//是否启动虚拟主机
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kEnableVhost;
|
2019-09-29 10:33:05 +08:00
|
|
|
|
//拉流代理时是否添加静音音频
|
|
|
|
|
extern const string kAddMuteAudio;
|
2019-10-11 16:51:10 +08:00
|
|
|
|
//拉流代理时如果断流再重连成功是否删除前一次的媒体流数据,如果删除将重新开始,
|
|
|
|
|
//如果不删除将会接着上一次的数据继续写(录制hls/mp4时会继续在前一个文件后面写)
|
|
|
|
|
extern const string kResetWhenRePlay;
|
2019-11-08 15:55:26 +08:00
|
|
|
|
//是否默认推流时转换成hls,hook接口(on_publish)中可以覆盖该设置
|
2019-11-08 15:54:13 +08:00
|
|
|
|
extern const string kPublishToHls ;
|
2019-11-08 15:55:26 +08:00
|
|
|
|
//是否默认推流时mp4录像,hook接口(on_publish)中可以覆盖该设置
|
2019-11-08 15:54:13 +08:00
|
|
|
|
extern const string kPublishToMP4 ;
|
2020-04-09 16:19:03 +08:00
|
|
|
|
//合并写缓存大小(单位毫秒),合并写指服务器缓存一定的数据后才会一次性写入socket,这样能提高性能,但是会提高延时
|
2020-04-29 11:08:43 +08:00
|
|
|
|
//开启后会同时关闭TCP_NODELAY并开启MSG_MORE
|
2020-04-09 16:19:03 +08:00
|
|
|
|
extern const string kMergeWriteMS ;
|
2020-05-25 12:07:38 +08:00
|
|
|
|
//全局的时间戳覆盖开关,在转协议时,对frame进行时间戳覆盖
|
|
|
|
|
extern const string kModifyStamp;
|
2020-11-15 00:40:46 +08:00
|
|
|
|
//按需转协议的开关
|
|
|
|
|
extern const string kHlsDemand;
|
|
|
|
|
extern const string kRtspDemand;
|
|
|
|
|
extern const string kRtmpDemand;
|
|
|
|
|
extern const string kTSDemand;
|
|
|
|
|
extern const string kFMP4Demand;
|
2021-05-22 10:17:52 +08:00
|
|
|
|
//转协议是否全局开启或忽略音频
|
|
|
|
|
extern const string kEnableAudio;
|
2021-11-30 18:02:52 +08:00
|
|
|
|
//最多等待未初始化的Track 10秒,超时之后会忽略未初始化的Track
|
|
|
|
|
extern const string kWaitTrackReadyMS;
|
|
|
|
|
//如果直播流只有单Track,最多等待3秒,超时后未收到其他Track的数据,则认为是单Track
|
|
|
|
|
//如果协议元数据有声明特定track数,那么无此等待时间
|
|
|
|
|
extern const string kWaitAddTrackMS;
|
|
|
|
|
//如果track未就绪,我们先缓存帧数据,但是有最大个数限制(100帧时大约4秒),防止内存溢出
|
|
|
|
|
extern const string kUnreadyFrameCache;
|
2019-05-28 17:14:36 +08:00
|
|
|
|
}//namespace General
|
|
|
|
|
|
|
|
|
|
|
2017-04-01 16:35:56 +08:00
|
|
|
|
////////////HTTP配置///////////
|
|
|
|
|
namespace Http {
|
|
|
|
|
//http 文件发送缓存大小
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kSendBufSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//http 最大请求字节数
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kMaxReqSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//http keep-alive秒数
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kKeepAliveSecond;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//http 字符编码
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kCharSet;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//http 服务器根目录
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kRootPath;
|
2021-08-26 19:36:38 +08:00
|
|
|
|
//http 服务器虚拟目录 虚拟目录名和文件路径使用","隔开,多个配置路径间用";"隔开,例如 path_d,d:/record;path_e,e:/record
|
2021-08-25 14:30:31 +08:00
|
|
|
|
extern const string kVirtualPath;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//http 404错误提示内容
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kNotFound;
|
2020-06-30 09:16:02 +08:00
|
|
|
|
//是否显示文件夹菜单
|
|
|
|
|
extern const string kDirMenu;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
}//namespace Http
|
|
|
|
|
|
|
|
|
|
////////////SHELL配置///////////
|
|
|
|
|
namespace Shell {
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kMaxReqSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Shell
|
|
|
|
|
|
|
|
|
|
////////////RTSP服务器配置///////////
|
|
|
|
|
namespace Rtsp {
|
2017-12-10 01:34:43 +08:00
|
|
|
|
//是否优先base64方式认证?默认Md5方式认证
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kAuthBasic;
|
2019-05-29 18:24:35 +08:00
|
|
|
|
//握手超时时间,默认15秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kHandshakeSecond;
|
2019-05-29 18:24:35 +08:00
|
|
|
|
//维持链接超时时间,默认15秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kKeepAliveSecond;
|
2019-07-19 11:54:29 +08:00
|
|
|
|
|
|
|
|
|
//rtsp拉流代理是否直接代理
|
2019-07-19 11:58:23 +08:00
|
|
|
|
//直接代理后支持任意编码格式,但是会导致GOP缓存无法定位到I帧,可能会导致开播花屏
|
2019-07-19 11:54:29 +08:00
|
|
|
|
//并且如果是tcp方式拉流,如果rtp大于mtu会导致无法使用udp方式代理
|
|
|
|
|
//假定您的拉流源地址不是264或265或AAC,那么你可以使用直接代理的方式来支持rtsp代理
|
|
|
|
|
//默认开启rtsp直接代理,rtmp由于没有这些问题,是强制开启直接代理的
|
|
|
|
|
extern const string kDirectProxy;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Rtsp
|
|
|
|
|
|
|
|
|
|
////////////RTMP服务器配置///////////
|
|
|
|
|
namespace Rtmp {
|
2020-05-25 12:07:38 +08:00
|
|
|
|
//rtmp推流时间戳覆盖开关
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kModifyStamp;
|
2019-05-29 18:24:35 +08:00
|
|
|
|
//握手超时时间,默认15秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kHandshakeSecond;
|
2019-05-29 18:24:35 +08:00
|
|
|
|
//维持链接超时时间,默认15秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kKeepAliveSecond;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace RTMP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////RTP配置///////////
|
|
|
|
|
namespace Rtp {
|
|
|
|
|
//RTP打包最大MTU,公网情况下更小
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kVideoMtuSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//RTP打包最大MTU,公网情况下更小
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kAudioMtuSize;
|
2021-08-12 10:43:12 +08:00
|
|
|
|
//rtp包最大长度限制, 单位KB
|
2021-08-11 15:48:15 +08:00
|
|
|
|
extern const string kRtpMaxSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Rtsp
|
|
|
|
|
|
|
|
|
|
////////////组播配置///////////
|
|
|
|
|
namespace MultiCast {
|
|
|
|
|
//组播分配起始地址
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kAddrMin;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//组播分配截止地址
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kAddrMax;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//组播TTL
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kUdpTTL;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace MultiCast
|
|
|
|
|
|
|
|
|
|
////////////录像配置///////////
|
|
|
|
|
namespace Record {
|
|
|
|
|
//查看录像的应用名称
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kAppName;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//每次流化MP4文件的时长,单位毫秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kSampleMS;
|
2019-04-03 11:09:50 +08:00
|
|
|
|
//MP4文件录制大小,默认一个小时
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kFileSecond;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//录制文件路径
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kFilePath;
|
2019-08-01 22:13:26 +08:00
|
|
|
|
//mp4文件写缓存大小
|
|
|
|
|
extern const string kFileBufSize;
|
2019-10-10 13:37:56 +08:00
|
|
|
|
//mp4录制完成后是否进行二次关键帧索引写入头部
|
|
|
|
|
extern const string kFastStart;
|
2019-09-24 20:48:30 +08:00
|
|
|
|
//mp4文件是否重头循环读取
|
|
|
|
|
extern const string kFileRepeat;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Record
|
|
|
|
|
|
|
|
|
|
////////////HLS相关配置///////////
|
|
|
|
|
namespace Hls {
|
|
|
|
|
//HLS切片时长,单位秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kSegmentDuration;
|
2019-11-05 10:27:28 +08:00
|
|
|
|
//m3u8文件中HLS切片个数,如果设置为0,则不删除切片,而是保存为点播
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kSegmentNum;
|
2019-11-05 10:27:28 +08:00
|
|
|
|
//HLS切片从m3u8文件中移除后,继续保留在磁盘上的个数
|
|
|
|
|
extern const string kSegmentRetain;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//HLS文件写缓存大小
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kFileBufSize;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
//录制文件路径
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kFilePath;
|
2020-09-15 17:46:12 +08:00
|
|
|
|
// 是否广播 ts 切片完成通知
|
|
|
|
|
extern const string kBroadcastRecordTs;
|
2021-06-23 10:25:09 +08:00
|
|
|
|
//hls直播文件删除延时,单位秒
|
|
|
|
|
extern const string kDeleteDelaySec;
|
2017-04-01 16:35:56 +08:00
|
|
|
|
} //namespace Hls
|
|
|
|
|
|
2019-12-06 11:54:10 +08:00
|
|
|
|
////////////Rtp代理相关配置///////////
|
|
|
|
|
namespace RtpProxy {
|
|
|
|
|
//rtp调试数据保存目录,置空则不生成
|
|
|
|
|
extern const string kDumpDir;
|
|
|
|
|
//rtp接收超时时间
|
|
|
|
|
extern const string kTimeoutSec;
|
|
|
|
|
} //namespace RtpProxy
|
2019-03-27 18:56:49 +08:00
|
|
|
|
|
2019-05-28 17:27:28 +08:00
|
|
|
|
/**
|
|
|
|
|
* rtsp/rtmp播放器、推流器相关设置名,
|
|
|
|
|
* 这些设置项都不是配置文件用
|
|
|
|
|
* 只用于设置某个播放器或推流器实例用
|
|
|
|
|
*/
|
2019-03-27 18:56:49 +08:00
|
|
|
|
namespace Client {
|
|
|
|
|
//指定网卡ip
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kNetAdapter;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//设置rtp传输类型,可选项有0(tcp,默认)、1(udp)、2(组播)
|
|
|
|
|
//设置方法:player[PlayerBase::kRtpType] = 0/1/2;
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kRtpType;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//rtsp认证用户名
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kRtspUser;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//rtsp认证用用户密码,可以是明文也可以是md5,md5密码生成方式 md5(username:realm:password)
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kRtspPwd;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//rtsp认证用用户密码是否为md5类型
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kRtspPwdIsMD5;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//握手超时时间,默认10,000 毫秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kTimeoutMS;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//rtp/rtmp包接收超时时间,默认5000秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kMediaTimeoutMS;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
//rtsp/rtmp心跳时间,默认5000毫秒
|
2019-06-12 18:37:52 +08:00
|
|
|
|
extern const string kBeatIntervalMS;
|
2020-04-08 11:16:09 +08:00
|
|
|
|
//是否为性能测试模式,性能测试模式开启后不会解析rtp或rtmp包
|
|
|
|
|
extern const string kBenchmarkMode;
|
2021-11-10 13:56:04 +08:00
|
|
|
|
//播放器在触发播放成功事件时,是否等待所有track ready时再回调
|
|
|
|
|
extern const string kWaitTrackReady;
|
2019-03-27 18:56:49 +08:00
|
|
|
|
}
|
2018-10-24 17:17:55 +08:00
|
|
|
|
} // namespace mediakit
|
2017-04-01 16:35:56 +08:00
|
|
|
|
|
2018-02-02 18:06:08 +08:00
|
|
|
|
#endif /* COMMON_CONFIG_H */
|