mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-28 21:14:03 +08:00
优化代码
This commit is contained in:
@@ -287,6 +287,36 @@ public:
|
||||
// Maximum number of tracks
|
||||
size_t max_track = 2;
|
||||
|
||||
#define OPT_VALUE(XX) \
|
||||
XX(modify_stamp) \
|
||||
XX(enable_audio) \
|
||||
XX(add_mute_audio) \
|
||||
XX(auto_close) \
|
||||
XX(continue_push_ms) \
|
||||
XX(paced_sender_ms) \
|
||||
\
|
||||
XX(enable_hls) \
|
||||
XX(enable_hls_fmp4) \
|
||||
XX(enable_mp4) \
|
||||
XX(enable_rtsp) \
|
||||
XX(enable_rtmp) \
|
||||
XX(enable_ts) \
|
||||
XX(enable_fmp4) \
|
||||
\
|
||||
XX(hls_demand) \
|
||||
XX(rtsp_demand) \
|
||||
XX(rtmp_demand) \
|
||||
XX(ts_demand) \
|
||||
XX(fmp4_demand) \
|
||||
\
|
||||
XX(mp4_max_second) \
|
||||
XX(mp4_as_player) \
|
||||
XX(mp4_save_path) \
|
||||
\
|
||||
XX(hls_save_path) \
|
||||
XX(stream_replace) \
|
||||
XX(max_track)
|
||||
|
||||
template <typename MAP>
|
||||
ProtocolOption(const MAP &allArgs) : ProtocolOption() {
|
||||
load(allArgs);
|
||||
@@ -294,35 +324,18 @@ public:
|
||||
|
||||
template <typename MAP>
|
||||
void load(const MAP &allArgs) {
|
||||
#define GET_OPT_VALUE(key) getArgsValue(allArgs, #key, key)
|
||||
GET_OPT_VALUE(modify_stamp);
|
||||
GET_OPT_VALUE(enable_audio);
|
||||
GET_OPT_VALUE(add_mute_audio);
|
||||
GET_OPT_VALUE(auto_close);
|
||||
GET_OPT_VALUE(continue_push_ms);
|
||||
GET_OPT_VALUE(paced_sender_ms);
|
||||
#define GET(key) getArgsValue(allArgs, #key, key);
|
||||
OPT_VALUE(GET)
|
||||
#undef GET
|
||||
}
|
||||
|
||||
GET_OPT_VALUE(enable_hls);
|
||||
GET_OPT_VALUE(enable_hls_fmp4);
|
||||
GET_OPT_VALUE(enable_mp4);
|
||||
GET_OPT_VALUE(enable_rtsp);
|
||||
GET_OPT_VALUE(enable_rtmp);
|
||||
GET_OPT_VALUE(enable_ts);
|
||||
GET_OPT_VALUE(enable_fmp4);
|
||||
|
||||
GET_OPT_VALUE(hls_demand);
|
||||
GET_OPT_VALUE(rtsp_demand);
|
||||
GET_OPT_VALUE(rtmp_demand);
|
||||
GET_OPT_VALUE(ts_demand);
|
||||
GET_OPT_VALUE(fmp4_demand);
|
||||
|
||||
GET_OPT_VALUE(mp4_max_second);
|
||||
GET_OPT_VALUE(mp4_as_player);
|
||||
GET_OPT_VALUE(mp4_save_path);
|
||||
|
||||
GET_OPT_VALUE(hls_save_path);
|
||||
GET_OPT_VALUE(stream_replace);
|
||||
GET_OPT_VALUE(max_track);
|
||||
template <typename MAP>
|
||||
MAP as() {
|
||||
MAP ret;
|
||||
#define SET(key) ret[#key] = key;
|
||||
OPT_VALUE(SET)
|
||||
#undef SET
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user