1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

RTC: Remove export srs-librtmp support

This commit is contained in:
winlin 2020-05-27 14:20:40 +08:00
parent b8ab6ef6ce
commit a3388bf624
7 changed files with 400 additions and 687 deletions

View file

@ -49,11 +49,7 @@ fi
if [ $SRS_CUBIE = YES ]; then
srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
echo "#define SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
fi
echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H

View file

@ -113,9 +113,7 @@ function Ubuntu_prepare()
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi
fi
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi
#####################################################################################
# for Centos, auto install tools by yum
@ -191,9 +189,7 @@ function Centos_prepare()
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi
fi
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi
#####################################################################################
# For OSX, auto install tools by brew
@ -277,9 +273,7 @@ function OSX_prepare()
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
fi
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
#####################################################################################
# for Centos, auto install tools by yum
@ -326,7 +320,7 @@ function _srs_link_file()
# directly build on arm/mips, for example, pi or cubie,
# export srs-librtmp
# others is invalid.
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO ]]; then
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
echo "Your OS `uname -s` is not supported."
exit 1
@ -336,32 +330,31 @@ fi
#####################################################################################
# state-threads
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-O0" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG"
if [[ $SRS_VALGRIND == YES ]]; then
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-O0" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG"
if [[ $SRS_VALGRIND == YES ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
fi
# for osx, use darwin for st, donot use epoll.
if [[ $SRS_OSX == YES ]]; then
fi
# for osx, use darwin for st, donot use epoll.
if [[ $SRS_OSX == YES ]]; then
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE" && _ST_LD=${SRS_TOOL_CC} && _ST_OBJ="DARWIN_`uname -r`_DBG"
fi
# For UDP sendmmsg, disable it if not suppported.
if [[ $SRS_SENDMMSG == YES ]]; then
fi
# For UDP sendmmsg, disable it if not suppported.
if [[ $SRS_SENDMMSG == YES ]]; then
echo "Build ST with UDP sendmmsg support."
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
else
else
echo "Build ST without UDP sendmmsg support."
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -UMD_HAVE_SENDMMSG -U_GNU_SOURCE"
fi
# Pass the global extra flags.
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
fi
# Pass the global extra flags.
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/st/libst.a ]]; then
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/st/libst.a ]]; then
echo "The state-threads is ok.";
else
else
echo "Building state-threads.";
(
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/st-srs && mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/st-srs &&
@ -384,13 +377,12 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${_ST_LD} RANDLIB=${SRS_TOOL_RANDLIB} &&
cd .. && rm -rf st && ln -sf st-srs/${_ST_OBJ} st
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -rf st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st)
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -rf st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st)
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
#####################################################################################
# nginx for HLS, nginx-1.5.0
@ -404,74 +396,68 @@ function write_nginx_html5()
END
}
# create the nginx dir, for http-server if not build nginx
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/nginx
fi
mkdir -p ${SRS_OBJS}/nginx
# the demo dir.
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
# 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
# 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
# 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
# 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
# nginx.html to detect whether nginx is alive
echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html
#####################################################################################
# cherrypy for http hooks callback, CherryPy-3.2.4
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# Detect python or python2
python --version >/dev/null 2>&1 && SYS_PYTHON=python;
python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2;
# Install cherrypy for api server.
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]]; then
# Detect python or python2
python --version >/dev/null 2>&1 && SYS_PYTHON=python;
python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2;
# Install cherrypy for api server.
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]]; then
echo "CherryPy-3.2.4 is ok.";
else
else
echo "Installing CherryPy-3.2.4";
(
rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
unzip -q ../../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
$SYS_PYTHON setup.py install --user --prefix=''
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
echo "Link players to cherrypy static-dir"
rm -rf research/api-server/static-dir/players &&
ln -sf `pwd`/research/players research/api-server/static-dir/players &&
rm -f research/api-server/static-dir/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml research/api-server/static-dir/crossdomain.xml &&
rm -rf research/api-server/static-dir/live &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/live &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/live research/api-server/static-dir/live &&
rm -rf research/api-server/static-dir/forward &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forward
ret=$?; if [[ $ret -ne 0 ]]; then echo "Warning: Ignore error to link players to cherrypy static-dir."; fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
echo "Link players to cherrypy static-dir"
rm -rf research/api-server/static-dir/players &&
ln -sf `pwd`/research/players research/api-server/static-dir/players &&
rm -f research/api-server/static-dir/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml research/api-server/static-dir/crossdomain.xml &&
rm -rf research/api-server/static-dir/live &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/live &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/live research/api-server/static-dir/live &&
rm -rf research/api-server/static-dir/forward &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forward
ret=$?; if [[ $ret -ne 0 ]]; then echo "Warning: Ignore error to link players to cherrypy static-dir."; fi
#####################################################################################
# openssl, for rtmp complex handshake and HLS encryption.
@ -547,9 +533,8 @@ fi
#####################################################################################
# srtp
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
if [[ $SRS_SRTP_ASM == YES ]]; then
# For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
if [[ $SRS_SRTP_ASM == YES ]]; then
echo " #include <openssl/ssl.h> " > ${SRS_OBJS}/_tmp_srtp_asm_detect.c
echo " #if OPENSSL_VERSION_NUMBER >= 0x10100000L // v1.1.x " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
echo " #error \"SRTP only works with openssl-1.0.*\" " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
@ -559,17 +544,17 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
fi
rm -f ${SRS_OBJS}/_tmp_srtp_asm_detect.c
fi;
SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS=""
# If use ASM for SRTP, we enable openssl(with ASM).
if [[ $SRS_SRTP_ASM == YES ]]; then
fi;
SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS=""
# If use ASM for SRTP, we enable openssl(with ASM).
if [[ $SRS_SRTP_ASM == YES ]]; then
echo "SRTP with openssl(ASM) optimization" &&
SRTP_CONFIG="export PKG_CONFIG_PATH=../openssl/lib/pkgconfig" && SRTP_OPTIONS="--enable-openssl"
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/srtp2/lib/libsrtp2.a ]]; then
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/srtp2/lib/libsrtp2.a ]]; then
echo "The srtp2 is ok.";
else
else
echo "Building srtp2.";
(
rm -rf ${SRS_OBJS}/srtp2 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
@ -578,18 +563,17 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
make ${SRS_JOBS} && make install &&
cd .. && rm -rf srtp2 && ln -sf libsrtp-2.0.0/_release srtp2
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build srtp2 failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -rf srtp2 && ln -sf ${SRS_PLATFORM}/libsrtp-2.0.0/_release srtp2)
if [ ! -f ${SRS_OBJS}/srtp2/lib/libsrtp2.a ]; then echo "Build srtp2 static lib failed."; exit -1; fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build srtp2 failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS} && rm -rf srtp2 && ln -sf ${SRS_PLATFORM}/libsrtp-2.0.0/_release srtp2)
if [ ! -f ${SRS_OBJS}/srtp2/lib/libsrtp2.a ]; then echo "Build srtp2 static lib failed."; exit -1; fi
#####################################################################################
# libopus, for WebRTC to transcode AAC with Opus.
#####################################################################################
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
if [[ $SRS_RTC == YES ]]; then
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/opus/lib/libopus.a ]]; then
echo "The opus-1.3.1 is ok.";
else
@ -611,7 +595,7 @@ fi
#####################################################################################
# ffmpeg-fix, for WebRTC to transcode AAC with Opus.
#####################################################################################
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
if [[ $SRS_RTC == YES ]]; then
FFMPEG_OPTIONS=""
# If disable nasm, disable all ASMs.
@ -710,8 +694,7 @@ fi
#####################################################################################
# build research code, librtmp
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [ $SRS_RESEARCH = YES ]; then
if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research
(cd ${SRS_WORKDIR}/research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS_DIR}/research)
@ -719,7 +702,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
(cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS_DIR}/research)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/ffempty failed, ret=$ret"; exit $ret; fi
fi
fi
if [[ $SRS_LIBRTMP == YES ]]; then

View file

@ -1,30 +0,0 @@
#!/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/protocol && mkdir -p ${_CPT} && cp src/protocol/* ${_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

@ -1,133 +0,0 @@
#!/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-2017 OSSRS(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 hpp 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 "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="${PROTOCOL_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 "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="${PROTOCOL_OBJS[@]}" && build_module_cpp
SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_cpp
# create example.cpp
FILE=$SRS_EXPORT_LIBRTMP_SINGLE/example.c
SRS_SINGLE_LIBRTMP_COMPILE='gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example'
cat << END >$FILE
/**
# Example to use srs-librtmp
# see: https://github.com/ossrs/srs/wiki/v2_CN_SrsLibrtmp
${SRS_SINGLE_LIBRTMP_COMPILE}
*/
#include <stdio.h>
#include "srs_librtmp.h"
int main(int argc, char** argv)
{
srs_rtmp_t rtmp;
printf("Example for srs-librtmp\n");
printf("SRS(ossrs) client librtmp library.\n");
printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream");
srs_human_trace("create rtmp success");
srs_rtmp_destroy(rtmp);
return 0;
}
END
## compile the example
#(cd $SRS_EXPORT_LIBRTMP_SINGLE && echo "${SRS_SINGLE_LIBRTMP_COMPILE}" &&
#`${SRS_SINGLE_LIBRTMP_COMPILE}` && ./example && rm -f example)
#ret=$?; if [[ $ret -ne 0 ]]; then
# echo "(cd $SRS_EXPORT_LIBRTMP_SINGLE && ${SRS_SINGLE_LIBRTMP_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

@ -194,8 +194,6 @@ Experts:
--sys-ssl=on|off Do not compile ssl, use system ssl(-lssl) if required.
--use-shared-st Use link shared libraries for ST which uses MPL license.
--use-shared-srt Use link shared libraries for SRT which uses MPL license.
--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.
--build-tag=<TAG> Set the build object directory suffix.
--with-clean Configure SRS and do make clean if possible.
--without-clean Configure SRS and never make clean even possible.
@ -578,28 +576,14 @@ function apply_user_detail_options() {
# if specified export single file, export project first.
if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
SRS_EXPORT_LIBRTMP_PROJECT=$SRS_EXPORT_LIBRTMP_SINGLE
echo "Not support --export-librtmp-single"
exit -1
fi
# disable almost all features for export srs-librtmp.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
SRS_HDS=NO
SRS_SSL=NO
SRS_TRANSCODE=NO
SRS_HTTP_CALLBACK=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_STREAM_CASTER=NO
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MD=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
echo "Not support --export-librtmp-project"
exit -1
fi
if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then

View file

@ -24,8 +24,7 @@ SrsGperfCPSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_CP = YES ]; then
SrsGprofSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
SrsValgrindSummaryColor="\${YELLOW}(Disabled) "; if [ $SRS_VALGRIND = YES ]; then SrsValgrindSummaryColor="\${GREEN}"; fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
@ -58,22 +57,4 @@ 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/ossrs/srs/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
END
fi

483
trunk/configure vendored
View file

@ -96,10 +96,6 @@ CppStd="-ansi"
if [[ $SRS_SRT == YES ]]; then
CppStd="-std=c++11"
fi
# for library compile
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == YES ]]; then
LibraryCompile=" -fPIC"
fi
# performance of gprof
SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
# performance of gperf
@ -244,30 +240,28 @@ fi
#
#Service Module, for both Server and Client Modules.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="SERVICE"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
# TODO: FIXME: Remove service module, https://github.com/ossrs/srs/issues/1535#issuecomment-633907655
MODULE_ID="SERVICE"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
MODULE_FILES=("srs_service_log" "srs_service_st" "srs_service_http_client"
fi
MODULE_FILES=("srs_service_log" "srs_service_st" "srs_service_http_client"
"srs_service_http_conn" "srs_service_rtmp_conn" "srs_service_utility"
"srs_service_conn")
DEFINES=""
SERVICE_INCS="src/service"; MODULE_DIR=${SERVICE_INCS} . auto/modules.sh
SERVICE_OBJS="${MODULE_OBJS[@]}"
fi
DEFINES=""
SERVICE_INCS="src/service"; MODULE_DIR=${SERVICE_INCS} . auto/modules.sh
SERVICE_OBJS="${MODULE_OBJS[@]}"
#
#App Module, for SRS server only.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot} ${LibGperfRoot})
if [[ $SRS_RTC == YES ]]; then
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot} ${LibGperfRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
fi
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
"srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
"srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config"
"srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks"
@ -278,23 +272,22 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers" "srs_app_hybrid")
if [[ $SRS_RTC == YES ]]; then
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_codec" "srs_app_rtc_sdp"
"srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
fi
if [[ $SRS_GB28181 == YES ]]; then
fi
if [[ $SRS_GB28181 == YES ]]; then
MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip")
fi
DEFINES=""
# add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do
fi
DEFINES=""
# add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
MODULE_FILES+=("${SRS_MODULE_APP[*]}")
DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}"
done
APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
APP_OBJS="${MODULE_OBJS[@]}"
fi
done
APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
APP_OBJS="${MODULE_OBJS[@]}"
#
#LIBS Module, build libsrs.a for static link.
MODULE_ID="LIBS"
@ -305,93 +298,87 @@ LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
LIBS_OBJS="${MODULE_OBJS[@]}"
#
#Server Module, for SRS only.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="SERVER"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP")
if [[ $SRS_SRT == YES ]]; then
MODULE_ID="SERVER"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP")
if [[ $SRS_SRT == YES ]]; then
MODULE_DEPENDS+=("SRT")
fi
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}")
fi
MODULE_FILES=("srs_main_server")
SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh
SERVER_OBJS="${MODULE_OBJS[@]}"
fi
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}")
fi
MODULE_FILES=("srs_main_server")
SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh
SERVER_OBJS="${MODULE_OBJS[@]}"
#
#Main Module, for app from modules.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
MODULE_FILES=()
DEFINES=""
# add each modules for main
for SRS_MODULE in ${SRS_MODULES[*]}; do
fi
MODULE_FILES=()
DEFINES=""
# add each modules for main
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
MODULE_FILES+=("${SRS_MODULE_MAIN[*]}")
DEFINES="${DEFINES} ${SRS_MODULE_DEFINES}"
done
MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@]}"
fi
done
MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@]}"
#####################################################################################
# Binaries, main entrances, link the module and its depends modules,
# then link to a binary, for example, objs/srs
#
# Disable SRS application for exporting librtmp.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all main entrances
MAIN_ENTRANCES=("srs_main_server")
for SRS_MODULE in ${SRS_MODULES[*]}; do
# all main entrances
MAIN_ENTRANCES=("srs_main_server")
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
MAIN_ENTRANCES+=("${SRS_MODULE_MAIN[*]}")
done
#
# all depends libraries
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
if [[ $SRS_RTC == YES ]]; then
done
#
# all depends libraries
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
if [[ $SRS_RTC == YES ]]; then
ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
fi
if [[ $SRS_SRT == YES ]]; then
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibFiles+=("${LibSRTfile[*]}")
fi
# all depends objects
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
fi
# all depends objects
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
fi
if [[ $SRS_SRT == YES ]]; then
fi
if [[ $SRS_SRT == YES ]]; then
MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
fi
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
#
# srs: srs(simple rtmp server) over st(state-threads)
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
#
# For modules, without the app module.
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${MAIN_OBJS[@]}"
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
if [[ $SRS_RTC == YES ]]; then
fi
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
#
# srs: srs(simple rtmp server) over st(state-threads)
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
#
# For modules, without the app module.
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${MAIN_OBJS[@]}"
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
if [[ $SRS_RTC == YES ]]; then
ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
fi
#
for SRS_MODULE in ${SRS_MODULES[*]}; do
fi
#
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
# no SRS_MODULE_MAIN
if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi
BUILD_KEY="$SRS_MODULE_NAME" APP_MAIN="${SRS_MODULE_MAIN[0]}" APP_NAME="$SRS_MODULE_NAME" . auto/apps.sh
done
fi
done
# srs librtmp
if [ $SRS_LIBRTMP = YES ]; then
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}"
@ -558,55 +545,26 @@ done
echo "" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
# if export librtmp, donot build the srs server.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir
@echo "Ingore srs(simple rtmp server) for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir
@echo "Build the srs(simple rtmp server) over ST(state-threads)"
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
END
fi
# generate all modules entry
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
# if export librtmp, donot build the bravo-ingest.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
$SRS_MODULE_NAME: _prepare_dir server
@echo "Ingore the $SRS_MODULE_NAME for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
$SRS_MODULE_NAME: _prepare_dir server
@echo "Build the $SRS_MODULE_NAME over SRS"
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} $SRS_MODULE_NAME
END
fi
done
# disable install entry for srs-librtmp
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall:
@echo "Disable uninstall for srs-librtmp"
install-api:
@echo "Disable install-api for srs-librtmp"
install:
@echo "Disable install for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall:
@echo "rmdir \$(SRS_PREFIX)"
@rm -rf \$(SRS_PREFIX)
@ -666,7 +624,6 @@ install:
@echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService"
END
fi
# generate srs-librtmp entry
if [ $SRS_LIBRTMP = YES ]; then
@ -718,134 +675,130 @@ echo 'Configure ok! '
# when configure success, prepare build
#####################################################################################
# create objs/logs for ffmpeg to write log.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/logs
fi
mkdir -p ${SRS_OBJS}/logs
#####################################################################################
# configure summary
#####################################################################################
# summary
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 ""
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
else
echo -e "${YELLOW}Warning: HLS is disabled.${BLACK}"
fi
if [ $SRS_STREAM_CASTER = YES ]; then
echo -e "${YELLOW}Experiment: StreamCaster is enabled.${BLACK}"
else
echo -e "${GREEN}Note: StreamCaster is disabled.${BLACK}"
fi
if [ $SRS_HDS = YES ]; then
echo -e "${YELLOW}Experiment: HDS is enabled.${BLACK}"
else
echo -e "${GREEN}Warning: HDS is disabled.${BLACK}"
fi
if [ $SRS_SRT = YES ]; then
echo -e "${YELLOW}Experiment: SRT is enabled. https://github.com/ossrs/srs/issues/1147${BLACK}"
else
echo -e "${GREEN}Warning: SRT is disabled.${BLACK}"
fi
if [ $SRS_RTC = YES ]; then
echo -e "${YELLOW}Experiment: RTC is enabled. https://github.com/ossrs/srs/issues/307${BLACK}"
else
echo -e "${GREEN}Warning: RTC is disabled.${BLACK}"
fi
if [ $SRS_DVR = YES ]; then
echo -e "${GREEN}DVR is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: DVR is disabled.${BLACK}"
fi
if [ $SRS_SSL = YES ]; then
echo -e "${GREEN}RTMP complex handshake is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: RTMP complex handshake is disabled, flash cann't play h264/aac.${BLACK}"
fi
if [ $SRS_TRANSCODE = YES ]; then
echo -e "${GREEN}The transcoding is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The transcoding is disabled.${BLACK}"
fi
if [ $SRS_INGEST = YES ]; then
echo -e "${GREEN}The ingesting is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: The ingesting is disabled.${BLACK}"
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo -e "${GREEN}The http-callback is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The http-callback is disabled.${BLACK}"
fi
if [ $SRS_HTTP_SERVER = YES ]; then
echo -e "${GREEN}Embeded HTTP server for HTTP-FLV/HLS is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: Embeded HTTP server is disabled, HTTP-FLV is disabled, please use nginx to delivery HLS.${BLACK}"
fi
if [ $SRS_HTTP_API = YES ]; then
echo -e "${GREEN}The HTTP API is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The HTTP API is disabled.${BLACK}"
fi
if [ $SRS_LIBRTMP = YES ]; then
echo -e "${GREEN}The client-side srs-librtmp is enabled.${BLACK}"
else
echo -e "${YELLOW}Note: The client-side srs-librtmp is disabled.${BLACK}"
fi
if [ $SRS_RESEARCH = YES ]; then
echo -e "${GREEN}The research tools are enabled.${BLACK}"
else
echo -e "${GREEN}Note: The research tools are disabled.${BLACK}"
fi
if [ $SRS_UTEST = YES ]; then
echo -e "${GREEN}The utests are enabled.${BLACK}"
else
echo -e "${YELLOW}Note: The utests are disabled.${BLACK}"
fi
if [ $SRS_GPERF = YES ]; then
echo -e "${GREEN}The gperf(tcmalloc) is enabled.${BLACK}"
else
echo -e "${GREEN}Note: The gperf(tcmalloc) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MC = YES ]; then
echo -e "${YELLOW}The gmc(gperf memory check) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmc(gperf memory check) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MD = YES ]; then
echo -e "${YELLOW}The gmd(gperf memory defense) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmd(gperf memory defense) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MP = YES ]; then
echo -e "${YELLOW}The gmp(gperf memory profile) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmp(gperf memory profile) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_CP = YES ]; then
echo -e "${YELLOW}The gcp(gperf cpu profile) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gcp(gperf cpu profile) is disabled.${BLACK}"
fi
if [ $SRS_GPROF = YES ]; then
echo -e "${YELLOW}The gprof(GNU profile tool) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gprof(GNU profile tool) is disabled.${BLACK}"
fi
if [ $SRS_VALGRIND = YES ]; then
echo -e "${GREEN}The valgrind is enabled.${BLACK}"
else
echo -e "${GREEN}Note: The valgrind is disabled.${BLACK}"
fi
# add each modules for application
for SRS_MODULE in ${SRS_MODULES[*]}; do
echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}"
done
fi
if [ $SRS_STREAM_CASTER = YES ]; then
echo -e "${YELLOW}Experiment: StreamCaster is enabled.${BLACK}"
else
echo -e "${GREEN}Note: StreamCaster is disabled.${BLACK}"
fi
if [ $SRS_HDS = YES ]; then
echo -e "${YELLOW}Experiment: HDS is enabled.${BLACK}"
else
echo -e "${GREEN}Warning: HDS is disabled.${BLACK}"
fi
if [ $SRS_SRT = YES ]; then
echo -e "${YELLOW}Experiment: SRT is enabled. https://github.com/ossrs/srs/issues/1147${BLACK}"
else
echo -e "${GREEN}Warning: SRT is disabled.${BLACK}"
fi
if [ $SRS_RTC = YES ]; then
echo -e "${YELLOW}Experiment: RTC is enabled. https://github.com/ossrs/srs/issues/307${BLACK}"
else
echo -e "${GREEN}Warning: RTC is disabled.${BLACK}"
fi
if [ $SRS_DVR = YES ]; then
echo -e "${GREEN}DVR is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: DVR is disabled.${BLACK}"
fi
if [ $SRS_SSL = YES ]; then
echo -e "${GREEN}RTMP complex handshake is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: RTMP complex handshake is disabled, flash cann't play h264/aac.${BLACK}"
fi
if [ $SRS_TRANSCODE = YES ]; then
echo -e "${GREEN}The transcoding is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The transcoding is disabled.${BLACK}"
fi
if [ $SRS_INGEST = YES ]; then
echo -e "${GREEN}The ingesting is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: The ingesting is disabled.${BLACK}"
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo -e "${GREEN}The http-callback is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The http-callback is disabled.${BLACK}"
fi
if [ $SRS_HTTP_SERVER = YES ]; then
echo -e "${GREEN}Embeded HTTP server for HTTP-FLV/HLS is enabled.${BLACK}"
else
echo -e "${YELLOW}Warning: Embeded HTTP server is disabled, HTTP-FLV is disabled, please use nginx to delivery HLS.${BLACK}"
fi
if [ $SRS_HTTP_API = YES ]; then
echo -e "${GREEN}The HTTP API is enabled${BLACK}"
else
echo -e "${YELLOW}Warning: The HTTP API is disabled.${BLACK}"
fi
if [ $SRS_LIBRTMP = YES ]; then
echo -e "${GREEN}The client-side srs-librtmp is enabled.${BLACK}"
else
echo -e "${YELLOW}Note: The client-side srs-librtmp is disabled.${BLACK}"
fi
if [ $SRS_RESEARCH = YES ]; then
echo -e "${GREEN}The research tools are enabled.${BLACK}"
else
echo -e "${GREEN}Note: The research tools are disabled.${BLACK}"
fi
if [ $SRS_UTEST = YES ]; then
echo -e "${GREEN}The utests are enabled.${BLACK}"
else
echo -e "${YELLOW}Note: The utests are disabled.${BLACK}"
fi
if [ $SRS_GPERF = YES ]; then
echo -e "${GREEN}The gperf(tcmalloc) is enabled.${BLACK}"
else
echo -e "${GREEN}Note: The gperf(tcmalloc) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MC = YES ]; then
echo -e "${YELLOW}The gmc(gperf memory check) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmc(gperf memory check) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MD = YES ]; then
echo -e "${YELLOW}The gmd(gperf memory defense) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmd(gperf memory defense) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_MP = YES ]; then
echo -e "${YELLOW}The gmp(gperf memory profile) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gmp(gperf memory profile) is disabled.${BLACK}"
fi
if [ $SRS_GPERF_CP = YES ]; then
echo -e "${YELLOW}The gcp(gperf cpu profile) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gcp(gperf cpu profile) is disabled.${BLACK}"
fi
if [ $SRS_GPROF = YES ]; then
echo -e "${YELLOW}The gprof(GNU profile tool) is enabled, performance may suffer.${BLACK}"
else
echo -e "${GREEN}Note: The gprof(GNU profile tool) is disabled.${BLACK}"
fi
if [ $SRS_VALGRIND = YES ]; then
echo -e "${GREEN}The valgrind is enabled.${BLACK}"
else
echo -e "${GREEN}Note: The valgrind is disabled.${BLACK}"
fi
# add each modules for application
for SRS_MODULE in ${SRS_MODULES[*]}; do
echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}"
done
#####################################################################################
# Do cleanup when configure done.
@ -858,33 +811,13 @@ fi
#####################################################################################
# next step
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo ""
echo "You can run 3rdparty applications:"
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo ""
echo "You can run 3rdparty applications:"
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server"
fi
echo ""
echo "You can build SRS:"
echo "\" make \" to build the srs(simple rtmp server)."
echo "\" make help \" to get the usage of make"
else
# 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 "Packaging 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}"
echo -e "${GREEN}To compile the example: ${BLACK}"
echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && $SRS_SINGLE_LIBRTMP_COMPILE ${BLACK}"
# for srs-librtmp project.
else
echo -e "${GREEN}Please use the srs-librtmp project: ${BLACK}"
echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && make ${BLACK}"
fi
# Change to experiment.
echo -e "${YELLOW}Warning: Notice srs-librtmp is deprecated and maybe removed in future.${BLACK}"
fi
echo ""
echo "You can build SRS:"
echo "\" make \" to build the srs(simple rtmp server)."
echo "\" make help \" to get the usage of make"