winlin

merge from srs2.

@@ -21,4 +21,9 @@ CONTRIBUTORS ordered by first contribution. @@ -21,4 +21,9 @@ CONTRIBUTORS ordered by first contribution.
21 * allspace<allspace@gmail.com> "The srs-librtmp windows support" 21 * allspace<allspace@gmail.com> "The srs-librtmp windows support"
22 * niesongsong<nie950@gmail.com> "Configure support relative path" 22 * niesongsong<nie950@gmail.com> "Configure support relative path"
23 * rudeb0t<nimrod@themanxgroup.tw> "Bug fixed" 23 * rudeb0t<nimrod@themanxgroup.tw> "Bug fixed"
  24 +* CallMeNP<np.liamg@gmail.com> "Bug fixed"
  25 +* synote<synote@qq.com> "Bug fixed"
  26 +* lovecat<littlefawn@163.com> "Bug fixed"
  27 +* panda1986<542638787@qq.com> "Bug fixed"
  28 +* YueHonghui<hongf.yue@hotmail.com> "Bug fixed"
24 29
@@ -3440,7 +3440,7 @@ int SrsConfig::parse_argv(int& i, char** argv) @@ -3440,7 +3440,7 @@ int SrsConfig::parse_argv(int& i, char** argv)
3440 void SrsConfig::print_help(char** argv) 3440 void SrsConfig::print_help(char** argv)
3441 { 3441 {
3442 printf( 3442 printf(
3443 - RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION" "RTMP_SIG_SRS_COPYRIGHT"\n" 3443 + RTMP_SIG_SRS_SERVER" "RTMP_SIG_SRS_COPYRIGHT"\n"
3444 "License: "RTMP_SIG_SRS_LICENSE"\n" 3444 "License: "RTMP_SIG_SRS_LICENSE"\n"
3445 "Primary: "RTMP_SIG_SRS_PRIMARY"\n" 3445 "Primary: "RTMP_SIG_SRS_PRIMARY"\n"
3446 "Authors: "RTMP_SIG_SRS_AUTHROS"\n" 3446 "Authors: "RTMP_SIG_SRS_AUTHROS"\n"
@@ -282,7 +282,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size) @@ -282,7 +282,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size)
282 282
283 // set server if not set. 283 // set server if not set.
284 if (hdr->get("Server").empty()) { 284 if (hdr->get("Server").empty()) {
285 - hdr->set("Server", RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION); 285 + hdr->set("Server", RTMP_SIG_SRS_SERVER);
286 } 286 }
287 287
288 // chunked encoding 288 // chunked encoding
@@ -33,22 +33,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -33,22 +33,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 #define VERSION_REVISION 6 34 #define VERSION_REVISION 6
35 35
36 -// server info. 36 +// generated by configure, only macros.
  37 +#include <srs_auto_headers.hpp>
  38 +
  39 +// provider info.
37 #define RTMP_SIG_SRS_KEY "SRS" 40 #define RTMP_SIG_SRS_KEY "SRS"
38 #define RTMP_SIG_SRS_CODE "OuXuli" 41 #define RTMP_SIG_SRS_CODE "OuXuli"
  42 +#define RTMP_SIG_SRS_AUTHROS "winlin,wenjie.zhao"
  43 +// contact info.
  44 +#define RTMP_SIG_SRS_WEB "http://ossrs.net"
  45 +#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"
  46 +// debug info.
39 #define RTMP_SIG_SRS_ROLE "cluster" 47 #define RTMP_SIG_SRS_ROLE "cluster"
40 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)" 48 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)"
41 #define RTMP_SIG_SRS_URL_SHORT "github.com/ossrs/srs" 49 #define RTMP_SIG_SRS_URL_SHORT "github.com/ossrs/srs"
42 #define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT 50 #define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT
43 -#define RTMP_SIG_SRS_WEB "http://ossrs.net"  
44 -#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"  
45 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" 51 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
46 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2016 SRS(ossrs)" 52 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2016 SRS(ossrs)"
47 #define RTMP_SIG_SRS_PRIMARY "SRS/"VERSION_STABLE_BRANCH 53 #define RTMP_SIG_SRS_PRIMARY "SRS/"VERSION_STABLE_BRANCH
48 -#define RTMP_SIG_SRS_AUTHROS "winlin,wenjie.zhao"  
49 #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" 54 #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt"
50 #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" 55 #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")"
51 -#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/1.0release" 56 +#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/"VERSION_STABLE_BRANCH".0release"
52 #define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id 57 #define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id
53 #define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR)"."SRS_XSTR(VERSION_MINOR)"."SRS_XSTR(VERSION_REVISION) 58 #define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR)"."SRS_XSTR(VERSION_MINOR)"."SRS_XSTR(VERSION_REVISION)
54 #define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION"("RTMP_SIG_SRS_CODE")" 59 #define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION"("RTMP_SIG_SRS_CODE")"
@@ -90,8 +95,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -90,8 +95,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90 #include <stddef.h> 95 #include <stddef.h>
91 #include <sys/types.h> 96 #include <sys/types.h>
92 97
93 -// generated by configure.  
94 -#include <srs_auto_headers.hpp>  
95 // important performance options. 98 // important performance options.
96 #include <srs_core_performance.hpp> 99 #include <srs_core_performance.hpp>
97 100
@@ -348,6 +348,16 @@ bool srs_string_contains(string str, string flag) @@ -348,6 +348,16 @@ bool srs_string_contains(string str, string flag)
348 return str.find(flag) != string::npos; 348 return str.find(flag) != string::npos;
349 } 349 }
350 350
  351 +bool srs_string_contains(string str, string flag0, string flag1)
  352 +{
  353 + return str.find(flag0) != string::npos || str.find(flag1) != string::npos;
  354 +}
  355 +
  356 +bool srs_string_contains(string str, string flag0, string flag1, string flag2)
  357 +{
  358 + return str.find(flag0) != string::npos || str.find(flag1) != string::npos || str.find(flag2) != string::npos;
  359 +}
  360 +
351 vector<string> srs_string_split(string str, string flag) 361 vector<string> srs_string_split(string str, string flag)
352 { 362 {
353 vector<string> arr; 363 vector<string> arr;
@@ -88,6 +88,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag0, std::stri @@ -88,6 +88,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag0, std::stri
88 extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1, std::string flag2, std::string flag3); 88 extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1, std::string flag2, std::string flag3);
89 // whether string contains with 89 // whether string contains with
90 extern bool srs_string_contains(std::string str, std::string flag); 90 extern bool srs_string_contains(std::string str, std::string flag);
  91 +extern bool srs_string_contains(std::string str, std::string flag0, std::string flag1);
  92 +extern bool srs_string_contains(std::string str, std::string flag0, std::string flag1, std::string flag2);
91 // find the min match in str for flags. 93 // find the min match in str for flags.
92 extern std::string srs_string_min_match(std::string str, std::vector<std::string> flags); 94 extern std::string srs_string_min_match(std::string str, std::vector<std::string> flags);
93 // split the string by flag to array. 95 // split the string by flag to array.
@@ -228,6 +228,9 @@ void show_macro_features() @@ -228,6 +228,9 @@ void show_macro_features()
228 int main(int argc, char** argv) 228 int main(int argc, char** argv)
229 { 229 {
230 int ret = ERROR_SUCCESS; 230 int ret = ERROR_SUCCESS;
  231 +
  232 + // first hello message.
  233 + srs_trace(RTMP_SIG_SRS_SERVER);
231 234
232 // TODO: support both little and big endian. 235 // TODO: support both little and big endian.
233 srs_assert(srs_is_little_endian()); 236 srs_assert(srs_is_little_endian());
@@ -266,7 +269,7 @@ int main(int argc, char** argv) @@ -266,7 +269,7 @@ int main(int argc, char** argv)
266 } 269 }
267 270
268 // config already applied to log. 271 // config already applied to log.
269 - srs_trace("srs(ossrs) "RTMP_SIG_SRS_VERSION", stable is "RTMP_SIG_SRS_PRIMARY); 272 + srs_trace(RTMP_SIG_SRS_SERVER", stable is "RTMP_SIG_SRS_PRIMARY);
270 srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT); 273 srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
271 srs_trace("authors: "RTMP_SIG_SRS_AUTHROS); 274 srs_trace("authors: "RTMP_SIG_SRS_AUTHROS);
272 srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS); 275 srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS);