1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix #191: configure --export-librtmp-project and --export-librtmp-single. 2.0.11.

This commit is contained in:
winlin 2014-11-08 18:33:15 +08:00
parent e62c3a4e0e
commit 3405f35d06
9 changed files with 329 additions and 162 deletions

View file

@ -228,7 +228,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/> * 2013-10-17, Created.<br/>
## History ## 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-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-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. * 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.

View file

@ -126,7 +126,7 @@ function Ubuntu_prepare()
return 0 return 0
} }
# donot prepare tools, for srs-librtmp depends only gcc and g++. # 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 Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
fi fi
##################################################################################### #####################################################################################
@ -217,14 +217,14 @@ function Centos_prepare()
return 0 return 0
} }
# donot prepare tools, for srs-librtmp depends only gcc and g++. # 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 Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
fi fi
##################################################################################### #####################################################################################
# st-1.9 # 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. # check the arm flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug _ST_MAKE=linux-debug
if [ $SRS_EMBEDED_CPU = YES ]; then if [ $SRS_EMBEDED_CPU = YES ]; then
@ -343,7 +343,7 @@ function write_nginx_html5()
END END
} }
# create the nginx dir, for http-server if not build nginx # 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 mkdir -p ${SRS_OBJS}/nginx
fi fi
# make nginx # make nginx
@ -372,7 +372,7 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
fi fi
# the demo dir. # the demo dir.
if [ $SRS_EXPORT_LIBRTMP = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# create forward dir # create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live && mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live mkdir -p ${SRS_OBJS}/nginx/html/forward/live
@ -595,7 +595,7 @@ fi
##################################################################################### #####################################################################################
# build research code, librtmp # build research code, librtmp
##################################################################################### #####################################################################################
if [ $SRS_EXPORT_LIBRTMP = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [ $SRS_RESEARCH = YES ]; then if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research mkdir -p ${SRS_OBJS}/research

View file

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

View file

@ -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 <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp &&
cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp >>$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 <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp &&
cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp >>$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 <stdio.h>
#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)

View file

@ -58,8 +58,10 @@ SRS_LOG_TRACE=RESERVED
# experts # experts
# donot compile ssl, use system ssl(-lssl) if required. # donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL=NO SRS_USE_SYS_SSL=NO
# export the srs-librtmp to specified path, NO to disable it. # export the srs-librtmp to specified project, NO to disable it.
SRS_EXPORT_LIBRTMP=NO 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 # presets
@ -183,8 +185,9 @@ Conflicts:
the complex tools not available for arm. the complex tools not available for arm.
Experts: Experts:
--use-sys-ssl donot compile ssl, use system ssl(-lssl) if required. --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
--export-librtmp=<path> export srs-librtmp to specified path. --export-librtmp-project=<path> export srs-librtmp to specified project in path.
--export-librtmp-single=<path> export srs-librtmp to a single file(.h+.cpp) in path.
Workflow: Workflow:
1. apply "Presets". if not specified, use default preset. 1. apply "Presets". if not specified, use default preset.
@ -266,7 +269,8 @@ function parse_user_option() {
--full) SRS_ENABLE_ALL=YES ;; --full) SRS_ENABLE_ALL=YES ;;
--use-sys-ssl) SRS_USE_SYS_SSL=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\"" echo "$0: error: invalid option \"$option\""
@ -701,8 +705,13 @@ function apply_user_detail_options() {
export SRS_JOBS="--jobs=${SRS_JOBS}" export SRS_JOBS="--jobs=${SRS_JOBS}"
fi 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. # 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_HLS=NO
SRS_DVR=NO SRS_DVR=NO
SRS_NGINX=NO SRS_NGINX=NO

View file

@ -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 SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${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 <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY} cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash #!/bin/bash

286
trunk/configure vendored
View file

@ -25,30 +25,14 @@ BLACK="\\e[0m"
. auto/options.sh . auto/options.sh
# for export srs-librtmp, change target to it. # for export srs-librtmp, change target to it.
if [ $SRS_EXPORT_LIBRTMP != NO ]; then . auto/generate-srs-librtmp-project.sh
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
# the auto generated variables. # the auto generated variables.
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp" SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# clean the exists, when not export srs-librtmp. # clean the exists, when not export srs-librtmp.
# do this only when the options is ok. # 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 if [[ -f Makefile ]]; then
make clean make clean
fi fi
@ -186,7 +170,7 @@ clean:
END END
# if export librtmp, donot build the srs server. # 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} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir server: _prepare_dir
@echo "donot build the srs(simple rtmp server) for srs-librtmp" @echo "donot build the srs(simple rtmp server) for srs-librtmp"
@ -202,7 +186,7 @@ END
fi fi
# disable install entry for srs-librtmp # 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} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall: uninstall:
@echo "disable uninstall for srs-librtmp" @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[@]}" RTMP_OBJS="${MODULE_OBJS[@]}"
# #
#App Module #App Module
if [ $SRS_EXPORT_LIBRTMP = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP" MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP") MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR}) 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[@]}" LIBS_OBJS="${MODULE_OBJS[@]}"
# #
#Main Module #Main Module
if [ $SRS_EXPORT_LIBRTMP = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN" MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot}) ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot})
@ -432,7 +416,7 @@ fi
# then link to a binary, for example, objs/srs # then link to a binary, for example, objs/srs
# #
# disable all app when export librtmp # disable all app when export librtmp
if [ $SRS_EXPORT_LIBRTMP = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all main entrances # all main entrances
MAIN_ENTRANCES=("srs_main_server") 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 LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
fi 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! ' echo 'configure ok! '
##################################################################################### #####################################################################################
# when configure success, prepare build # when configure success, prepare build
##################################################################################### #####################################################################################
# create objs/logs for ffmpeg to write log. # 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 mkdir -p ${SRS_OBJS}/logs
fi fi
@ -478,127 +476,131 @@ fi
# configure summary # configure summary
##################################################################################### #####################################################################################
# summary # summary
echo "" if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "configure summary:" echo ""
echo " ${SRS_AUTO_USER_CONFIGURE}" echo "configure summary:"
echo " ${SRS_AUTO_CONFIGURE}" echo " ${SRS_AUTO_USER_CONFIGURE}"
if [ $SRS_HLS = YES ]; then echo " ${SRS_AUTO_CONFIGURE}"
echo -e "${GREEN}HLS is enabled${BLACK}" if [ $SRS_HLS = YES ]; then
else echo -e "${GREEN}HLS is enabled${BLACK}"
echo -e "${YELLOW}warning: without HLS support${BLACK}" else
fi echo -e "${YELLOW}warning: without HLS support${BLACK}"
if [ $SRS_NGINX = YES ]; then fi
echo -e "${GREEN}Nginx http server is enabled${BLACK}" if [ $SRS_NGINX = YES ]; then
else echo -e "${GREEN}Nginx http server is enabled${BLACK}"
echo -e "${GREEN}note: Nginx http server is disabled${BLACK}" else
fi echo -e "${GREEN}note: Nginx http server is disabled${BLACK}"
if [ $SRS_DVR = YES ]; then fi
echo -e "${GREEN}DVR is enabled${BLACK}" if [ $SRS_DVR = YES ]; then
else echo -e "${GREEN}DVR is enabled${BLACK}"
echo -e "${YELLOW}warning: without DVR support${BLACK}" else
fi echo -e "${YELLOW}warning: without DVR support${BLACK}"
if [ $SRS_SSL = YES ]; then fi
echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}" if [ $SRS_SSL = YES ]; then
else echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}"
echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}" else
fi echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
if [ $SRS_FFMPEG_TOOL = YES ]; then fi
echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}" if [ $SRS_FFMPEG_TOOL = YES ]; then
else echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}" else
fi echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
if [ $SRS_TRANSCODE = YES ]; then fi
echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}" if [ $SRS_TRANSCODE = YES ]; then
else echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}"
echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}" else
fi echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}"
if [ $SRS_INGEST = YES ]; then fi
echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}" if [ $SRS_INGEST = YES ]; then
else echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}"
echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}" else
fi echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}"
if [ $SRS_HTTP_CALLBACK = YES ]; then fi
echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}" if [ $SRS_HTTP_CALLBACK = YES ]; then
else echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}"
echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}" else
fi echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
if [ $SRS_HTTP_SERVER = YES ]; then fi
echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}" if [ $SRS_HTTP_SERVER = YES ]; then
else echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}"
echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}" else
fi echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}"
if [ $SRS_HTTP_API = YES ]; then fi
echo -e "${GREEN}http api to manage server is enabled${BLACK}" if [ $SRS_HTTP_API = YES ]; then
else echo -e "${GREEN}http api to manage server is enabled${BLACK}"
echo -e "${YELLOW}warning: without http api to manage server support${BLACK}" else
fi echo -e "${YELLOW}warning: without http api to manage server support${BLACK}"
if [ $SRS_LIBRTMP = YES ]; then fi
echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}" if [ $SRS_LIBRTMP = YES ]; then
else echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}"
echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}" else
fi echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
if [ $SRS_RESEARCH = YES ]; then fi
echo -e "${GREEN}research tools are builded${BLACK}" if [ $SRS_RESEARCH = YES ]; then
else echo -e "${GREEN}research tools are builded${BLACK}"
echo -e "${GREEN}note: research tools are not builded${BLACK}" else
fi echo -e "${GREEN}note: research tools are not builded${BLACK}"
if [ $SRS_UTEST = YES ]; then fi
echo -e "${GREEN}utest for srs are builded${BLACK}" if [ $SRS_UTEST = YES ]; then
else echo -e "${GREEN}utest for srs are builded${BLACK}"
echo -e "${YELLOW}note: utest for srs are not builded${BLACK}" else
fi echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
if [ $SRS_GPERF = YES ]; then fi
echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}" if [ $SRS_GPERF = YES ]; then
else echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}"
if [ $SRS_GPERF_MC = YES ]; then fi
echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}" if [ $SRS_GPERF_MC = YES ]; then
else echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
if [ $SRS_GPERF_MP = YES ]; then fi
echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}" if [ $SRS_GPERF_MP = YES ]; then
else echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
if [ $SRS_GPERF_CP = YES ]; then fi
echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}" if [ $SRS_GPERF_CP = YES ]; then
else echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
if [ $SRS_GPROF = YES ]; then fi
echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}" if [ $SRS_GPROF = YES ]; then
else echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
if [ $SRS_ARM_UBUNTU12 = YES ]; then fi
echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}" if [ $SRS_ARM_UBUNTU12 = YES ]; then
else echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}"
echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}" else
fi echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}"
if [ $SRS_MIPS_UBUNTU12 = YES ]; then fi
echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}" if [ $SRS_MIPS_UBUNTU12 = YES ]; then
else echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}"
echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}" else
echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}"
fi
fi fi
##################################################################################### #####################################################################################
# next step # next step
##################################################################################### #####################################################################################
ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'` if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "" ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`
echo "to run 3rdparty application:" echo ""
if [ $SRS_NGINX = YES ]; then echo "to run 3rdparty application:"
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls" 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 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"

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR 2 #define VERSION_MAJOR 2
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 10 #define VERSION_REVISION 11
// server info. // server info.
#define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server" #define RTMP_SIG_SRS_ROLE "origin/edge server"

View file

@ -30,10 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sstream> #include <sstream>
using namespace std; using namespace std;
// undefine the log of librtmp for the srs use its log.
#undef srs_trace
#undef srs_verbose
#include <srs_kernel_error.hpp> #include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp.hpp> #include <srs_protocol_rtmp.hpp>
#include <srs_lib_simple_socket.hpp> #include <srs_lib_simple_socket.hpp>
@ -48,7 +44,7 @@ using namespace std;
#include <srs_kernel_file.hpp> #include <srs_kernel_file.hpp>
#include <srs_lib_bandwidth.hpp> #include <srs_lib_bandwidth.hpp>
// 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 #ifndef SRS_RTMP_USER_DEFINED_LOG
// kernel module. // kernel module.
ISrsLog* _srs_log = new ISrsLog(); ISrsLog* _srs_log = new ISrsLog();