winlin

add hls config

@@ -9,6 +9,10 @@ chunk_size 65000; @@ -9,6 +9,10 @@ chunk_size 65000;
9 # vhost list, the __defaultVhost__ is the default vhost 9 # vhost list, the __defaultVhost__ is the default vhost
10 # for which cannot identify the required vhost. 10 # for which cannot identify the required vhost.
11 vhost __defaultVhost__ { 11 vhost __defaultVhost__ {
  12 + enabled on;
  13 + gop_cache on;
  14 + hls on;
  15 + hls_path ./hls;
12 } 16 }
13 # the vhost disabled. 17 # the vhost disabled.
14 vhost removed.vhost.com { 18 vhost removed.vhost.com {
@@ -17,6 +21,16 @@ vhost removed.vhost.com { @@ -17,6 +21,16 @@ vhost removed.vhost.com {
17 # default: on 21 # default: on
18 enabled off; 22 enabled off;
19 } 23 }
  24 +# the vhost with hls specified.
  25 +vhost no-hls.vhost.com {
  26 + # whether the hls is enabled.
  27 + # if off, donot write hls(ts and m3u8) when publish.
  28 + # default: on
  29 + hls on;
  30 + # the hls output path.
  31 + # default: ./hls
  32 + hls_path /data/nginx/html/hls;
  33 +}
20 # the vhost with hls disabled. 34 # the vhost with hls disabled.
21 vhost no-hls.vhost.com { 35 vhost no-hls.vhost.com {
22 # whether the hls is enabled. 36 # whether the hls is enabled.
@@ -573,6 +573,17 @@ SrsConfDirective* SrsConfig::get_hls(std::string vhost) @@ -573,6 +573,17 @@ SrsConfDirective* SrsConfig::get_hls(std::string vhost)
573 return conf->get("hls"); 573 return conf->get("hls");
574 } 574 }
575 575
  576 +SrsConfDirective* SrsConfig::get_hls_path(std::string vhost)
  577 +{
  578 + SrsConfDirective* conf = get_vhost(vhost);
  579 +
  580 + if (!conf) {
  581 + return NULL;
  582 + }
  583 +
  584 + return conf->get("hls_path");
  585 +}
  586 +
576 SrsConfDirective* SrsConfig::get_refer(std::string vhost) 587 SrsConfDirective* SrsConfig::get_refer(std::string vhost)
577 { 588 {
578 SrsConfDirective* conf = get_vhost(vhost); 589 SrsConfDirective* conf = get_vhost(vhost);
@@ -110,6 +110,7 @@ public: @@ -110,6 +110,7 @@ public:
110 virtual SrsConfDirective* get_vhost(std::string vhost); 110 virtual SrsConfDirective* get_vhost(std::string vhost);
111 virtual SrsConfDirective* get_gop_cache(std::string vhost); 111 virtual SrsConfDirective* get_gop_cache(std::string vhost);
112 virtual SrsConfDirective* get_hls(std::string vhost); 112 virtual SrsConfDirective* get_hls(std::string vhost);
  113 + virtual SrsConfDirective* get_hls_path(std::string vhost);
113 virtual SrsConfDirective* get_refer(std::string vhost); 114 virtual SrsConfDirective* get_refer(std::string vhost);
114 virtual SrsConfDirective* get_refer_play(std::string vhost); 115 virtual SrsConfDirective* get_refer_play(std::string vhost);
115 virtual SrsConfDirective* get_refer_publish(std::string vhost); 116 virtual SrsConfDirective* get_refer_publish(std::string vhost);
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013 winlin
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#include <srs_core_hls.hpp>
  25 +
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013 winlin
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#ifndef SRS_CORE_HLS_HPP
  25 +#define SRS_CORE_HLS_HPP
  26 +
  27 +/*
  28 +#include <srs_core_hls.hpp>
  29 +*/
  30 +#include <srs_core.hpp>
  31 +
  32 +#endif
@@ -22,6 +22,8 @@ file @@ -22,6 +22,8 @@ file
22 ..\core\srs_core_client.cpp, 22 ..\core\srs_core_client.cpp,
23 ..\core\srs_core_source.hpp, 23 ..\core\srs_core_source.hpp,
24 ..\core\srs_core_source.cpp, 24 ..\core\srs_core_source.cpp,
  25 + ..\core\srs_core_hls.hpp,
  26 + ..\core\srs_core_hls.cpp,
25 ..\core\srs_core_codec.hpp, 27 ..\core\srs_core_codec.hpp,
26 ..\core\srs_core_codec.cpp, 28 ..\core\srs_core_codec.cpp,
27 ..\core\srs_core_rtmp.hpp, 29 ..\core\srs_core_rtmp.hpp,