mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
整理MediaSource协议类型
This commit is contained in:
parent
10c2197e76
commit
76aebd74c6
@ -1719,7 +1719,7 @@ void installWebApi() {
|
|||||||
auto &allArgs = _args;
|
auto &allArgs = _args;
|
||||||
CHECK_ARGS("app", "stream");
|
CHECK_ARGS("app", "stream");
|
||||||
|
|
||||||
return StrPrinter << RTC_SCHEMA << "://" << _args["Host"] << "/" << _args["app"] << "/"
|
return StrPrinter << "rtc://" << _args["Host"] << "/" << _args["app"] << "/"
|
||||||
<< _args["stream"] << "?" << _args.getParser().params() + "&session=" + _session_id;
|
<< _args["stream"] << "?" << _args.getParser().params() + "&session=" + _session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,19 @@ MediaSource::Ptr MediaSource::find(const string &vhost, const string &app, const
|
|||||||
if (src) {
|
if (src) {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
return MediaSource::find(HLS_SCHEMA, vhost, app, stream_id, from_mp4);
|
src = MediaSource::find(TS_SCHEMA, vhost, app, stream_id, from_mp4);
|
||||||
|
if (src) {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
src = MediaSource::find(FMP4_SCHEMA, vhost, app, stream_id, from_mp4);
|
||||||
|
if (src) {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
src = MediaSource::find(HLS_SCHEMA, vhost, app, stream_id, from_mp4);
|
||||||
|
if (src) {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
return MediaSource::find(HLS_FMP4_SCHEMA, vhost, app, stream_id, from_mp4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaSource::emitEvent(bool regist){
|
void MediaSource::emitEvent(bool regist){
|
||||||
|
@ -51,16 +51,14 @@
|
|||||||
}
|
}
|
||||||
#endif // CLEAR_ARR
|
#endif // CLEAR_ARR
|
||||||
|
|
||||||
#define VHOST_KEY "vhost"
|
|
||||||
#define HTTP_SCHEMA "http"
|
|
||||||
#define RTSP_SCHEMA "rtsp"
|
#define RTSP_SCHEMA "rtsp"
|
||||||
#define RTC_SCHEMA "rtc"
|
|
||||||
#define RTMP_SCHEMA "rtmp"
|
#define RTMP_SCHEMA "rtmp"
|
||||||
#define HLS_SCHEMA "hls"
|
|
||||||
#define TS_SCHEMA "ts"
|
#define TS_SCHEMA "ts"
|
||||||
#define FMP4_SCHEMA "fmp4"
|
#define FMP4_SCHEMA "fmp4"
|
||||||
|
#define HLS_SCHEMA "hls"
|
||||||
#define HLS_FMP4_SCHEMA "hls.fmp4"
|
#define HLS_FMP4_SCHEMA "hls.fmp4"
|
||||||
#define SRT_SCHEMA "srt"
|
|
||||||
|
#define VHOST_KEY "vhost"
|
||||||
#define DEFAULT_VHOST "__defaultVhost__"
|
#define DEFAULT_VHOST "__defaultVhost__"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -620,7 +620,7 @@ static string getFilePath(const Parser &parser,const MediaInfo &media_info, Sess
|
|||||||
* @param cb 回调对象
|
* @param cb 回调对象
|
||||||
*/
|
*/
|
||||||
void HttpFileManager::onAccessPath(Session &sender, Parser &parser, const HttpFileManager::invoker &cb) {
|
void HttpFileManager::onAccessPath(Session &sender, Parser &parser, const HttpFileManager::invoker &cb) {
|
||||||
auto fullUrl = string(HTTP_SCHEMA) + "://" + parser["Host"] + parser.fullUrl();
|
auto fullUrl = "http://" + parser["Host"] + parser.fullUrl();
|
||||||
MediaInfo media_info(fullUrl);
|
MediaInfo media_info(fullUrl);
|
||||||
auto file_path = getFilePath(parser, media_info, sender);
|
auto file_path = getFilePath(parser, media_info, sender);
|
||||||
if (file_path.size() == 0) {
|
if (file_path.size() == 0) {
|
||||||
|
@ -54,7 +54,7 @@ bool SrtTransportImp::parseStreamid(std::string &streamid) {
|
|||||||
if (!toolkit::start_with(streamid, "#!::")) {
|
if (!toolkit::start_with(streamid, "#!::")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_media_info.schema = SRT_SCHEMA;
|
_media_info.schema = "srt";
|
||||||
|
|
||||||
std::string real_streamid = streamid.substr(4);
|
std::string real_streamid = streamid.substr(4);
|
||||||
std::string vhost, app, stream_name;
|
std::string vhost, app, stream_name;
|
||||||
|
@ -1258,7 +1258,7 @@ void play_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 还原成rtc,目的是为了hook时识别哪种播放协议
|
// 还原成rtc,目的是为了hook时识别哪种播放协议
|
||||||
info.schema = RTC_SCHEMA;
|
info.schema = "rtc";
|
||||||
auto rtc = WebRtcPlayer::create(EventPollerPool::Instance().getPoller(), src, info, preferred_tcp);
|
auto rtc = WebRtcPlayer::create(EventPollerPool::Instance().getPoller(), src, info, preferred_tcp);
|
||||||
cb(*rtc);
|
cb(*rtc);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user