全面整理转协议相关配置文件

This commit is contained in:
xiongziliang
2022-11-12 23:54:35 +08:00
parent 946945ce7b
commit 9bb6a2f828
20 changed files with 373 additions and 298 deletions

View File

@@ -23,73 +23,6 @@
namespace mediakit {
class ProtocolOption {
public:
ProtocolOption();
//是否开启转换为hls
bool enable_hls = false;
//是否开启MP4录制
bool enable_mp4 = false;
//是否将mp4录制当做观看者
bool mp4_as_player = false;
//是否开启转换为rtsp/webrtc
bool enable_rtsp = true;
//是否开启转换为rtmp/flv
bool enable_rtmp = true;
//是否开启转换为http-ts/ws-ts
bool enable_ts = true;
//是否开启转换为http-fmp4/ws-fmp4
bool enable_fmp4 = true;
//转协议是否开启音频
bool enable_audio = true;
//添加静音音频,在关闭音频时,此开关无效
bool add_mute_audio = true;
//mp4录制保存路径
std::string mp4_save_path;
//mp4切片大小单位秒
size_t mp4_max_second = 0;
//hls录制保存路径
std::string hls_save_path;
//断连续推延时,单位毫秒,默认采用配置文件
uint32_t continue_push_ms;
//时间戳修复这一路流标志位
bool modify_stamp;
template <typename MAP>
ProtocolOption(const MAP &allArgs) : ProtocolOption() {
#define GET_OPT_VALUE(key) getArgsValue(allArgs, #key, key)
GET_OPT_VALUE(enable_hls);
GET_OPT_VALUE(enable_mp4);
GET_OPT_VALUE(mp4_as_player);
GET_OPT_VALUE(enable_rtsp);
GET_OPT_VALUE(enable_rtmp);
GET_OPT_VALUE(enable_ts);
GET_OPT_VALUE(enable_fmp4);
GET_OPT_VALUE(enable_audio);
GET_OPT_VALUE(add_mute_audio);
GET_OPT_VALUE(mp4_save_path);
GET_OPT_VALUE(mp4_max_second);
GET_OPT_VALUE(hls_save_path);
GET_OPT_VALUE(continue_push_ms);
GET_OPT_VALUE(modify_stamp);
}
private:
template <typename MAP, typename KEY, typename TYPE>
static void getArgsValue(const MAP &allArgs, const KEY &key, TYPE &value) {
auto val = ((MAP &)allArgs)[key];
if (!val.empty()) {
value = (TYPE)val;
}
}
};
class MultiMediaSourceMuxer : public MediaSourceEventInterceptor, public MediaSink, public std::enable_shared_from_this<MultiMediaSourceMuxer>{
public:
typedef std::shared_ptr<MultiMediaSourceMuxer> Ptr;