正在显示
1 个修改的文件
包含
127 行增加
和
127 行删除
trunk/src/core/srs_core.hpp
100755 → 100644
| 1 | -/* | ||
| 2 | -The MIT License (MIT) | ||
| 3 | - | ||
| 4 | -Copyright (c) 2013-2014 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_HPP | ||
| 25 | -#define SRS_CORE_HPP | ||
| 26 | - | ||
| 27 | -/* | ||
| 28 | -#include <srs_core.hpp> | ||
| 29 | -*/ | ||
| 30 | - | ||
| 31 | -// current release version | ||
| 32 | -#define VERSION_MAJOR "0" | ||
| 33 | -#define VERSION_MINOR "9" | ||
| 34 | -#define VERSION_REVISION "53" | ||
| 35 | -#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | ||
| 36 | -// server info. | ||
| 37 | -#define RTMP_SIG_SRS_KEY "srs" | ||
| 38 | -#define RTMP_SIG_SRS_ROLE "origin server" | ||
| 39 | -#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)" | ||
| 40 | -#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT | ||
| 41 | -#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server" | ||
| 42 | -#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin" | ||
| 43 | -#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com" | ||
| 44 | -#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" | ||
| 45 | -#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" | ||
| 46 | -#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" | ||
| 47 | -#define RTMP_SIG_SRS_CONTRIBUTORS_URL "https://github.com/winlinvip/simple-rtmp-server/blob/master/AUTHORS.txt" | ||
| 48 | - | ||
| 49 | -/** | ||
| 50 | -* the core provides the common defined macros, utilities, | ||
| 51 | -* user must include the srs_core.hpp before any header, or maybe | ||
| 52 | -* build failed. | ||
| 53 | -*/ | ||
| 54 | - | ||
| 55 | -// for 32bit os, 2G big file limit for unistd io, | ||
| 56 | -// ie. read/write/lseek to use 64bits size for huge file. | ||
| 57 | -#ifndef _FILE_OFFSET_BITS | ||
| 58 | - #define _FILE_OFFSET_BITS 64 | ||
| 59 | -#endif | ||
| 60 | - | ||
| 61 | -// for int64_t print using PRId64 format. | ||
| 62 | -#ifndef __STDC_FORMAT_MACROS | ||
| 63 | - #define __STDC_FORMAT_MACROS | ||
| 64 | -#endif | ||
| 65 | -#include <inttypes.h> | ||
| 66 | - | ||
| 67 | -#include <assert.h> | ||
| 68 | -#define srs_assert(expression) assert(expression) | ||
| 69 | - | ||
| 70 | -#include <stddef.h> | ||
| 71 | -#include <sys/types.h> | ||
| 72 | - | ||
| 73 | -// generated by configure. | ||
| 74 | -#include <srs_auto_headers.hpp> | ||
| 75 | - | ||
| 76 | -// free the p and set to NULL. | ||
| 77 | -// p must be a T*. | ||
| 78 | -#define srs_freep(p) \ | ||
| 79 | - if (p) { \ | ||
| 80 | - delete p; \ | ||
| 81 | - p = NULL; \ | ||
| 82 | - } \ | ||
| 83 | - (void)0 | ||
| 84 | -// free the p which represents a array | ||
| 85 | -#define srs_freepa(p) \ | ||
| 86 | - if (p) { \ | ||
| 87 | - delete[] p; \ | ||
| 88 | - p = NULL; \ | ||
| 89 | - } \ | ||
| 90 | - (void)0 | ||
| 91 | - | ||
| 92 | -// compare | ||
| 93 | -#define srs_min(a, b) (((a) < (b))? (a) : (b)) | ||
| 94 | -#define srs_max(a, b) (((a) < (b))? (b) : (a)) | ||
| 95 | - | ||
| 96 | -// signal defines. | ||
| 97 | -#define SIGNAL_RELOAD SIGHUP | ||
| 98 | - | ||
| 99 | -#include <string> | ||
| 100 | -// replace old_str to new_str of str | ||
| 101 | -extern std::string srs_string_replace(std::string str, std::string old_str, std::string new_str); | ||
| 102 | -// trim char in trim_chars of str | ||
| 103 | -extern std::string srs_string_trim_end(std::string str, std::string trim_chars); | ||
| 104 | -// trim char in trim_chars of str | ||
| 105 | -extern std::string srs_string_trim_start(std::string str, std::string trim_chars); | ||
| 106 | -// remove char in remove_chars of str | ||
| 107 | -extern std::string srs_string_remove(std::string str, std::string remove_chars); | ||
| 108 | -// whether string end with | ||
| 109 | -extern bool srs_string_ends_with(std::string str, std::string flag); | ||
| 110 | - | ||
| 111 | -// dns resolve utility, return the resolved ip address. | ||
| 112 | -extern std::string srs_dns_resolve(std::string host); | ||
| 113 | -// whether system is little endian | ||
| 114 | -extern bool srs_is_little_endian(); | ||
| 115 | - | ||
| 116 | -/** | ||
| 117 | -* disable copy constructor of class | ||
| 118 | -*/ | ||
| 119 | -#define disable_default_copy(className)\ | ||
| 120 | - private:\ | ||
| 121 | - /** \ | ||
| 122 | - * disable the copy constructor and operator=, donot allow directly copy. \ | ||
| 123 | - */ \ | ||
| 124 | - className(const className&); \ | ||
| 125 | - className& operator= (const className&) | ||
| 126 | - | ||
| 127 | -#endif | ||
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 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_HPP | ||
| 25 | +#define SRS_CORE_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_core.hpp> | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +// current release version | ||
| 32 | +#define VERSION_MAJOR "0" | ||
| 33 | +#define VERSION_MINOR "9" | ||
| 34 | +#define VERSION_REVISION "53" | ||
| 35 | +#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | ||
| 36 | +// server info. | ||
| 37 | +#define RTMP_SIG_SRS_KEY "srs" | ||
| 38 | +#define RTMP_SIG_SRS_ROLE "origin server" | ||
| 39 | +#define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)" | ||
| 40 | +#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT | ||
| 41 | +#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server" | ||
| 42 | +#define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin" | ||
| 43 | +#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com" | ||
| 44 | +#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" | ||
| 45 | +#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" | ||
| 46 | +#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" | ||
| 47 | +#define RTMP_SIG_SRS_CONTRIBUTORS_URL "https://github.com/winlinvip/simple-rtmp-server/blob/master/AUTHORS.txt" | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | +* the core provides the common defined macros, utilities, | ||
| 51 | +* user must include the srs_core.hpp before any header, or maybe | ||
| 52 | +* build failed. | ||
| 53 | +*/ | ||
| 54 | + | ||
| 55 | +// for 32bit os, 2G big file limit for unistd io, | ||
| 56 | +// ie. read/write/lseek to use 64bits size for huge file. | ||
| 57 | +#ifndef _FILE_OFFSET_BITS | ||
| 58 | + #define _FILE_OFFSET_BITS 64 | ||
| 59 | +#endif | ||
| 60 | + | ||
| 61 | +// for int64_t print using PRId64 format. | ||
| 62 | +#ifndef __STDC_FORMAT_MACROS | ||
| 63 | + #define __STDC_FORMAT_MACROS | ||
| 64 | +#endif | ||
| 65 | +#include <inttypes.h> | ||
| 66 | + | ||
| 67 | +#include <assert.h> | ||
| 68 | +#define srs_assert(expression) assert(expression) | ||
| 69 | + | ||
| 70 | +#include <stddef.h> | ||
| 71 | +#include <sys/types.h> | ||
| 72 | + | ||
| 73 | +// generated by configure. | ||
| 74 | +#include <srs_auto_headers.hpp> | ||
| 75 | + | ||
| 76 | +// free the p and set to NULL. | ||
| 77 | +// p must be a T*. | ||
| 78 | +#define srs_freep(p) \ | ||
| 79 | + if (p) { \ | ||
| 80 | + delete p; \ | ||
| 81 | + p = NULL; \ | ||
| 82 | + } \ | ||
| 83 | + (void)0 | ||
| 84 | +// free the p which represents a array | ||
| 85 | +#define srs_freepa(p) \ | ||
| 86 | + if (p) { \ | ||
| 87 | + delete[] p; \ | ||
| 88 | + p = NULL; \ | ||
| 89 | + } \ | ||
| 90 | + (void)0 | ||
| 91 | + | ||
| 92 | +// compare | ||
| 93 | +#define srs_min(a, b) (((a) < (b))? (a) : (b)) | ||
| 94 | +#define srs_max(a, b) (((a) < (b))? (b) : (a)) | ||
| 95 | + | ||
| 96 | +// signal defines. | ||
| 97 | +#define SIGNAL_RELOAD SIGHUP | ||
| 98 | + | ||
| 99 | +#include <string> | ||
| 100 | +// replace old_str to new_str of str | ||
| 101 | +extern std::string srs_string_replace(std::string str, std::string old_str, std::string new_str); | ||
| 102 | +// trim char in trim_chars of str | ||
| 103 | +extern std::string srs_string_trim_end(std::string str, std::string trim_chars); | ||
| 104 | +// trim char in trim_chars of str | ||
| 105 | +extern std::string srs_string_trim_start(std::string str, std::string trim_chars); | ||
| 106 | +// remove char in remove_chars of str | ||
| 107 | +extern std::string srs_string_remove(std::string str, std::string remove_chars); | ||
| 108 | +// whether string end with | ||
| 109 | +extern bool srs_string_ends_with(std::string str, std::string flag); | ||
| 110 | + | ||
| 111 | +// dns resolve utility, return the resolved ip address. | ||
| 112 | +extern std::string srs_dns_resolve(std::string host); | ||
| 113 | +// whether system is little endian | ||
| 114 | +extern bool srs_is_little_endian(); | ||
| 115 | + | ||
| 116 | +/** | ||
| 117 | +* disable copy constructor of class | ||
| 118 | +*/ | ||
| 119 | +#define disable_default_copy(className)\ | ||
| 120 | + private:\ | ||
| 121 | + /** \ | ||
| 122 | + * disable the copy constructor and operator=, donot allow directly copy. \ | ||
| 123 | + */ \ | ||
| 124 | + className(const className&); \ | ||
| 125 | + className& operator= (const className&) | ||
| 126 | + | ||
| 127 | +#endif |
-
请 注册 或 登录 后发表评论