diff --git a/README.md b/README.md
index e873c04c5..fcb1b9c38 100755
--- a/README.md
+++ b/README.md
@@ -228,7 +228,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.
## History
-* v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp. 2.0.10.
+* v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp-project and --export-librtmp-single. 2.0.11.
* v2.0, 2014-11-08, fix [#66](https://github.com/winlinvip/simple-rtmp-server/issues/66), srs-librtmp support write h264 raw packet. 2.0.9.
* v2.0, 2014-10-25, fix [#185](https://github.com/winlinvip/simple-rtmp-server/issues/185), AMF0 support 0x0B the date type codec. 2.0.7.
* v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.6.
diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh
index 67b200d26..82b03b634 100755
--- a/trunk/auto/depends.sh
+++ b/trunk/auto/depends.sh
@@ -126,7 +126,7 @@ function Ubuntu_prepare()
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
@@ -217,14 +217,14 @@ function Centos_prepare()
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# st-1.9
#####################################################################################
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check the arm flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug
if [ $SRS_EMBEDED_CPU = YES ]; then
@@ -343,7 +343,7 @@ function write_nginx_html5()
END
}
# create the nginx dir, for http-server if not build nginx
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/nginx
fi
# make nginx
@@ -372,7 +372,7 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
fi
# the demo dir.
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
@@ -595,7 +595,7 @@ fi
#####################################################################################
# build research code, librtmp
#####################################################################################
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research
diff --git a/trunk/auto/generate-srs-librtmp-project.sh b/trunk/auto/generate-srs-librtmp-project.sh
new file mode 100755
index 000000000..af5b03e24
--- /dev/null
+++ b/trunk/auto/generate-srs-librtmp-project.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# when export srs-librtmp project
+# set the SRS_WORKDIR and SRS_OBJS,
+# then copy the srs-librtmp needed files.
+#
+# params:
+# $SRS_WORKDIR the work dir. ie. .
+# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
+# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
+# $SRS_EXPORT_LIBRTMP_PROJECT the export srs-librtmp project path. ie. srs-librtmp
+#
+
+if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
+ if [[ -d ${SRS_EXPORT_LIBRTMP_PROJECT} ]]; then
+ echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP_PROJECT}. ${BLACK}"
+ exit 1
+ fi
+ # create target
+ SRS_WORKDIR=${SRS_EXPORT_LIBRTMP_PROJECT} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&
+ # copy src to target
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} &&
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh auto/generate-srs-librtmp-single.sh ${_CPT} &&
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} &&
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} &&
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/rtmp && mkdir -p ${_CPT} && cp src/rtmp/* ${_CPT} &&
+ _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}
+ # check ret
+ ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
+fi
\ No newline at end of file
diff --git a/trunk/auto/generate-srs-librtmp-single.sh b/trunk/auto/generate-srs-librtmp-single.sh
new file mode 100755
index 000000000..c1bf02071
--- /dev/null
+++ b/trunk/auto/generate-srs-librtmp-single.sh
@@ -0,0 +1,130 @@
+#!/bin/bash
+
+# when export srs-librtmp single files
+# package the whole project to srs_librtmp.h and srs_librtmp.cpp
+#
+# params:
+# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
+# $SRS_EXPORT_LIBRTMP_SINGLE the export srs-librtmp single path. ie. srs-librtmp
+#
+
+# the target dir must created
+if [[ ! -d $SRS_EXPORT_LIBRTMP_SINGLE ]]; then
+ echo -e "${RED}error, target dir not created: $SRS_EXPORT_LIBRTMP_SINGLE${BLACK}"
+ exit -1
+fi
+
+# generate the srs_librtmp.h
+cp $SRS_EXPORT_LIBRTMP_SINGLE/src/libs/srs_librtmp.hpp $SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.h
+
+# create srs_librtmp.cpp
+FILE=$SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.cpp
+cat << END >$FILE
+/*
+The MIT License (MIT)
+
+Copyright (c) 2013-2014 winlin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "srs_librtmp.h"
+
+END
+# build objs auto files to cpp
+cat $SRS_EXPORT_LIBRTMP_SINGLE/$SRS_OBJS_DIR/srs_auto_headers.hpp >>$FILE
+ret=$?; if [[ $ret -ne 0 ]]; then
+ echo -e "${RED}failed to generate the srs_librtmp.cpp${BLACK}"
+ exit $ret
+fi
+# module to cpp files.
+function build_module_hpp()
+{
+ echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
+ for item in ${SRS_LIBRTMP_OBJS[*]}; do
+ FILE_NAME="${item%.*}"
+ echo "// following is generated by ${FILE_NAME}.hpp" >> $FILE &&
+ sed -i "s|#include >$FILE
+ ret=$?; if [[ $ret -ne 0 ]]; then
+ echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.hpp. {${BLACK}"
+ exit $ret
+ fi
+ done
+}
+SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_hpp
+SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_hpp
+SRS_LIBRTMP_OBJS="${RTMP_OBJS[@]}" && build_module_hpp
+SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_hpp
+# module to cpp files.
+function build_module_cpp()
+{
+ echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
+ for item in ${SRS_LIBRTMP_OBJS[*]}; do
+ FILE_NAME="${item%.*}"
+ echo "// following is generated by ${FILE_NAME}.cpp" >> $FILE &&
+ sed -i "s|#include >$FILE
+ ret=$?; if [[ $ret -ne 0 ]]; then
+ echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.cpp. {${BLACK}"
+ exit $ret
+ fi
+ done
+}
+SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_cpp
+SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_cpp
+SRS_LIBRTMP_OBJS="${RTMP_OBJS[@]}" && build_module_cpp
+SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_cpp
+
+# create example.cpp
+FILE=$SRS_EXPORT_LIBRTMP_SINGLE/example.c
+COMPILE='gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example'
+cat << END >$FILE
+/**
+# Example to use srs-librtmp
+# see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp
+${COMPILE}
+*/
+#include
+#include "srs_librtmp.h"
+
+int main(int argc, char** argv)
+{
+ printf("Example for srs-librtmp\n");
+ printf("SRS(simple-rtmp-server) client librtmp library.\n");
+ printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
+
+ srs_rtmp_t rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream");
+ srs_trace("create rtmp success");
+ srs_rtmp_destroy(rtmp);
+
+ return 0;
+}
+
+END
+
+# compile the example
+(cd $SRS_EXPORT_LIBRTMP_SINGLE && `${COMPILE}` && ./example && rm -f example)
+ret=$?; if [[ $ret -ne 0 ]]; then
+ echo "(cd $SRS_EXPORT_LIBRTMP_SINGLE && ${COMPILE} && ./example && rm -f example)"
+ echo -e "${RED}failed to compile example.${BLACK}"
+ exit $ret
+fi
+
+# clear the files for srs-librtmp project, generated by generate-srs-librtmp-project.sh
+(cd $SRS_EXPORT_LIBRTMP_SINGLE && rm -rf auto $SRS_OBJS_DIR research src Makefile)
diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh
index cbc667a10..dea0f89f3 100755
--- a/trunk/auto/options.sh
+++ b/trunk/auto/options.sh
@@ -58,8 +58,10 @@ SRS_LOG_TRACE=RESERVED
# experts
# donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL=NO
-# export the srs-librtmp to specified path, NO to disable it.
-SRS_EXPORT_LIBRTMP=NO
+# export the srs-librtmp to specified project, NO to disable it.
+SRS_EXPORT_LIBRTMP_PROJECT=NO
+# export the srs-librtmp to a single .h and .c, NO to disable it.
+SRS_EXPORT_LIBRTMP_SINGLE=NO
#
################################################################
# presets
@@ -183,8 +185,9 @@ Conflicts:
the complex tools not available for arm.
Experts:
- --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
- --export-librtmp= export srs-librtmp to specified path.
+ --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
+ --export-librtmp-project= export srs-librtmp to specified project in path.
+ --export-librtmp-single= export srs-librtmp to a single file(.h+.cpp) in path.
Workflow:
1. apply "Presets". if not specified, use default preset.
@@ -266,7 +269,8 @@ function parse_user_option() {
--full) SRS_ENABLE_ALL=YES ;;
--use-sys-ssl) SRS_USE_SYS_SSL=YES ;;
- --export-librtmp) SRS_EXPORT_LIBRTMP=${value} ;;
+ --export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
+ --export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
*)
echo "$0: error: invalid option \"$option\""
@@ -701,8 +705,13 @@ function apply_user_detail_options() {
export SRS_JOBS="--jobs=${SRS_JOBS}"
fi
+ # if specified export single file, export project first.
+ if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
+ SRS_EXPORT_LIBRTMP_PROJECT=$SRS_EXPORT_LIBRTMP_SINGLE
+ fi
+
# disable almost all features for export srs-librtmp.
- if [ $SRS_EXPORT_LIBRTMP != NO ]; then
+ if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
SRS_HLS=NO
SRS_DVR=NO
SRS_NGINX=NO
diff --git a/trunk/auto/summary.sh b/trunk/auto/summary.sh
index c4c55a04d..c7d5ac4f0 100755
--- a/trunk/auto/summary.sh
+++ b/trunk/auto/summary.sh
@@ -21,7 +21,7 @@ SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then
SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
cat < ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
diff --git a/trunk/configure b/trunk/configure
index 2987ab18e..482f91b68 100755
--- a/trunk/configure
+++ b/trunk/configure
@@ -25,30 +25,14 @@ BLACK="\\e[0m"
. auto/options.sh
# for export srs-librtmp, change target to it.
-if [ $SRS_EXPORT_LIBRTMP != NO ]; then
- if [[ -d ${SRS_EXPORT_LIBRTMP} ]]; then
- echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP}. ${BLACK}"
- exit 1
- fi
- # create target
- SRS_WORKDIR=${SRS_EXPORT_LIBRTMP} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&
- # copy src to target
- _CPT=${SRS_EXPORT_LIBRTMP}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} &&
- _CPT=${SRS_EXPORT_LIBRTMP}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh ${_CPT} &&
- _CPT=${SRS_EXPORT_LIBRTMP}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} &&
- _CPT=${SRS_EXPORT_LIBRTMP}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} &&
- _CPT=${SRS_EXPORT_LIBRTMP}/src/rtmp && mkdir -p ${_CPT} && cp src/rtmp/* ${_CPT} &&
- _CPT=${SRS_EXPORT_LIBRTMP}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}
- # check ret
- ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
-fi
+. auto/generate-srs-librtmp-project.sh
# the auto generated variables.
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# clean the exists, when not export srs-librtmp.
# do this only when the options is ok.
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [[ -f Makefile ]]; then
make clean
fi
@@ -186,7 +170,7 @@ clean:
END
# if export librtmp, donot build the srs server.
-if [ $SRS_EXPORT_LIBRTMP != NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
@@ -202,7 +186,7 @@ END
fi
# disable install entry for srs-librtmp
-if [ $SRS_EXPORT_LIBRTMP != NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall:
@echo "disable uninstall for srs-librtmp"
@@ -395,7 +379,7 @@ RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh
RTMP_OBJS="${MODULE_OBJS[@]}"
#
#App Module
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR})
@@ -418,7 +402,7 @@ LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
LIBS_OBJS="${MODULE_OBJS[@]}"
#
#Main Module
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot})
@@ -432,7 +416,7 @@ fi
# then link to a binary, for example, objs/srs
#
# disable all app when export librtmp
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all main entrances
MAIN_ENTRANCES=("srs_main_server")
#
@@ -464,13 +448,27 @@ if [ $SRS_UTEST = YES ]; then
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
fi
+# for srs-librtmp single file,
+# package the whole project to srs_librtmp.h and srs_librtmp.cpp
+if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
+ echo "package the whole project to srs_librtmp.h and srs_librtmp.cpp"
+ . $SRS_EXPORT_LIBRTMP_SINGLE/auto/generate-srs-librtmp-single.sh
+ echo -e "${GREEN}Please use the srs-librtmp files: ${BLACK}"
+ echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.h ${BLACK}"
+ echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.cpp ${BLACK}"
+ echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/example.c ${BLACK}"
+elif [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
+ echo -e "${GREEN}Please use the srs-librtmp project: ${BLACK}"
+ echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && make ${BLACK}"
+fi
+
echo 'configure ok! '
#####################################################################################
# when configure success, prepare build
#####################################################################################
# create objs/logs for ffmpeg to write log.
-if [ $SRS_EXPORT_LIBRTMP = NO ]; then
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/logs
fi
@@ -478,127 +476,131 @@ fi
# configure summary
#####################################################################################
# summary
-echo ""
-echo "configure summary:"
-echo " ${SRS_AUTO_USER_CONFIGURE}"
-echo " ${SRS_AUTO_CONFIGURE}"
-if [ $SRS_HLS = YES ]; then
- echo -e "${GREEN}HLS is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without HLS support${BLACK}"
-fi
-if [ $SRS_NGINX = YES ]; then
- echo -e "${GREEN}Nginx http server is enabled${BLACK}"
-else
- echo -e "${GREEN}note: Nginx http server is disabled${BLACK}"
-fi
-if [ $SRS_DVR = YES ]; then
- echo -e "${GREEN}DVR is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without DVR support${BLACK}"
-fi
-if [ $SRS_SSL = YES ]; then
- echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
-fi
-if [ $SRS_FFMPEG_TOOL = YES ]; then
- echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
-fi
-if [ $SRS_TRANSCODE = YES ]; then
- echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}"
-fi
-if [ $SRS_INGEST = YES ]; then
- echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}"
-fi
-if [ $SRS_HTTP_CALLBACK = YES ]; then
- echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
-fi
-if [ $SRS_HTTP_SERVER = YES ]; then
- echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}"
-fi
-if [ $SRS_HTTP_API = YES ]; then
- echo -e "${GREEN}http api to manage server is enabled${BLACK}"
-else
- echo -e "${YELLOW}warning: without http api to manage server support${BLACK}"
-fi
-if [ $SRS_LIBRTMP = YES ]; then
- echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}"
-else
- echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
-fi
-if [ $SRS_RESEARCH = YES ]; then
- echo -e "${GREEN}research tools are builded${BLACK}"
-else
- echo -e "${GREEN}note: research tools are not builded${BLACK}"
-fi
-if [ $SRS_UTEST = YES ]; then
- echo -e "${GREEN}utest for srs are builded${BLACK}"
-else
- echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
-fi
-if [ $SRS_GPERF = YES ]; then
- echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
-else
- echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}"
-fi
-if [ $SRS_GPERF_MC = YES ]; then
- echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
-else
- echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
-fi
-if [ $SRS_GPERF_MP = YES ]; then
- echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
-else
- echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
-fi
-if [ $SRS_GPERF_CP = YES ]; then
- echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
-else
- echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
-fi
-if [ $SRS_GPROF = YES ]; then
- echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
-else
- echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
-fi
-if [ $SRS_ARM_UBUNTU12 = YES ]; then
- echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}"
-else
- echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}"
-fi
-if [ $SRS_MIPS_UBUNTU12 = YES ]; then
- echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}"
-else
- echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}"
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
+ echo ""
+ echo "configure summary:"
+ echo " ${SRS_AUTO_USER_CONFIGURE}"
+ echo " ${SRS_AUTO_CONFIGURE}"
+ if [ $SRS_HLS = YES ]; then
+ echo -e "${GREEN}HLS is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without HLS support${BLACK}"
+ fi
+ if [ $SRS_NGINX = YES ]; then
+ echo -e "${GREEN}Nginx http server is enabled${BLACK}"
+ else
+ echo -e "${GREEN}note: Nginx http server is disabled${BLACK}"
+ fi
+ if [ $SRS_DVR = YES ]; then
+ echo -e "${GREEN}DVR is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without DVR support${BLACK}"
+ fi
+ if [ $SRS_SSL = YES ]; then
+ echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
+ fi
+ if [ $SRS_FFMPEG_TOOL = YES ]; then
+ echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
+ fi
+ if [ $SRS_TRANSCODE = YES ]; then
+ echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}"
+ fi
+ if [ $SRS_INGEST = YES ]; then
+ echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}"
+ fi
+ if [ $SRS_HTTP_CALLBACK = YES ]; then
+ echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
+ fi
+ if [ $SRS_HTTP_SERVER = YES ]; then
+ echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}"
+ fi
+ if [ $SRS_HTTP_API = YES ]; then
+ echo -e "${GREEN}http api to manage server is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}warning: without http api to manage server support${BLACK}"
+ fi
+ if [ $SRS_LIBRTMP = YES ]; then
+ echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}"
+ else
+ echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
+ fi
+ if [ $SRS_RESEARCH = YES ]; then
+ echo -e "${GREEN}research tools are builded${BLACK}"
+ else
+ echo -e "${GREEN}note: research tools are not builded${BLACK}"
+ fi
+ if [ $SRS_UTEST = YES ]; then
+ echo -e "${GREEN}utest for srs are builded${BLACK}"
+ else
+ echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_GPERF = YES ]; then
+ echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
+ else
+ echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_GPERF_MC = YES ]; then
+ echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
+ else
+ echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_GPERF_MP = YES ]; then
+ echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
+ else
+ echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_GPERF_CP = YES ]; then
+ echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
+ else
+ echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_GPROF = YES ]; then
+ echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
+ else
+ echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_ARM_UBUNTU12 = YES ]; then
+ echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}"
+ else
+ echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}"
+ fi
+ if [ $SRS_MIPS_UBUNTU12 = YES ]; then
+ echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}"
+ else
+ echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}"
+ fi
fi
#####################################################################################
# next step
#####################################################################################
-ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`
-echo ""
-echo "to run 3rdparty application:"
-if [ $SRS_NGINX = YES ]; then
- echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
-fi
-if [ $SRS_FFMPEG_TOOL = YES ]; then
- echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding"
-fi
-if [ $SRS_HTTP_CALLBACK = YES ]; then
- echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server"
+if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
+ ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`
+ echo ""
+ echo "to run 3rdparty application:"
+ if [ $SRS_NGINX = YES ]; then
+ echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
+ fi
+ if [ $SRS_FFMPEG_TOOL = YES ]; then
+ echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding"
+ fi
+ if [ $SRS_HTTP_CALLBACK = YES ]; then
+ echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server"
+ fi
+ echo ""
+ echo "to build:"
+ echo "\" make \" to build the srs(simple rtmp server)."
+ echo "\" make help \" to get the usage of make"
fi
-echo ""
-echo "to build:"
-echo "\" make \" to build the srs(simple rtmp server)."
-echo "\" make help \" to get the usage of make"
diff --git a/trunk/research/librtmp/srs_bandwidth_check.c b/trunk/research/librtmp/srs_bandwidth_check.c
index 7b863eb76..3ce5d66eb 100644
--- a/trunk/research/librtmp/srs_bandwidth_check.c
+++ b/trunk/research/librtmp/srs_bandwidth_check.c
@@ -80,31 +80,31 @@ int main(int argc, char** argv)
rtmp = srs_rtmp_create2(argv[1]);
- srs_trace("bandwidth check/test url: %s", argv[1]);
+ srs_lib_trace("bandwidth check/test url: %s", argv[1]);
if ((ret = srs_simple_handshake(rtmp)) != 0) {
- srs_trace("simple handshake failed.");
+ srs_lib_trace("simple handshake failed.");
goto rtmp_destroy;
}
- srs_trace("simple handshake success");
+ srs_lib_trace("simple handshake success");
if ((ret = srs_connect_app2(rtmp,
srs_server_ip, srs_server, srs_primary_authors, srs_version, &srs_id, &srs_pid)) != 0) {
- srs_trace("connect vhost/app failed.");
+ srs_lib_trace("connect vhost/app failed.");
goto rtmp_destroy;
}
- srs_trace("connect vhost/app success");
+ srs_lib_trace("connect vhost/app success");
if ((ret = srs_bandwidth_check(rtmp,
&start_time, &end_time, &play_kbps, &publish_kbps,
&play_bytes, &publish_bytes, &play_duration, &publish_duration)) != 0
) {
- srs_trace("bandwidth check/test failed.");
+ srs_lib_trace("bandwidth check/test failed.");
goto rtmp_destroy;
}
- srs_trace("bandwidth check/test success");
+ srs_lib_trace("bandwidth check/test success");
- srs_trace("\n%s, %s\n"
+ srs_lib_trace("\n%s, %s\n"
"%s, %s, srs_pid=%d, srs_id=%d\n"
"duration: %dms(%d+%d)\n"
"play: %dkbps\n"
@@ -136,8 +136,8 @@ rtmp_destroy:
(int)(end_time - start_time), play_duration, publish_duration,
play_kbps, publish_kbps);
- srs_trace("");
- srs_trace("completed");
+ srs_lib_trace("");
+ srs_lib_trace("completed");
return ret;
}
diff --git a/trunk/research/librtmp/srs_detect_rtmp.c b/trunk/research/librtmp/srs_detect_rtmp.c
index 13a2d6818..a1b12d121 100644
--- a/trunk/research/librtmp/srs_detect_rtmp.c
+++ b/trunk/research/librtmp/srs_detect_rtmp.c
@@ -79,55 +79,55 @@ int main(int argc, char** argv)
duration = atoi(argv[2]);
timeout = atoi(argv[3]);
- srs_trace("rtmp url: %s", rtmp_url);
- srs_trace("duration: %ds, timeout:%ds", duration, timeout);
+ srs_lib_trace("rtmp url: %s", rtmp_url);
+ srs_lib_trace("duration: %ds, timeout:%ds", duration, timeout);
if (duration <= 0 || timeout <= 0) {
- srs_trace("duration and timeout must be positive.");
+ srs_lib_trace("duration and timeout must be positive.");
exit(-2);
}
rtmp = srs_rtmp_create(rtmp_url);
if ((ret = __srs_dns_resolve(rtmp)) != 0) {
- srs_trace("dns resolve failed. ret=%d", ret);
+ srs_lib_trace("dns resolve failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("dns resolve success");
+ srs_lib_trace("dns resolve success");
time_dns_resolve = srs_get_time_ms();
if ((ret = __srs_connect_server(rtmp)) != 0) {
- srs_trace("socket connect failed. ret=%d", ret);
+ srs_lib_trace("socket connect failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("socket connect success");
+ srs_lib_trace("socket connect success");
time_socket_connect = srs_get_time_ms();
if ((ret = __srs_do_simple_handshake(rtmp)) != 0) {
- srs_trace("do simple handshake failed. ret=%d", ret);
+ srs_lib_trace("do simple handshake failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("do simple handshake success");
+ srs_lib_trace("do simple handshake success");
if ((ret = srs_connect_app(rtmp)) != 0) {
- srs_trace("connect vhost/app failed. ret=%d", ret);
+ srs_lib_trace("connect vhost/app failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("connect vhost/app success");
+ srs_lib_trace("connect vhost/app success");
if ((ret = srs_play_stream(rtmp)) != 0) {
- srs_trace("play stream failed. ret=%d", ret);
+ srs_lib_trace("play stream failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("play stream success");
+ srs_lib_trace("play stream success");
time_play_stream = srs_get_time_ms();
for (;;) {
if ((ret = srs_read_packet(rtmp, &type, ×tamp, &data, &size)) != 0) {
- srs_trace("read packet failed. ret=%d", ret);
+ srs_lib_trace("read packet failed. ret=%d", ret);
goto rtmp_destroy;
}
- srs_trace("got packet: type=%s, time=%d, size=%d",
+ srs_lib_trace("got packet: type=%s, time=%d, size=%d",
srs_type2string(type), timestamp, size);
if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) {
@@ -142,12 +142,12 @@ int main(int argc, char** argv)
free(data);
if (srs_get_time_ms() - time_startup > timeout * 1000) {
- srs_trace("timeout, terminate.");
+ srs_lib_trace("timeout, terminate.");
goto rtmp_destroy;
}
if ((timestamp - basetime) > duration * 1000) {
- srs_trace("duration exceed, terminate.");
+ srs_lib_trace("duration exceed, terminate.");
goto rtmp_destroy;
}
}
@@ -196,8 +196,8 @@ rtmp_destroy:
"\"remark2\": \"if code is not 0, user must ignore all data\""
);
- srs_trace("");
- srs_trace("completed");
+ srs_lib_trace("");
+ srs_lib_trace("completed");
return ret;
}
diff --git a/trunk/research/librtmp/srs_flv_injecter.c b/trunk/research/librtmp/srs_flv_injecter.c
index e053ee047..8d78ce2c1 100644
--- a/trunk/research/librtmp/srs_flv_injecter.c
+++ b/trunk/research/librtmp/srs_flv_injecter.c
@@ -76,9 +76,9 @@ int main(int argc, char** argv)
tmp_file = (char*)malloc(tmp_file_size);
snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file);
- srs_trace("input: %s", in_flv_file);
- srs_trace("output: %s", out_flv_file);
- srs_trace("tmp_file: %s", tmp_file);
+ srs_lib_trace("input: %s", in_flv_file);
+ srs_lib_trace("output: %s", out_flv_file);
+ srs_lib_trace("tmp_file: %s", tmp_file);
ret = process(in_flv_file, tmp_file, &ic, &oc);
@@ -89,13 +89,13 @@ int main(int argc, char** argv)
unlink(tmp_file);
if (ret == ERROR_INJECTED) {
ret = 0;
- srs_trace("file already injected.");
+ srs_lib_trace("file already injected.");
} else {
- srs_trace("error, remove tmp file.");
+ srs_lib_trace("error, remove tmp file.");
}
} else {
rename(tmp_file, out_flv_file);
- srs_trace("completed, rename to %s", out_flv_file);
+ srs_lib_trace("completed, rename to %s", out_flv_file);
}
free(tmp_file);
@@ -123,14 +123,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s
if ((ic = srs_flv_open_read(in_flv_file)) == NULL) {
ret = 2;
- srs_trace("open input flv file failed. ret=%d", ret);
+ srs_lib_trace("open input flv file failed. ret=%d", ret);
return ret;
}
*pic = ic;
if ((oc = srs_flv_open_write(out_flv_file)) == NULL) {
ret = 2;
- srs_trace("open output flv file failed. ret=%d", ret);
+ srs_lib_trace("open output flv file failed. ret=%d", ret);
return ret;
}
*poc = oc;
@@ -164,13 +164,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata)
*pname = srs_amf0_parse(data, size, &nparsed);
if (*pname == NULL || nparsed >= size) {
- srs_trace("invalid amf0 name data.");
+ srs_lib_trace("invalid amf0 name data.");
return -1;
}
*pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
if (*pdata == NULL || nparsed > size) {
- srs_trace("invalid amf0 value data");
+ srs_lib_trace("invalid amf0 value data");
return -1;
}
@@ -206,22 +206,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0
return ret;
}
- srs_trace("build keyframe infos from flv");
+ srs_lib_trace("build keyframe infos from flv");
for (;;) {
offset = srs_flv_tellg(ic);
// tag header
if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) {
if (srs_flv_is_eof(ret)) {
- srs_trace("parse completed.");
+ srs_lib_trace("parse completed.");
return 0;
}
- srs_trace("flv get packet failed. ret=%d", ret);
+ srs_lib_trace("flv get packet failed. ret=%d", ret);
return ret;
}
if (size <= 0) {
- srs_trace("invalid size=%d", size);
+ srs_lib_trace("invalid size=%d", size);
return ret;
}
@@ -343,20 +343,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a
free(data);
}
- srs_trace("build keyframe infos from flv");
+ srs_lib_trace("build keyframe infos from flv");
for (;;) {
// tag header
if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) {
if (srs_flv_is_eof(ret)) {
- srs_trace("parse completed.");
+ srs_lib_trace("parse completed.");
return 0;
}
- srs_trace("flv get packet failed. ret=%d", ret);
+ srs_lib_trace("flv get packet failed. ret=%d", ret);
return ret;
}
if (size <= 0) {
- srs_trace("invalid size=%d", size);
+ srs_lib_trace("invalid size=%d", size);
break;
}
diff --git a/trunk/research/librtmp/srs_flv_parser.c b/trunk/research/librtmp/srs_flv_parser.c
index abfca6a1b..fa4acd86a 100644
--- a/trunk/research/librtmp/srs_flv_parser.c
+++ b/trunk/research/librtmp/srs_flv_parser.c
@@ -61,11 +61,11 @@ int main(int argc, char** argv)
}
in_flv_file = argv[1];
- srs_trace("input: %s", in_flv_file);
+ srs_lib_trace("input: %s", in_flv_file);
if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
ret = 2;
- srs_trace("open flv file failed. ret=%d", ret);
+ srs_lib_trace("open flv file failed. ret=%d", ret);
return ret;
}
@@ -147,12 +147,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset)
// amf0
amf0_name = srs_amf0_parse(data, size, &nparsed);
if (amf0_name == NULL || nparsed >= size) {
- srs_trace("invalid amf0 name data.");
+ srs_lib_trace("invalid amf0 name data.");
return -1;
}
amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
- srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
+ srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
"offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s",
srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size,
(int)offset, hbuf, tbuf,
@@ -178,7 +178,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset)
// bytes
parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
- srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
+ srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
"offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size,
(int)offset, hbuf, tbuf);
@@ -196,7 +196,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset)
// bytes
parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
- srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
+ srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
"offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size,
(int)offset, hbuf, tbuf);
@@ -221,22 +221,22 @@ int parse_flv(srs_flv_t flv)
return ret;
}
- srs_trace("start parse flv");
+ srs_lib_trace("start parse flv");
for (;;) {
offset = srs_flv_tellg(flv);
// tag header
if ((ret = srs_flv_read_tag_header(flv, &type, &size, ×tamp)) != 0) {
if (srs_flv_is_eof(ret)) {
- srs_trace("parse completed.");
+ srs_lib_trace("parse completed.");
return 0;
}
- srs_trace("flv get packet failed. ret=%d", ret);
+ srs_lib_trace("flv get packet failed. ret=%d", ret);
return ret;
}
if (size <= 0) {
- srs_trace("invalid size=%d", size);
+ srs_lib_trace("invalid size=%d", size);
break;
}
diff --git a/trunk/research/librtmp/srs_h264_raw_publish.c b/trunk/research/librtmp/srs_h264_raw_publish.c
index a2b71829e..db16b9025 100644
--- a/trunk/research/librtmp/srs_h264_raw_publish.c
+++ b/trunk/research/librtmp/srs_h264_raw_publish.c
@@ -44,7 +44,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
// we search the h264 frame from the buffer which cached the h264 data.
// please get h264 raw data from device, it always a encoded frame.
if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) {
- srs_trace("h264 raw data invalid.");
+ srs_lib_trace("h264 raw data invalid.");
return -1;
}
@@ -63,7 +63,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
*pp = p;
*frame_size = p - *frame;
if (*frame_size <= 0) {
- srs_trace("h264 raw data invalid.");
+ srs_lib_trace("h264 raw data invalid.");
return -1;
}
@@ -95,32 +95,32 @@ int main(int argc, char** argv)
const char* raw_file = argv[1];
const char* rtmp_url = argv[2];
- srs_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url);
+ srs_lib_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url);
// open file
int raw_fd = open(raw_file, O_RDONLY);
if (raw_fd < 0) {
- srs_trace("open h264 raw file %s failed.", raw_fd);
+ srs_lib_trace("open h264 raw file %s failed.", raw_fd);
goto rtmp_destroy;
}
off_t file_size = lseek(raw_fd, 0, SEEK_END);
if (file_size <= 0) {
- srs_trace("h264 raw file %s empty.", raw_file);
+ srs_lib_trace("h264 raw file %s empty.", raw_file);
goto rtmp_destroy;
}
- srs_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
+ srs_lib_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
char* h264_raw = (char*)malloc(file_size);
if (!h264_raw) {
- srs_trace("alloc raw buffer failed for file %s.", raw_file);
+ srs_lib_trace("alloc raw buffer failed for file %s.", raw_file);
goto rtmp_destroy;
}
lseek(raw_fd, 0, SEEK_SET);
ssize_t nb_read = 0;
if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
- srs_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
+ srs_lib_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
raw_file, (int)(file_size / 1024), (int)(nb_read / 1024));
goto rtmp_destroy;
}
@@ -129,22 +129,22 @@ int main(int argc, char** argv)
srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url);
if (srs_simple_handshake(rtmp) != 0) {
- srs_trace("simple handshake failed.");
+ srs_lib_trace("simple handshake failed.");
goto rtmp_destroy;
}
- srs_trace("simple handshake success");
+ srs_lib_trace("simple handshake success");
if (srs_connect_app(rtmp) != 0) {
- srs_trace("connect vhost/app failed.");
+ srs_lib_trace("connect vhost/app failed.");
goto rtmp_destroy;
}
- srs_trace("connect vhost/app success");
+ srs_lib_trace("connect vhost/app success");
if (srs_publish_stream(rtmp) != 0) {
- srs_trace("publish stream failed.");
+ srs_lib_trace("publish stream failed.");
goto rtmp_destroy;
}
- srs_trace("publish stream success");
+ srs_lib_trace("publish stream success");
u_int32_t dts = 0;
u_int32_t pts = 0;
@@ -161,27 +161,27 @@ int main(int argc, char** argv)
if (read_h264_frame(h264_raw, file_size, &p, &nb_start_code, fps,
&data, &size, &dts, &pts) < 0
) {
- srs_trace("read a frame from file buffer failed.");
+ srs_lib_trace("read a frame from file buffer failed.");
goto rtmp_destroy;
}
// send out the h264 packet over RTMP
if (srs_write_h264_raw_frames(rtmp, data, size, dts, pts) != 0) {
- srs_trace("send h264 raw data failed.");
+ srs_lib_trace("send h264 raw data failed.");
goto rtmp_destroy;
}
// 5bits, 7.3.1 NAL unit syntax,
// H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
u_int8_t nut = (char)data[nb_start_code] & 0x1f;
- srs_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)",
+ srs_lib_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)",
srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code],
(nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown")))));
// @remark, when use encode device, it not need to sleep.
usleep(1000 / fps * 1000);
}
- srs_trace("h264 raw data completed");
+ srs_lib_trace("h264 raw data completed");
rtmp_destroy:
srs_rtmp_destroy(rtmp);
diff --git a/trunk/research/librtmp/srs_ingest_flv.c b/trunk/research/librtmp/srs_ingest_flv.c
index 669b960d2..95f6d69bc 100644
--- a/trunk/research/librtmp/srs_ingest_flv.c
+++ b/trunk/research/librtmp/srs_ingest_flv.c
@@ -89,19 +89,19 @@ int main(int argc, char** argv)
}
}
- srs_trace("input: %s", in_flv_file);
- srs_trace("output: %s", out_rtmp_url);
+ srs_lib_trace("input: %s", in_flv_file);
+ srs_lib_trace("output: %s", out_rtmp_url);
if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
ret = 2;
- srs_trace("open flv file failed. ret=%d", ret);
+ srs_lib_trace("open flv file failed. ret=%d", ret);
return ret;
}
ortmp = srs_rtmp_create(out_rtmp_url);
ret = proxy(flv, ortmp);
- srs_trace("ingest flv to RTMP completed");
+ srs_lib_trace("ingest flv to RTMP completed");
srs_rtmp_destroy(ortmp);
srs_flv_close(flv);
@@ -118,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
int size;
char* data = NULL;
- srs_trace("start ingest flv to RTMP stream");
+ srs_lib_trace("start ingest flv to RTMP stream");
for (;;) {
// tag header
if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) {
if (srs_flv_is_eof(ret)) {
- srs_trace("parse completed.");
+ srs_lib_trace("parse completed.");
return 0;
}
- srs_trace("flv get packet failed. ret=%d", ret);
+ srs_lib_trace("flv get packet failed. ret=%d", ret);
return ret;
}
if (size <= 0) {
- srs_trace("invalid size=%d", size);
+ srs_lib_trace("invalid size=%d", size);
break;
}
@@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
}
if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) {
- srs_trace("irtmp get packet failed. ret=%d", ret);
+ srs_lib_trace("irtmp get packet failed. ret=%d", ret);
return ret;
}
- srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
+ srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
srs_type2string(type), *ptimestamp, size);
re_update(re, *ptimestamp);
@@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp)
int ret = 0;
if ((ret = srs_simple_handshake(ortmp)) != 0) {
- srs_trace("ortmp simple handshake failed. ret=%d", ret);
+ srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp simple handshake success");
+ srs_lib_trace("ortmp simple handshake success");
if ((ret = srs_connect_app(ortmp)) != 0) {
- srs_trace("ortmp connect vhost/app failed. ret=%d", ret);
+ srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp connect vhost/app success");
+ srs_lib_trace("ortmp connect vhost/app success");
if ((ret = srs_publish_stream(ortmp)) != 0) {
- srs_trace("ortmp publish stream failed. ret=%d", ret);
+ srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp publish stream success");
+ srs_lib_trace("ortmp publish stream success");
return ret;
}
@@ -209,16 +209,16 @@ int64_t re_create()
// use the starttime to get the deviation
int64_t deviation = re - tools_main_entrance_startup_time;
- srs_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
+ srs_lib_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
// so, we adjust time to max(0, deviation)
// because the last pulse, we already sleeped
int adjust = (int)(deviation);
if (adjust > 0) {
- srs_trace("adjust re time for %d ms", adjust);
+ srs_lib_trace("adjust re time for %d ms", adjust);
re -= adjust;
} else {
- srs_trace("no need to adjust re time");
+ srs_lib_trace("no need to adjust re time");
}
return re;
@@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time)
int64_t now = srs_get_time_ms();
int64_t diff = time - (now -re);
if (diff > 0) {
- srs_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
+ srs_lib_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
usleep(diff * 1000);
}
}
diff --git a/trunk/research/librtmp/srs_ingest_rtmp.c b/trunk/research/librtmp/srs_ingest_rtmp.c
index 1f3470480..48a370238 100644
--- a/trunk/research/librtmp/srs_ingest_rtmp.c
+++ b/trunk/research/librtmp/srs_ingest_rtmp.c
@@ -74,14 +74,14 @@ int main(int argc, char** argv)
}
}
- srs_trace("input: %s", in_rtmp_url);
- srs_trace("output: %s", out_rtmp_url);
+ srs_lib_trace("input: %s", in_rtmp_url);
+ srs_lib_trace("output: %s", out_rtmp_url);
irtmp = srs_rtmp_create(in_rtmp_url);
ortmp = srs_rtmp_create(out_rtmp_url);
ret = proxy(irtmp, ortmp);
- srs_trace("proxy completed");
+ srs_lib_trace("proxy completed");
srs_rtmp_destroy(irtmp);
srs_rtmp_destroy(ortmp);
@@ -105,20 +105,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
return ret;
}
- srs_trace("start proxy RTMP stream");
+ srs_lib_trace("start proxy RTMP stream");
for (;;) {
if ((ret = srs_read_packet(irtmp, &type, ×tamp, &data, &size)) != 0) {
- srs_trace("irtmp get packet failed. ret=%d", ret);
+ srs_lib_trace("irtmp get packet failed. ret=%d", ret);
return ret;
}
- srs_verbose("irtmp got packet: type=%s, time=%d, size=%d",
+ srs_lib_verbose("irtmp got packet: type=%s, time=%d, size=%d",
srs_type2string(type), timestamp, size);
if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) {
- srs_trace("irtmp get packet failed. ret=%d", ret);
+ srs_lib_trace("irtmp get packet failed. ret=%d", ret);
return ret;
}
- srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
+ srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
srs_type2string(type), timestamp, size);
}
@@ -130,22 +130,22 @@ int connect_ic(srs_rtmp_t irtmp)
int ret = 0;
if ((ret = srs_simple_handshake(irtmp)) != 0) {
- srs_trace("irtmp simple handshake failed. ret=%d", ret);
+ srs_lib_trace("irtmp simple handshake failed. ret=%d", ret);
return ret;
}
- srs_trace("irtmp simple handshake success");
+ srs_lib_trace("irtmp simple handshake success");
if ((ret = srs_connect_app(irtmp)) != 0) {
- srs_trace("irtmp connect vhost/app failed. ret=%d", ret);
+ srs_lib_trace("irtmp connect vhost/app failed. ret=%d", ret);
return ret;
}
- srs_trace("irtmp connect vhost/app success");
+ srs_lib_trace("irtmp connect vhost/app success");
if ((ret = srs_play_stream(irtmp)) != 0) {
- srs_trace("irtmp play stream failed. ret=%d", ret);
+ srs_lib_trace("irtmp play stream failed. ret=%d", ret);
return ret;
}
- srs_trace("irtmp play stream success");
+ srs_lib_trace("irtmp play stream success");
return ret;
}
@@ -155,22 +155,22 @@ int connect_oc(srs_rtmp_t ortmp)
int ret = 0;
if ((ret = srs_simple_handshake(ortmp)) != 0) {
- srs_trace("ortmp simple handshake failed. ret=%d", ret);
+ srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp simple handshake success");
+ srs_lib_trace("ortmp simple handshake success");
if ((ret = srs_connect_app(ortmp)) != 0) {
- srs_trace("ortmp connect vhost/app failed. ret=%d", ret);
+ srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp connect vhost/app success");
+ srs_lib_trace("ortmp connect vhost/app success");
if ((ret = srs_publish_stream(ortmp)) != 0) {
- srs_trace("ortmp publish stream failed. ret=%d", ret);
+ srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
return ret;
}
- srs_trace("ortmp publish stream success");
+ srs_lib_trace("ortmp publish stream success");
return ret;
}
diff --git a/trunk/research/librtmp/srs_play.c b/trunk/research/librtmp/srs_play.c
index 7bf431f58..1106f3a22 100644
--- a/trunk/research/librtmp/srs_play.c
+++ b/trunk/research/librtmp/srs_play.c
@@ -44,26 +44,26 @@ int main(int argc, char** argv)
exit(-1);
}
- srs_trace("rtmp url: %s", argv[1]);
+ srs_lib_trace("rtmp url: %s", argv[1]);
srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
if (srs_simple_handshake(rtmp) != 0) {
- srs_trace("simple handshake failed.");
+ srs_lib_trace("simple handshake failed.");
goto rtmp_destroy;
}
- srs_trace("simple handshake success");
+ srs_lib_trace("simple handshake success");
if (srs_connect_app(rtmp) != 0) {
- srs_trace("connect vhost/app failed.");
+ srs_lib_trace("connect vhost/app failed.");
goto rtmp_destroy;
}
- srs_trace("connect vhost/app success");
+ srs_lib_trace("connect vhost/app success");
if (srs_play_stream(rtmp) != 0) {
- srs_trace("play stream failed.");
+ srs_lib_trace("play stream failed.");
goto rtmp_destroy;
}
- srs_trace("play stream success");
+ srs_lib_trace("play stream success");
for (;;) {
int type, size;
@@ -73,7 +73,7 @@ int main(int argc, char** argv)
if (srs_read_packet(rtmp, &type, ×tamp, &data, &size) != 0) {
goto rtmp_destroy;
}
- srs_trace("got packet: type=%s, time=%d, size=%d",
+ srs_lib_trace("got packet: type=%s, time=%d, size=%d",
srs_type2string(type), timestamp, size);
free(data);
diff --git a/trunk/research/librtmp/srs_publish.c b/trunk/research/librtmp/srs_publish.c
index 85e2d3d88..0865a4b98 100644
--- a/trunk/research/librtmp/srs_publish.c
+++ b/trunk/research/librtmp/srs_publish.c
@@ -47,31 +47,31 @@ int main(int argc, char** argv)
// warn it .
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/126
- srs_trace("\033[33m%s\033[0m",
+ srs_lib_trace("\033[33m%s\033[0m",
"[warning] it's only a sample to use librtmp. "
"please never use it to publish and test forward/transcode/edge/HLS whatever. "
"you should refer to this tool to use the srs-librtmp to publish the real media stream."
"read about: https://github.com/winlinvip/simple-rtmp-server/issues/126");
- srs_trace("rtmp url: %s", argv[1]);
+ srs_lib_trace("rtmp url: %s", argv[1]);
srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
if (srs_simple_handshake(rtmp) != 0) {
- srs_trace("simple handshake failed.");
+ srs_lib_trace("simple handshake failed.");
goto rtmp_destroy;
}
- srs_trace("simple handshake success");
+ srs_lib_trace("simple handshake success");
if (srs_connect_app(rtmp) != 0) {
- srs_trace("connect vhost/app failed.");
+ srs_lib_trace("connect vhost/app failed.");
goto rtmp_destroy;
}
- srs_trace("connect vhost/app success");
+ srs_lib_trace("connect vhost/app success");
if (srs_publish_stream(rtmp) != 0) {
- srs_trace("publish stream failed.");
+ srs_lib_trace("publish stream failed.");
goto rtmp_destroy;
}
- srs_trace("publish stream success");
+ srs_lib_trace("publish stream success");
u_int32_t timestamp = 0;
for (;;) {
@@ -84,7 +84,7 @@ int main(int argc, char** argv)
if (srs_write_packet(rtmp, type, timestamp, data, size) != 0) {
goto rtmp_destroy;
}
- srs_trace("sent packet: type=%s, time=%d, size=%d",
+ srs_lib_trace("sent packet: type=%s, time=%d, size=%d",
srs_type2string(type), timestamp, size);
usleep(40 * 1000);
diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp
index 993aed8b0..3cae04a8c 100644
--- a/trunk/src/core/srs_core.hpp
+++ b/trunk/src/core/srs_core.hpp
@@ -31,7 +31,7 @@ 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 10
+#define VERSION_REVISION 12
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp
index 87a567968..38e75542c 100644
--- a/trunk/src/libs/srs_librtmp.cpp
+++ b/trunk/src/libs/srs_librtmp.cpp
@@ -30,10 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include
using namespace std;
-// undefine the log of librtmp for the srs use its log.
-#undef srs_trace
-#undef srs_verbose
-
#include
#include
#include
@@ -48,7 +44,7 @@ using namespace std;
#include
#include
-// if user want to define log, define the folowing macro.
+// if want to use your log, define the folowing macro.
#ifndef SRS_RTMP_USER_DEFINED_LOG
// kernel module.
ISrsLog* _srs_log = new ISrsLog();
diff --git a/trunk/src/libs/srs_librtmp.hpp b/trunk/src/libs/srs_librtmp.hpp
index 9dbb82d39..9eccd7511 100644
--- a/trunk/src/libs/srs_librtmp.hpp
+++ b/trunk/src/libs/srs_librtmp.hpp
@@ -237,8 +237,8 @@ extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp);
// log to console, for use srs-librtmp application.
extern const char* srs_format_time();
-#define srs_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
-#define srs_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
+#define srs_lib_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
+#define srs_lib_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
/*************************************************************
**************************************************************