winlin

Merge branch 'srs.master'

... ... @@ -228,6 +228,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/>
## 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 [#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.
... ...
... ... @@ -125,7 +125,10 @@ function Ubuntu_prepare()
echo "Ubuntu install tools success"
return 0
}
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# for Centos, auto install tools by yum
#####################################################################################
... ... @@ -213,50 +216,55 @@ function Centos_prepare()
echo "Centos install tools success"
return 0
}
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# st-1.9
#####################################################################################
# check the arm flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug
if [ $SRS_EMBEDED_CPU = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t for arm is ok.";
else
# TODO: FIXME: patch the bug.
# patch st for arm, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix
echo "build st-1.9t for arm";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="-DMD_HAVE_EPOLL" ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp
)
fi
else
if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t is ok.";
if [ $SRS_EXPORT_LIBRTMP = 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
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t for arm is ok.";
else
# TODO: FIXME: patch the bug.
# patch st for arm, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix
echo "build st-1.9t for arm";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="-DMD_HAVE_EPOLL" ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp
)
fi
else
echo "build st-1.9t";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
echo "we alaways patch the st, for we may build srs under arm directly" &&
echo "the 1.st.arm.patch is ok for x86 because it's only modify code under macro linux arm" &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp
)
if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t is ok.";
else
echo "build st-1.9t";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
echo "we alaways patch the st, for we may build srs under arm directly" &&
echo "the 1.st.arm.patch is ok for x86 because it's only modify code under macro linux arm" &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp
)
fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; exit -1; fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; exit -1; fi
#####################################################################################
# http-parser-2.1
... ... @@ -335,7 +343,9 @@ function write_nginx_html5()
END
}
# create the nginx dir, for http-server if not build nginx
mkdir -p ${SRS_OBJS}/nginx
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
mkdir -p ${SRS_OBJS}/nginx
fi
# make nginx
__SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
if [ $__SRS_BUILD_NGINX = YES ]; then
... ... @@ -361,31 +371,34 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
fi
# create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
# generate default html pages for android.
html_file=${SRS_OBJS}/nginx/html/live/demo.html && hls_stream=demo.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
# copy players to nginx html dir.
rm -rf ${SRS_OBJS}/nginx/html/players &&
ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players &&
rm -f ${SRS_OBJS}/nginx/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml
# for favicon.ico
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico
# nginx.html to detect whether nginx is alive
echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html
# the demo dir.
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
# create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
# generate default html pages for android.
html_file=${SRS_OBJS}/nginx/html/live/demo.html && hls_stream=demo.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
# copy players to nginx html dir.
rm -rf ${SRS_OBJS}/nginx/html/players &&
ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players &&
rm -f ${SRS_OBJS}/nginx/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml
# for favicon.ico
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico
# nginx.html to detect whether nginx is alive
echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html
fi
if [ $SRS_NGINX = YES ]; then
echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
... ...
... ... @@ -57,7 +57,7 @@ done
echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS_DIR}/include" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS_DIR}/lib" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS_DIR}/include" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS_DIR}/lib" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
echo -n "generate lib ${LIB_NAME} ok"; echo '!';
... ...
... ... @@ -85,6 +85,6 @@ done
echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS_DIR}/${MODULE_DIR}" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS_DIR}/${MODULE_DIR}" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
echo -n "generate module ${MODULE_ID} ok"; echo '!';
... ...
... ... @@ -20,7 +20,9 @@ SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then
SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
... ... @@ -94,7 +96,26 @@ echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manag
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}"
echo "you can:"
echo "You can:"
echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf."
END
else
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
# linux shell color support.
RED="\\${RED}"
GREEN="\\${GREEN}"
YELLOW="\\${YELLOW}"
BLACK="\\${BLACK}"
echo -e "\${BLACK}You can use srs-librtmp at:\${BLACK}"
echo -e "\${GREEN} objs/include/srs_librtmp.h\${BLACK}"
echo -e "\${GREEN} objs/lib/srs_librtmp.a\${BLACK}"
echo -e "\${BLACK}Examples for srs-librtmp at:\${BLACK}"
echo -e "\${GREEN} objs/research/librtmp\${BLACK}"
echo -e "\${GREEN} Examples: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
END
fi
\ No newline at end of file
... ...
... ... @@ -176,6 +176,6 @@ END
#####################################################################################
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
echo -n "generate utest ok"; echo '!';
... ...
... ... @@ -33,10 +33,12 @@ if [ $SRS_EXPORT_LIBRTMP != NO ]; then
# 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}/3rdparty && mkdir -p ${_CPT} && cp 3rdparty/st-1.9.zip ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/3rdparty/patches && mkdir -p ${_CPT} && cp 3rdparty/patches/1.st.arm.patch ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c ${_CPT} && cp research/librtmp/Makefile ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT}
_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
... ... @@ -468,7 +470,9 @@ echo 'configure ok! '
# when configure success, prepare build
#####################################################################################
# create objs/logs for ffmpeg to write log.
mkdir -p ${SRS_OBJS}/logs
if [ $SRS_EXPORT_LIBRTMP = NO ]; then
mkdir -p ${SRS_OBJS}/logs
fi
#####################################################################################
# configure summary
... ...
... ... @@ -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 9
#define VERSION_REVISION 10
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
... ...