From fa53250202230809c18a8863df5b86893d1670ad Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 6 Nov 2014 14:23:08 +0800 Subject: [PATCH] refine the macro, use int as version type. 2.0.8 --- trunk/research/st/srs.c | 6 +++ trunk/src/core/srs_core.hpp | 15 +++++-- trunk/src/libs/srs_librtmp.cpp | 6 +-- trunk/src/main/srs_main_server.cpp | 71 ++++++++++++++++-------------- 4 files changed, 58 insertions(+), 40 deletions(-) diff --git a/trunk/research/st/srs.c b/trunk/research/st/srs.c index 017caee9a..00add8cc2 100644 --- a/trunk/research/st/srs.c +++ b/trunk/research/st/srs.c @@ -11,6 +11,12 @@ #include "public.h" +#if !defined(__ia64__) + #error "IA64 not supported" +#else + #error "Only IA64 supported" +#endif + #define srs_trace(msg, ...) printf(msg, ##__VA_ARGS__);printf("\n") int io_port = 1990; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 25b19cb04..720159efa 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -29,10 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // current release version -#define VERSION_MAJOR "2" -#define VERSION_MINOR "0" -#define VERSION_REVISION "7" -#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION +#define VERSION_MAJOR 2 +#define VERSION_MINOR 0 +#define VERSION_REVISION 8 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server" @@ -46,6 +45,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" +#define RTMP_SIG_SRS_RELEASE "https://github.com/winlinvip/simple-rtmp-server/tree/1.0release" +#define RTMP_SIG_SRS_HTTP_SERVER "https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer#feature" +#define RTMP_SIG_SRS_VERSION __SRS_XSTR(VERSION_MAJOR)"."__SRS_XSTR(VERSION_MINOR)"."__SRS_XSTR(VERSION_REVISION) + +// internal macros, covert macro values to str, +// see: read https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification +#define __SRS_XSTR(v) __SRS_STR(v) +#define __SRS_STR(v) #v /** * the core provides the common defined macros, utilities, diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index c42056c5d..d1838f10e 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -491,17 +491,17 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int srs_version_major() { - return ::atoi(VERSION_MAJOR); + return VERSION_MAJOR; } int srs_version_minor() { - return ::atoi(VERSION_MINOR); + return VERSION_MINOR; } int srs_version_revision() { - return ::atoi(VERSION_REVISION); + return VERSION_REVISION; } int64_t srs_get_time_ms() diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 6cef9d9dd..7e6e269d9 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -60,75 +60,87 @@ SrsServer* _srs_server = new SrsServer(); void show_macro_features() { #ifdef SRS_AUTO_SSL - srs_trace("rtmp handshake: on"); + srs_trace("check feature rtmp handshake: on"); #else - srs_warn("rtmp handshake: off"); + srs_warn("check feature rtmp handshake: off"); #endif #ifdef SRS_AUTO_HLS - srs_trace("hls: on"); + srs_trace("check feature hls: on"); #else - srs_warn("hls: off"); + srs_warn("check feature hls: off"); #endif #ifdef SRS_AUTO_HTTP_CALLBACK - srs_trace("http callback: on"); + srs_trace("check feature http callback: on"); #else - srs_warn("http callback: off"); + srs_warn("check feature http callback: off"); #endif #ifdef SRS_AUTO_HTTP_API - srs_trace("http api: on"); + srs_trace("check feature http api: on"); #else - srs_warn("http api: off"); + srs_warn("check feature http api: off"); #endif #ifdef SRS_AUTO_HTTP_SERVER - srs_trace("http server: on"); + srs_trace("check feature http server: on"); #else - srs_warn("http server: off"); + srs_warn("check feature http server: off"); #endif #ifdef SRS_AUTO_HTTP_PARSER - srs_trace("http parser: on"); + srs_trace("check feature http parser: on"); #else - srs_warn("http parser: off"); + srs_warn("check feature http parser: off"); #endif #ifdef SRS_AUTO_DVR - srs_trace("dvr: on"); + srs_trace("check feature dvr: on"); #else - srs_warn("dvr: off"); + srs_warn("check feature dvr: off"); #endif #ifdef SRS_AUTO_TRANSCODE - srs_trace("transcode: on"); + srs_trace("check feature transcode: on"); #else - srs_warn("transcode: off"); + srs_warn("check feature transcode: off"); #endif #ifdef SRS_AUTO_INGEST - srs_trace("ingest: on"); + srs_trace("check feature ingest: on"); #else - srs_warn("ingest: off"); + srs_warn("check feature ingest: off"); #endif #ifdef SRS_AUTO_STAT - srs_trace("system stat: on"); + srs_trace("check feature system stat: on"); #else - srs_warn("system stat: off"); + srs_warn("check feature system stat: off"); #endif #ifdef SRS_AUTO_NGINX - srs_trace("compile nginx: on"); + srs_trace("check feature compile nginx: on"); #else - srs_warn("compile nginx: off"); + srs_warn("check feature compile nginx: off"); #endif #ifdef SRS_AUTO_FFMPEG_TOOL - srs_trace("compile ffmpeg: on"); + srs_trace("check feature compile ffmpeg: on"); #else - srs_warn("compile ffmpeg: off"); + srs_warn("check feature compile ffmpeg: off"); +#endif +} + +void check_macro_features() +{ + // for special features. +#ifdef SRS_AUTO_HTTP_SERVER + srs_warn("http server is dev feature, @see %s", RTMP_SIG_SRS_HTTP_SERVER); +#endif + +#if VERSION_MAJOR > 1 + srs_warn("SRS %s is develop branch, please use %s instead", RTMP_SIG_SRS_VERSION, RTMP_SIG_SRS_RELEASE); #endif } @@ -149,14 +161,12 @@ int main(int argc, char** argv) ProfilerStart("gperf.srs.gcp"); #endif -#ifdef SRS_AUTO_GPERF_MC - #ifdef SRS_AUTO_GPERF_MP +#if defined(SRS_AUTO_GPERF_MC) && defined(SRS_AUTO_GPERF_MP) srs_error("option --with-gmc confict with --with-gmp, " "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" "Note that since the heap-checker uses the heap-profiling framework internally, " "it is not possible to run both the heap-checker and heap profiler at the same time"); return -1; - #endif #endif // never use srs log(srs_trace, srs_error, etc) before config parse the option, @@ -190,12 +200,7 @@ int main(int argc, char** argv) // features show_macro_features(); - - // for special features. -#ifdef SRS_AUTO_HTTP_SERVER - srs_warn("http server is dev feature, " - "@see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer#feature"); -#endif + check_macro_features(); /** * we do nothing in the constructor of server,