正在显示
6 个修改的文件
包含
75 行增加
和
13 行删除
| @@ -68,15 +68,19 @@ __mfiles=`find modules -name "config"` && for __mfile in $__mfiles; do | @@ -68,15 +68,19 @@ __mfiles=`find modules -name "config"` && for __mfile in $__mfiles; do | ||
| 68 | done | 68 | done |
| 69 | 69 | ||
| 70 | # variables for makefile for all modules. | 70 | # variables for makefile for all modules. |
| 71 | -__mphonys="" && __mdefaults="" && __mcleanups="" | 71 | +__mphonys="" && __mdefaults="" && __mcleanups="" && __makefiles="" |
| 72 | # add each modules for application | 72 | # add each modules for application |
| 73 | for SRS_MODULE in ${SRS_MODULES[*]}; do | 73 | for SRS_MODULE in ${SRS_MODULES[*]}; do |
| 74 | echo "install module at: $SRS_MODULE" | 74 | echo "install module at: $SRS_MODULE" |
| 75 | . $SRS_MODULE/config | 75 | . $SRS_MODULE/config |
| 76 | - if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi | 76 | + if [[ $SRS_MODULE_MAKEFILE != "" ]]; then |
| 77 | + __makefiles="$__makefiles $SRS_MODULE_MAKEFILE" | ||
| 78 | + fi | ||
| 79 | + if [[ 0 -ne ${#SRS_MODULE_MAIN[@]} ]]; then | ||
| 77 | __mphonys="$__mphonys $SRS_MODULE_NAME" | 80 | __mphonys="$__mphonys $SRS_MODULE_NAME" |
| 78 | __mdefaults="$__mdefaults $SRS_MODULE_NAME" | 81 | __mdefaults="$__mdefaults $SRS_MODULE_NAME" |
| 79 | __mcleanups="$__mcleanups $SRS_MODULE_NAME" | 82 | __mcleanups="$__mcleanups $SRS_MODULE_NAME" |
| 83 | + fi | ||
| 80 | done | 84 | done |
| 81 | 85 | ||
| 82 | ##################################################################################### | 86 | ##################################################################################### |
| @@ -203,10 +207,12 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -203,10 +207,12 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
| 203 | MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") | 207 | MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") |
| 204 | ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot}) | 208 | ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot}) |
| 205 | MODULE_FILES=("srs_main_server" "srs_main_ingest_hls") | 209 | MODULE_FILES=("srs_main_server" "srs_main_ingest_hls") |
| 210 | + DEFINES="" | ||
| 206 | # add each modules for main | 211 | # add each modules for main |
| 207 | for SRS_MODULE in ${SRS_MODULES[*]}; do | 212 | for SRS_MODULE in ${SRS_MODULES[*]}; do |
| 208 | . $SRS_MODULE/config | 213 | . $SRS_MODULE/config |
| 209 | MODULE_FILES+=("${SRS_MODULE_MAIN[*]}") | 214 | MODULE_FILES+=("${SRS_MODULE_MAIN[*]}") |
| 215 | + DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}" | ||
| 210 | done | 216 | done |
| 211 | MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh | 217 | MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh |
| 212 | MAIN_OBJS="${MODULE_OBJS[@]}" | 218 | MAIN_OBJS="${MODULE_OBJS[@]}" |
| @@ -305,7 +311,7 @@ fi | @@ -305,7 +311,7 @@ fi | ||
| 305 | # the server, librtmp and utest | 311 | # the server, librtmp and utest |
| 306 | # where the bellow will check and disable some entry by only echo. | 312 | # where the bellow will check and disable some entry by only echo. |
| 307 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | 313 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} |
| 308 | -_default: server srs_ingest_hls librtmp utest $__mdefaults | 314 | +_default: server srs_ingest_hls librtmp utest __modules $__mdefaults |
| 309 | @bash objs/_srs_build_summary.sh | 315 | @bash objs/_srs_build_summary.sh |
| 310 | 316 | ||
| 311 | help: | 317 | help: |
| @@ -333,6 +339,14 @@ clean: | @@ -333,6 +339,14 @@ clean: | ||
| 333 | 339 | ||
| 334 | END | 340 | END |
| 335 | 341 | ||
| 342 | +# for Makefile of all modules. | ||
| 343 | +# depends on server, for some modules maybe use srs files. | ||
| 344 | +echo "__modules: server" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
| 345 | +for MMF in ${__makefiles[*]}; do | ||
| 346 | + echo " \$(MAKE) -f $MMF" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
| 347 | +done | ||
| 348 | +echo "" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
| 349 | + | ||
| 336 | # if export librtmp, donot build the srs server. | 350 | # if export librtmp, donot build the srs server. |
| 337 | if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then | 351 | if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then |
| 338 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} | 352 | cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} |
| @@ -4,9 +4,24 @@ SRS模块规则: | @@ -4,9 +4,24 @@ SRS模块规则: | ||
| 4 | 3. 所有的configure中的变量模块中可以使用 | 4 | 3. 所有的configure中的变量模块中可以使用 |
| 5 | 5 | ||
| 6 | 模块中需要定义变量,例如: | 6 | 模块中需要定义变量,例如: |
| 7 | -1. SRS_MODULE_NAME:模块名称,用来做Makefile的phony以及执行binary文件名。 | ||
| 8 | -2. SRS_MODULE_MAIN:模块的main函数所在的cpp文件,在src/main目录。 | ||
| 9 | -3. SRS_MODULE_APP:模块在src/app目录的源文件列表。 | ||
| 10 | -4. SRS_MODULE_DEFINES: 模块编译时的额外宏定义。 | 7 | +1. SRS_MODULE_NAME:模块名称,用来做Makefile的phony以及执行binary文件名。模块的二进制输出。为空时没有独立的二进制。 |
| 8 | +2. SRS_MODULE_MAIN:模块的main函数所在的cpp文件,在src/main目录。模块在main的文件。可以为空。 | ||
| 9 | +3. SRS_MODULE_APP:模块在src/app目录的源文件列表。模块在app的文件。可以为空。 | ||
| 10 | +4. SRS_MODULE_DEFINES: 模块编译时的额外宏定义。在app和main模块加入。可以为空。 | ||
| 11 | +5. SRS_MODULE_MAKEFILE: 模块的Makefile。在make时会执行这个Makefile。可以为空。 | ||
| 12 | + | ||
| 13 | +下面是一个实例: | ||
| 14 | +SRS_MODULE_NAME=("rtmfpd") | ||
| 15 | +SRS_MODULE_MAIN=("srs_main_rtmfpd") | ||
| 16 | +SRS_MODULE_APP=("srs_app_rtfmpd") | ||
| 17 | +SRS_MODULE_DEFINES="-DRTMFPD" | ||
| 18 | +SRS_MODULE_MAKEFILE="research/rtmfpd/Makefile" | ||
| 19 | + | ||
| 20 | +注意,在配置开头必须清空这些变量: | ||
| 21 | +SRS_MODULE_NAME=() | ||
| 22 | +SRS_MODULE_MAIN=() | ||
| 23 | +SRS_MODULE_APP=() | ||
| 24 | +SRS_MODULE_DEFINES="" | ||
| 25 | +SRS_MODULE_MAKEFILE="" | ||
| 11 | 26 | ||
| 12 | winlin, 2015.3 | 27 | winlin, 2015.3 |
| @@ -83,6 +83,15 @@ int main(int argc, char** argv) | @@ -83,6 +83,15 @@ int main(int argc, char** argv) | ||
| 83 | srs_flv_t flv = NULL; | 83 | srs_flv_t flv = NULL; |
| 84 | srs_rtmp_t rtmp = NULL; | 84 | srs_rtmp_t rtmp = NULL; |
| 85 | 85 | ||
| 86 | + // srs debug info. | ||
| 87 | + char srs_server_ip[128]; | ||
| 88 | + char srs_server[128]; | ||
| 89 | + char srs_primary[128]; | ||
| 90 | + char srs_authors[128]; | ||
| 91 | + char srs_version[32]; | ||
| 92 | + int srs_id = 0; | ||
| 93 | + int srs_pid = 0; | ||
| 94 | + | ||
| 86 | printf("dump rtmp stream to flv file\n"); | 95 | printf("dump rtmp stream to flv file\n"); |
| 87 | printf("srs(ossrs) client librtmp library.\n"); | 96 | printf("srs(ossrs) client librtmp library.\n"); |
| 88 | printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); | 97 | 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) | @@ -109,6 +118,13 @@ int main(int argc, char** argv) | ||
| 109 | const char* pageUrl = NULL; | 118 | const char* pageUrl = NULL; |
| 110 | srs_amf0_t args = NULL; | 119 | srs_amf0_t args = NULL; |
| 111 | 120 | ||
| 121 | + // set to zero. | ||
| 122 | + srs_server_ip[0] = 0; | ||
| 123 | + srs_server[0] = 0; | ||
| 124 | + srs_primary[0] = 0; | ||
| 125 | + srs_authors[0] = 0; | ||
| 126 | + srs_version[0] = 0; | ||
| 127 | + | ||
| 112 | int opt = 0; | 128 | int opt = 0; |
| 113 | int option_index = 0; | 129 | int option_index = 0; |
| 114 | while((opt = getopt_long(argc, argv, "hxr:o:s:t:p:C:", long_options, &option_index)) != -1){ | 130 | 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) | @@ -218,11 +234,14 @@ int main(int argc, char** argv) | ||
| 218 | goto rtmp_destroy; | 234 | goto rtmp_destroy; |
| 219 | } | 235 | } |
| 220 | 236 | ||
| 221 | - if (srs_rtmp_connect_app(rtmp) != 0) { | 237 | + |
| 238 | + if (srs_rtmp_connect_app2(rtmp, | ||
| 239 | + srs_server_ip, srs_server, srs_primary, srs_authors, srs_version, | ||
| 240 | + &srs_id, &srs_pid) != 0) { | ||
| 222 | srs_human_trace("connect vhost/app failed."); | 241 | srs_human_trace("connect vhost/app failed."); |
| 223 | goto rtmp_destroy; | 242 | goto rtmp_destroy; |
| 224 | } | 243 | } |
| 225 | - srs_human_trace("connect vhost/app success"); | 244 | + 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); |
| 226 | 245 | ||
| 227 | if (srs_rtmp_play_stream(rtmp) != 0) { | 246 | if (srs_rtmp_play_stream(rtmp) != 0) { |
| 228 | srs_human_trace("play stream failed."); | 247 | srs_human_trace("play stream failed."); |
| @@ -1924,6 +1924,13 @@ int SrsConfig::parse_options(int argc, char** argv) | @@ -1924,6 +1924,13 @@ int SrsConfig::parse_options(int argc, char** argv) | ||
| 1924 | fprintf(stderr, "%s\n", RTMP_SIG_SRS_VERSION); | 1924 | fprintf(stderr, "%s\n", RTMP_SIG_SRS_VERSION); |
| 1925 | exit(0); | 1925 | exit(0); |
| 1926 | } | 1926 | } |
| 1927 | + if (show_signature) { | ||
| 1928 | + fprintf(stderr, "%s\n", RTMP_SIG_SRS_SERVER); | ||
| 1929 | + exit(0); | ||
| 1930 | + } | ||
| 1931 | + | ||
| 1932 | + // first hello message. | ||
| 1933 | + srs_trace(RTMP_SIG_SRS_SERVER); | ||
| 1927 | 1934 | ||
| 1928 | if (config_file.empty()) { | 1935 | if (config_file.empty()) { |
| 1929 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 1936 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| @@ -3414,6 +3421,11 @@ int SrsConfig::parse_argv(int& i, char** argv) | @@ -3414,6 +3421,11 @@ int SrsConfig::parse_argv(int& i, char** argv) | ||
| 3414 | show_help = false; | 3421 | show_help = false; |
| 3415 | show_version = true; | 3422 | show_version = true; |
| 3416 | break; | 3423 | break; |
| 3424 | + case 'g': | ||
| 3425 | + case 'G': | ||
| 3426 | + show_help = false; | ||
| 3427 | + show_signature = true; | ||
| 3428 | + break; | ||
| 3417 | case 'c': | 3429 | case 'c': |
| 3418 | show_help = false; | 3430 | show_help = false; |
| 3419 | if (*p) { | 3431 | if (*p) { |
| @@ -3446,11 +3458,12 @@ void SrsConfig::print_help(char** argv) | @@ -3446,11 +3458,12 @@ void SrsConfig::print_help(char** argv) | ||
| 3446 | "Authors: "RTMP_SIG_SRS_AUTHROS"\n" | 3458 | "Authors: "RTMP_SIG_SRS_AUTHROS"\n" |
| 3447 | "Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_USER_CONFIGURE"\n" | 3459 | "Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_USER_CONFIGURE"\n" |
| 3448 | "Features:"SRS_AUTO_CONFIGURE"\n""\n" | 3460 | "Features:"SRS_AUTO_CONFIGURE"\n""\n" |
| 3449 | - "Usage: %s [-h?vV] [[-t] -c <filename>]\n" | 3461 | + "Usage: %s [-h?vVsS] [[-t] -c <filename>]\n" |
| 3450 | "\n" | 3462 | "\n" |
| 3451 | "Options:\n" | 3463 | "Options:\n" |
| 3452 | " -?, -h : show this help and exit(0)\n" | 3464 | " -?, -h : show this help and exit(0)\n" |
| 3453 | " -v, -V : show version and exit(0)\n" | 3465 | " -v, -V : show version and exit(0)\n" |
| 3466 | + " -g, -G : show server signature and exit(0)\n" | ||
| 3454 | " -t : test configuration file, exit(error_code).\n" | 3467 | " -t : test configuration file, exit(error_code).\n" |
| 3455 | " -c filename : use configuration file for SRS\n" | 3468 | " -c filename : use configuration file for SRS\n" |
| 3456 | "For srs-dolphin:\n" | 3469 | "For srs-dolphin:\n" |
| @@ -322,6 +322,10 @@ private: | @@ -322,6 +322,10 @@ private: | ||
| 322 | * whether show SRS version and exit. | 322 | * whether show SRS version and exit. |
| 323 | */ | 323 | */ |
| 324 | bool show_version; | 324 | bool show_version; |
| 325 | + /** | ||
| 326 | + * whether show SRS signature and exit. | ||
| 327 | + */ | ||
| 328 | + bool show_signature; | ||
| 325 | // global env variables. | 329 | // global env variables. |
| 326 | private: | 330 | private: |
| 327 | /** | 331 | /** |
| @@ -229,9 +229,6 @@ int main(int argc, char** argv) | @@ -229,9 +229,6 @@ int main(int argc, char** argv) | ||
| 229 | { | 229 | { |
| 230 | int ret = ERROR_SUCCESS; | 230 | int ret = ERROR_SUCCESS; |
| 231 | 231 | ||
| 232 | - // first hello message. | ||
| 233 | - srs_trace(RTMP_SIG_SRS_SERVER); | ||
| 234 | - | ||
| 235 | // TODO: support both little and big endian. | 232 | // TODO: support both little and big endian. |
| 236 | srs_assert(srs_is_little_endian()); | 233 | srs_assert(srs_is_little_endian()); |
| 237 | 234 |
-
请 注册 或 登录 后发表评论