1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #324, refine code for hstrs, support hijack handler.

This commit is contained in:
winlin 2015-03-14 14:55:45 +08:00
parent 5c6ef6ded6
commit 995b130090
4 changed files with 172 additions and 9 deletions

View file

@ -252,14 +252,27 @@ private:
*/
struct SrsLiveEntry
{
private:
bool _is_flv;
bool _is_ts;
bool _is_aac;
bool _is_mp3;
public:
// for template, the mount contains variables.
// for concrete stream, the mount is url to access.
std::string mount;
// whether hstrs(http stream trigger rtmp source)
bool hstrs;
SrsLiveStream* stream;
SrsStreamCache* cache;
SrsLiveEntry();
SrsLiveEntry(std::string m, bool h);
bool is_flv();
bool is_ts();
bool is_mp3();
bool is_aac();
};
/**
@ -314,13 +327,14 @@ struct SrsHlsEntry
* the http server instance,
* serve http static file, flv vod stream and flv live stream.
*/
class SrsHttpServer : public ISrsReloadHandler
class SrsHttpServer : virtual public ISrsReloadHandler
, virtual public ISrsHttpMatchHijacker
{
public:
SrsHttpServeMux mux;
// the flv live streaming template, to create streams.
// the http live streaming template, to create streams.
std::map<std::string, SrsLiveEntry*> tflvs;
// the flv live streaming streams, crote by template.
// the http live streaming streams, crote by template.
std::map<std::string, SrsLiveEntry*> sflvs;
// the hls live streaming template, to create streams.
std::map<std::string, SrsHlsEntry*> thls;
@ -346,6 +360,9 @@ public:
virtual int on_reload_vhost_http_updated();
virtual int on_reload_vhost_http_remux_updated();
virtual int on_reload_vhost_hls(std::string vhost);
// interface ISrsHttpMatchHijacker
public:
virtual int hijack(SrsHttpMessage* request, ISrsHttpHandler** ph);
private:
virtual int initialize_static_file();
virtual int initialize_flv_streaming();