winlin

for #340, #343, add wiki and use srs string function, support hls_entry_prefix(h…

…ls base url). 2.0.142
@@ -532,7 +532,7 @@ vhost with-hls.srs.com { @@ -532,7 +532,7 @@ vhost with-hls.srs.com {
532 # http://your-server/live/livestream-1.ts 532 # http://your-server/live/livestream-1.ts
533 # ... 533 # ...
534 # optional, default to empty string. 534 # optional, default to empty string.
535 - hls_entry_prefix http://your-server/; 535 + hls_entry_prefix http://your-server;
536 # the hls mount for hls_storage ram, 536 # the hls mount for hls_storage ram,
537 # which use srs embeded http server to delivery HLS, 537 # which use srs embeded http server to delivery HLS,
538 # where the mount specifies the HTTP url to mount. 538 # where the mount specifies the HTTP url to mount.
@@ -3152,17 +3152,7 @@ string SrsConfig::get_hls_entry_prefix(string vhost) @@ -3152,17 +3152,7 @@ string SrsConfig::get_hls_entry_prefix(string vhost)
3152 return ""; 3152 return "";
3153 } 3153 }
3154 3154
3155 - std::string prefix = conf->arg0();  
3156 - if (prefix.empty()) {  
3157 - return "";  
3158 - }  
3159 -  
3160 - const char last = prefix[prefix.length() - 1];  
3161 - if (last != '/') {  
3162 - return prefix.append("/");  
3163 - }  
3164 -  
3165 - return prefix; 3155 + return conf->arg0();
3166 } 3156 }
3167 3157
3168 string SrsConfig::get_hls_path(string vhost) 3158 string SrsConfig::get_hls_path(string vhost)
@@ -203,14 +203,14 @@ int SrsHlsMuxer::sequence_no() @@ -203,14 +203,14 @@ int SrsHlsMuxer::sequence_no()
203 return _sequence_no; 203 return _sequence_no;
204 } 204 }
205 205
206 -int SrsHlsMuxer::update_config(SrsRequest* r, string hls_entry_prefix, string path, int fragment, int window) 206 +int SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix, string path, int fragment, int window)
207 { 207 {
208 int ret = ERROR_SUCCESS; 208 int ret = ERROR_SUCCESS;
209 209
210 srs_freep(req); 210 srs_freep(req);
211 req = r->copy(); 211 req = r->copy();
212 212
213 - entry_prefix = hls_entry_prefix; 213 + hls_entry_prefix = entry_prefix;
214 hls_path = path; 214 hls_path = path;
215 hls_fragment = fragment; 215 hls_fragment = fragment;
216 hls_window = window; 216 hls_window = window;
@@ -301,8 +301,10 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) @@ -301,8 +301,10 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
301 current->full_path += "/"; 301 current->full_path += "/";
302 current->full_path += filename; 302 current->full_path += filename;
303 303
304 - // TODO: support base url, and so on.  
305 - current->uri += entry_prefix; 304 + current->uri += hls_entry_prefix;
  305 + if (!hls_entry_prefix.empty() && !srs_string_ends_with(hls_entry_prefix, "/")) {
  306 + current->uri += "/";
  307 + }
306 current->uri += filename; 308 current->uri += filename;
307 309
308 std::string tmp_file = current->full_path + ".tmp"; 310 std::string tmp_file = current->full_path + ".tmp";
@@ -167,7 +167,7 @@ class SrsHlsMuxer @@ -167,7 +167,7 @@ class SrsHlsMuxer
167 private: 167 private:
168 SrsRequest* req; 168 SrsRequest* req;
169 private: 169 private:
170 - std::string entry_prefix; 170 + std::string hls_entry_prefix;
171 std::string hls_path; 171 std::string hls_path;
172 int hls_fragment; 172 int hls_fragment;
173 int hls_window; 173 int hls_window;
@@ -208,7 +208,7 @@ public: @@ -208,7 +208,7 @@ public:
208 /** 208 /**
209 * when publish, update the config for muxer. 209 * when publish, update the config for muxer.
210 */ 210 */
211 - virtual int update_config(SrsRequest* r, std::string hls_entry_prefix, std::string path, int fragment, int window); 211 + virtual int update_config(SrsRequest* r, std::string entry_prefix, std::string path, int fragment, int window);
212 /** 212 /**
213 * open a new segment(a new ts file), 213 * open a new segment(a new ts file),
214 * @param segment_start_dts use to calc the segment duration, 214 * @param segment_start_dts use to calc the segment duration,
@@ -29,9 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -29,9 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 */ 29 */
30 30
31 // current release version 31 // current release version
32 -#define VERSION_MAJOR 3 32 +#define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 0 34 +#define VERSION_REVISION 142
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"