diff --git a/trunk/configure b/trunk/configure index 9a5559d50..6052f4b2e 100755 --- a/trunk/configure +++ b/trunk/configure @@ -68,15 +68,19 @@ __mfiles=`find modules -name "config"` && for __mfile in $__mfiles; do done # variables for makefile for all modules. -__mphonys="" && __mdefaults="" && __mcleanups="" +__mphonys="" && __mdefaults="" && __mcleanups="" && __makefiles="" # add each modules for application for SRS_MODULE in ${SRS_MODULES[*]}; do echo "install module at: $SRS_MODULE" . $SRS_MODULE/config - if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi - __mphonys="$__mphonys $SRS_MODULE_NAME" - __mdefaults="$__mdefaults $SRS_MODULE_NAME" - __mcleanups="$__mcleanups $SRS_MODULE_NAME" + if [[ $SRS_MODULE_MAKEFILE != "" ]]; then + __makefiles="$__makefiles $SRS_MODULE_MAKEFILE" + fi + if [[ 0 -ne ${#SRS_MODULE_MAIN[@]} ]]; then + __mphonys="$__mphonys $SRS_MODULE_NAME" + __mdefaults="$__mdefaults $SRS_MODULE_NAME" + __mcleanups="$__mcleanups $SRS_MODULE_NAME" + fi done ##################################################################################### @@ -203,10 +207,12 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot}) MODULE_FILES=("srs_main_server" "srs_main_ingest_hls") + DEFINES="" # add each modules for main for SRS_MODULE in ${SRS_MODULES[*]}; do . $SRS_MODULE/config MODULE_FILES+=("${SRS_MODULE_MAIN[*]}") + DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}" done MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh MAIN_OBJS="${MODULE_OBJS[@]}" @@ -305,7 +311,7 @@ fi # the server, librtmp and utest # where the bellow will check and disable some entry by only echo. cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} -_default: server srs_ingest_hls librtmp utest $__mdefaults +_default: server srs_ingest_hls librtmp utest __modules $__mdefaults @bash objs/_srs_build_summary.sh help: @@ -333,6 +339,14 @@ clean: END +# for Makefile of all modules. +# depends on server, for some modules maybe use srs files. +echo "__modules: server" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} +for MMF in ${__makefiles[*]}; do + echo " \$(MAKE) -f $MMF" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} +done +echo "" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} + # if export librtmp, donot build the srs server. if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} diff --git a/trunk/modules/readme.txt b/trunk/modules/readme.txt index dd2f9b4e5..270ce56d4 100644 --- a/trunk/modules/readme.txt +++ b/trunk/modules/readme.txt @@ -4,9 +4,24 @@ SRS模块规则: 3. 所有的configure中的变量模块中可以使用 模块中需要定义变量,例如: -1. SRS_MODULE_NAME:模块名称,用来做Makefile的phony以及执行binary文件名。 -2. SRS_MODULE_MAIN:模块的main函数所在的cpp文件,在src/main目录。 -3. SRS_MODULE_APP:模块在src/app目录的源文件列表。 -4. SRS_MODULE_DEFINES: 模块编译时的额外宏定义。 +1. SRS_MODULE_NAME:模块名称,用来做Makefile的phony以及执行binary文件名。模块的二进制输出。为空时没有独立的二进制。 +2. SRS_MODULE_MAIN:模块的main函数所在的cpp文件,在src/main目录。模块在main的文件。可以为空。 +3. SRS_MODULE_APP:模块在src/app目录的源文件列表。模块在app的文件。可以为空。 +4. SRS_MODULE_DEFINES: 模块编译时的额外宏定义。在app和main模块加入。可以为空。 +5. SRS_MODULE_MAKEFILE: 模块的Makefile。在make时会执行这个Makefile。可以为空。 + +下面是一个实例: +SRS_MODULE_NAME=("rtmfpd") +SRS_MODULE_MAIN=("srs_main_rtmfpd") +SRS_MODULE_APP=("srs_app_rtfmpd") +SRS_MODULE_DEFINES="-DRTMFPD" +SRS_MODULE_MAKEFILE="research/rtmfpd/Makefile" + +注意,在配置开头必须清空这些变量: +SRS_MODULE_NAME=() +SRS_MODULE_MAIN=() +SRS_MODULE_APP=() +SRS_MODULE_DEFINES="" +SRS_MODULE_MAKEFILE="" winlin, 2015.3 diff --git a/trunk/research/librtmp/srs_rtmp_dump.c b/trunk/research/librtmp/srs_rtmp_dump.c index 9c2027414..74f776c50 100644 --- a/trunk/research/librtmp/srs_rtmp_dump.c +++ b/trunk/research/librtmp/srs_rtmp_dump.c @@ -83,6 +83,15 @@ int main(int argc, char** argv) srs_flv_t flv = NULL; srs_rtmp_t rtmp = NULL; + // srs debug info. + char srs_server_ip[128]; + char srs_server[128]; + char srs_primary[128]; + char srs_authors[128]; + char srs_version[32]; + int srs_id = 0; + int srs_pid = 0; + printf("dump rtmp stream to flv file\n"); printf("srs(ossrs) client librtmp library.\n"); printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); @@ -109,6 +118,13 @@ int main(int argc, char** argv) const char* pageUrl = NULL; srs_amf0_t args = NULL; + // set to zero. + srs_server_ip[0] = 0; + srs_server[0] = 0; + srs_primary[0] = 0; + srs_authors[0] = 0; + srs_version[0] = 0; + int opt = 0; int option_index = 0; while((opt = getopt_long(argc, argv, "hxr:o:s:t:p:C:", long_options, &option_index)) != -1){ @@ -218,11 +234,14 @@ int main(int argc, char** argv) goto rtmp_destroy; } - if (srs_rtmp_connect_app(rtmp) != 0) { + + if (srs_rtmp_connect_app2(rtmp, + srs_server_ip, srs_server, srs_primary, srs_authors, srs_version, + &srs_id, &srs_pid) != 0) { srs_human_trace("connect vhost/app failed."); goto rtmp_destroy; } - srs_human_trace("connect vhost/app success"); + srs_human_trace("connect ok, ip=%s, server=%s/%s, pid=%d, cid=%d", srs_server_ip, srs_server, srs_version, srs_pid, srs_id); if (srs_rtmp_play_stream(rtmp) != 0) { srs_human_trace("play stream failed."); diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 66dd8768c..5ef0281cb 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1924,6 +1924,13 @@ int SrsConfig::parse_options(int argc, char** argv) fprintf(stderr, "%s\n", RTMP_SIG_SRS_VERSION); exit(0); } + if (show_signature) { + fprintf(stderr, "%s\n", RTMP_SIG_SRS_SERVER); + exit(0); + } + + // first hello message. + srs_trace(RTMP_SIG_SRS_SERVER); if (config_file.empty()) { ret = ERROR_SYSTEM_CONFIG_INVALID; @@ -3414,6 +3421,11 @@ int SrsConfig::parse_argv(int& i, char** argv) show_help = false; show_version = true; break; + case 'g': + case 'G': + show_help = false; + show_signature = true; + break; case 'c': show_help = false; if (*p) { @@ -3446,11 +3458,12 @@ void SrsConfig::print_help(char** argv) "Authors: "RTMP_SIG_SRS_AUTHROS"\n" "Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_USER_CONFIGURE"\n" "Features:"SRS_AUTO_CONFIGURE"\n""\n" - "Usage: %s [-h?vV] [[-t] -c ]\n" + "Usage: %s [-h?vVsS] [[-t] -c ]\n" "\n" "Options:\n" " -?, -h : show this help and exit(0)\n" " -v, -V : show version and exit(0)\n" + " -g, -G : show server signature and exit(0)\n" " -t : test configuration file, exit(error_code).\n" " -c filename : use configuration file for SRS\n" "For srs-dolphin:\n" diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 3703f45c7..cfb353016 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -322,6 +322,10 @@ private: * whether show SRS version and exit. */ bool show_version; + /** + * whether show SRS signature and exit. + */ + bool show_signature; // global env variables. private: /** diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 9c2fa4f25..998d6464b 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -228,9 +228,6 @@ void show_macro_features() int main(int argc, char** argv) { int ret = ERROR_SUCCESS; - - // first hello message. - srs_trace(RTMP_SIG_SRS_SERVER); // TODO: support both little and big endian. srs_assert(srs_is_little_endian());