show signature of server.

pull/609/head
winlin 9 years ago
parent 973194c663
commit 9d22d09646

26
trunk/configure vendored

@ -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}

@ -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

@ -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.");

@ -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 <filename>]\n"
"Usage: %s [-h?vVsS] [[-t] -c <filename>]\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"

@ -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:
/**

@ -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());

Loading…
Cancel
Save