mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add options --with/without -hls/ssl
This commit is contained in:
parent
f8855cfcbb
commit
ec5cb39b96
14 changed files with 260 additions and 93 deletions
|
@ -12,7 +12,7 @@ step 1: build srs <br/>
|
|||
<pre>
|
||||
tar xf simple-rtmp-server-*.*.tar.gz
|
||||
cd simple-rtmp-server-*.*/trunk
|
||||
./configure
|
||||
./configure --with-ssl --with-hls
|
||||
make
|
||||
</pre>
|
||||
step 2: start srs <br/>
|
||||
|
@ -64,6 +64,8 @@ m3u8 url: http://127.0.0.1:80/live/livestream.m3u8
|
|||
* nginx v1.5.0: 139524 lines <br/>
|
||||
|
||||
### History
|
||||
* v0.6, 2013-11-27, support --with or --without -hls and -ssl options.
|
||||
* v0.6, 2013-11-27, support AAC 44100HZ sample rate for iphone, adjust the timestamp.
|
||||
* v0.5, 2013-11-26, v0.5 released. 14449 lines.
|
||||
* v0.5, 2013-11-24, support HLS(m3u8), fragment and window.
|
||||
* v0.5, 2013-11-24, support record to ts file for HLS.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# params:
|
||||
# $GLOBAL_DIR_OBJS the objs directory. ie. objs
|
||||
# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile
|
||||
# $SRS_OBJS the objs directory. ie. objs
|
||||
# $SRS_MAKEFILE the makefile name. ie. Makefile
|
||||
# $MAIN_ENTRANCES array, all main entrance, disable all except the $APP_MAIN itself
|
||||
# $MODULE_OBJS array, the objects to compile the app.
|
||||
# $BUILD_KEY a string indicates the build key for Makefile. ie. dump
|
||||
|
@ -12,9 +12,9 @@
|
|||
# $LINK_OPTIONS the linker options.
|
||||
# $SO_PATH the libssl.so.10 and other so file path.
|
||||
|
||||
FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
||||
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
|
||||
APP_TARGET="${GLOBAL_DIR_OBJS}/${APP_NAME}"
|
||||
APP_TARGET="${SRS_OBJS}/${APP_NAME}"
|
||||
|
||||
echo "generate app ${APP_NAME} depends...";
|
||||
|
||||
|
@ -42,7 +42,7 @@ for item in ${MODULE_OBJS[*]}; do
|
|||
continue;
|
||||
fi
|
||||
|
||||
OBJ_FILE=${GLOBAL_DIR_OBJS}/$item
|
||||
OBJ_FILE=${SRS_OBJS}/$item
|
||||
OBJ_FILE="${OBJ_FILE%.*}.o"
|
||||
echo -n "${OBJ_FILE} " >> ${FILE}
|
||||
done
|
||||
|
@ -71,7 +71,7 @@ for item in ${MODULE_OBJS[*]}; do
|
|||
continue;
|
||||
fi
|
||||
|
||||
OBJ_FILE=${GLOBAL_DIR_OBJS}/$item
|
||||
OBJ_FILE=${SRS_OBJS}/$item
|
||||
OBJ_FILE="${OBJ_FILE%.*}.o"
|
||||
echo -n "${OBJ_FILE} " >> ${FILE}
|
||||
done
|
||||
|
|
85
trunk/auto/depends.sh
Normal file
85
trunk/auto/depends.sh
Normal file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TODO: check gcc/g++
|
||||
echo "check gcc/g++/gdb/make/openssl-devel"
|
||||
echo "depends tools are ok"
|
||||
|
||||
#####################################################################################
|
||||
# st-1.9
|
||||
#####################################################################################
|
||||
if [[ -f ${SRS_OBJS}/st-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; 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 && make linux-debug &&
|
||||
cd .. && rm -f st && ln -sf st-1.9/obj st
|
||||
)
|
||||
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-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
|
||||
#####################################################################################
|
||||
# http-parser-2.1
|
||||
#####################################################################################
|
||||
if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then
|
||||
echo "http-parser-2.1 is ok.";
|
||||
else
|
||||
echo "build http-parser-2.1";
|
||||
(
|
||||
rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
|
||||
cd http-parser-2.1 &&
|
||||
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
|
||||
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
|
||||
make package &&
|
||||
cd .. && rm -f hp && ln -sf http-parser-2.1 hp
|
||||
)
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
|
||||
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
|
||||
#####################################################################################
|
||||
# nginx for HLS, nginx-1.5.0
|
||||
#####################################################################################
|
||||
if [ $SRS_HLS = YES ]; then
|
||||
if [[ -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then
|
||||
echo "nginx-1.5.7 is ok.";
|
||||
else
|
||||
echo "build nginx-1.5.7";
|
||||
(
|
||||
rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} &&
|
||||
unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
|
||||
./configure --prefix=`pwd`/_release && make && make install &&
|
||||
ln -sf `pwd`/_release ../nginx
|
||||
)
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi
|
||||
if [ ! -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi
|
||||
|
||||
# use current user to config nginx,
|
||||
# srs will write ts/m3u8 file use current user,
|
||||
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
|
||||
cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
|
||||
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
|
||||
fi
|
||||
|
||||
if [ $SRS_HLS = YES ]; then
|
||||
echo "#define SRS_HLS" >> $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
echo "#undef SRS_HLS" >> $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# openssl, for rtmp complex handshake
|
||||
#####################################################################################
|
||||
if [ $SRS_SSL = YES ]; then
|
||||
echo "#define SRS_SSL" >> $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H
|
||||
fi
|
13
trunk/auto/modules.sh
Executable file → Normal file
13
trunk/auto/modules.sh
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
# params:
|
||||
# $GLOBAL_DIR_OBJS the objs directory. ie. objs
|
||||
# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile
|
||||
# $SRS_OBJS the objs directory. ie. objs
|
||||
# $SRS_MAKEFILE the makefile name. ie. Makefile
|
||||
# $MODULE_DIR the module dir. ie. src/os/linux
|
||||
# $MODULE_ID the id of module. ie. CORE
|
||||
# $MODULE_DEPENDS array, the denpend MODULEs id. ie. (CORE OS)
|
||||
|
@ -10,7 +10,7 @@
|
|||
# returns:
|
||||
# $MODULE_OBJS array, the objects of the modules.
|
||||
|
||||
FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
||||
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
|
||||
# INCS
|
||||
INCS_NAME="${MODULE_ID}_INCS"
|
||||
|
@ -46,16 +46,17 @@ echo "" >> ${FILE}; echo "" >> ${FILE}
|
|||
MODULE_OBJS=()
|
||||
for item in ${MODULE_FILES[*]}; do
|
||||
CPP_FILE="${MODULE_DIR}/${item}.cpp"
|
||||
OBJ_FILE="${GLOBAL_DIR_OBJS}/${MODULE_DIR}/${item}.o"
|
||||
OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o"
|
||||
MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
|
||||
if [ -f ${CPP_FILE} ]; then
|
||||
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
|
||||
echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})-o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
|
||||
echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE}
|
||||
echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
|
||||
fi
|
||||
done
|
||||
echo "" >> ${FILE}
|
||||
|
||||
# Makefile
|
||||
echo " mkdir -p ${GLOBAL_DIR_OBJS}/${MODULE_DIR}" >> ${GLOBAL_FILE_MAKEFILE}
|
||||
echo " mkdir -p ${SRS_OBJS}/${MODULE_DIR}" >> ${SRS_MAKEFILE}
|
||||
|
||||
echo -n "generate module ${MODULE_ID} ok"; echo '!';
|
||||
|
|
66
trunk/auto/options.sh
Normal file
66
trunk/auto/options.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
|
||||
help=no
|
||||
|
||||
SRS_HLS=RESERVED
|
||||
SRS_SSL=RESERVED
|
||||
|
||||
opt=
|
||||
|
||||
for option
|
||||
do
|
||||
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
|
||||
|
||||
case "$option" in
|
||||
-*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) value="" ;;
|
||||
esac
|
||||
|
||||
case "$option" in
|
||||
--help) help=yes ;;
|
||||
|
||||
--with-ssl) SRS_SSL=YES ;;
|
||||
--with-hls) SRS_HLS=YES ;;
|
||||
|
||||
--without-ssl) SRS_SSL=NO ;;
|
||||
--without-hls) SRS_HLS=NO ;;
|
||||
|
||||
*)
|
||||
echo "$0: error: invalid option \"$option\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# save all config options to macro.
|
||||
SRS_CONFIGURE="$opt"
|
||||
|
||||
if [ $help = yes ]; then
|
||||
cat << END
|
||||
|
||||
--help print this message
|
||||
|
||||
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
|
||||
to delivery h264 video and aac audio to flash player.
|
||||
--with-hls enable hls streaming, build nginx as http server for hls.
|
||||
|
||||
--without-ssl disable rtmp complex handshake.
|
||||
--without-hls disable hls, rtmp streaming only.
|
||||
|
||||
END
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
__check_ok=YES
|
||||
if [ $SRS_SSL = RESERVED ]; then
|
||||
echo "you must specifies the ssl, see: ./configure --help";
|
||||
__check_ok=NO
|
||||
fi
|
||||
if [ $SRS_HLS = RESERVED ]; then
|
||||
echo "you must specifies the hls, see: ./configure --help";
|
||||
__check_ok=NO
|
||||
fi
|
||||
if [ $__check_ok = NO ]; then
|
||||
exit 1;
|
||||
fi
|
106
trunk/configure
vendored
106
trunk/configure
vendored
|
@ -1,79 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
GLOBAL_FILE_MAKEFILE="Makefile"
|
||||
GLOBAL_DIR_OBJS="objs"
|
||||
SRS_MAKEFILE="Makefile"
|
||||
SRS_OBJS="objs"
|
||||
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
|
||||
|
||||
mkdir -p ${GLOBAL_DIR_OBJS}
|
||||
mkdir -p ${SRS_OBJS}
|
||||
|
||||
echo "check gcc/g++/gdb/make/openssl-devel"
|
||||
echo "depends tools are ok"
|
||||
|
||||
#####################################################################################
|
||||
# prepare the depends tools
|
||||
#####################################################################################
|
||||
# st-1.9
|
||||
if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]]; then
|
||||
echo "st-1.9t is ok.";
|
||||
else
|
||||
echo "build st-1.9t";
|
||||
(
|
||||
rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} &&
|
||||
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug &&
|
||||
cd .. && rm -f st && ln -sf st-1.9/obj st
|
||||
)
|
||||
# clean the exists
|
||||
if [[ -f Makefile ]]; then
|
||||
make clean
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi
|
||||
if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
|
||||
# http-parser-2.1
|
||||
if [[ -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h && -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then
|
||||
echo "http-parser-2.1 is ok.";
|
||||
else
|
||||
echo "build http-parser-2.1";
|
||||
(
|
||||
rm -rf ${GLOBAL_DIR_OBJS}/http-parser-2.1 && cd ${GLOBAL_DIR_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
|
||||
cd http-parser-2.1 &&
|
||||
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
|
||||
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
|
||||
make package &&
|
||||
cd .. && rm -f hp && ln -sf http-parser-2.1 hp
|
||||
)
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
|
||||
if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
# parse user options.
|
||||
. auto/options.sh
|
||||
|
||||
# nginx for HLS, nginx-1.5.0
|
||||
if [[ -f ${GLOBAL_DIR_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then
|
||||
echo "nginx-1.5.7 is ok.";
|
||||
else
|
||||
echo "build nginx-1.5.7";
|
||||
(
|
||||
rm -rf ${GLOBAL_DIR_OBJS}/nginx-1.5.7 && cd ${GLOBAL_DIR_OBJS} &&
|
||||
unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
|
||||
./configure --prefix=`pwd`/_release && make && make install &&
|
||||
ln -sf `pwd`/_release ../nginx
|
||||
)
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi
|
||||
if [ ! -f ${GLOBAL_DIR_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi
|
||||
# generate the audo headers file.
|
||||
echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H
|
||||
|
||||
# use current user to config nginx,
|
||||
# srs will write ts/m3u8 file use current user,
|
||||
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
|
||||
cp ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf.bk
|
||||
sed -i "s/^.user nobody;/user `whoami`;/g" ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf
|
||||
# apply user options.
|
||||
. auto/depends.sh
|
||||
|
||||
# new empty line to auto headers file.
|
||||
echo "" >> $SRS_AUTO_HEADERS_H
|
||||
|
||||
#####################################################################################
|
||||
# generate Makefile.
|
||||
#####################################################################################
|
||||
echo "generate Makefile"
|
||||
|
||||
cat << END > ${GLOBAL_FILE_MAKEFILE}
|
||||
cat << END > ${SRS_MAKEFILE}
|
||||
.PHONY: default help clean server _prepare_dir
|
||||
default: server
|
||||
|
||||
|
@ -84,15 +39,15 @@ help:
|
|||
@echo " server build the srs(simple rtmp server) over st(state-threads)"
|
||||
|
||||
clean:
|
||||
(cd ${GLOBAL_DIR_OBJS}; rm -rf src st_*_load)
|
||||
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf Makefile *.hpp src st_*_load)
|
||||
|
||||
server: _prepare_dir
|
||||
@echo "build the srs(simple rtmp server) over st(state-threads)"
|
||||
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} simple_rtmp_server
|
||||
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} simple_rtmp_server
|
||||
|
||||
# the ./configure will generate it.
|
||||
_prepare_dir:
|
||||
@mkdir -p ${GLOBAL_DIR_OBJS}
|
||||
@mkdir -p ${SRS_OBJS}
|
||||
END
|
||||
|
||||
echo 'generate Makefile ok!'
|
||||
|
@ -108,7 +63,7 @@ CppStd="-ansi"
|
|||
# the cxx flag generated.
|
||||
CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}"
|
||||
#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
|
||||
cat << END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
||||
cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
CXXFLAGS = ${CXXFLAGS}
|
||||
GCC = g++
|
||||
LINK = \$(GCC)
|
||||
|
@ -121,15 +76,15 @@ default:
|
|||
END
|
||||
|
||||
# Libraries
|
||||
LibSTRoot="${GLOBAL_DIR_OBJS}/st"
|
||||
LibSTRoot="${SRS_OBJS}/st"
|
||||
LibSTfile="${LibSTRoot}/libst.a"
|
||||
LibHttpParserRoot="${GLOBAL_DIR_OBJS}/hp"
|
||||
LibHttpParserRoot="${SRS_OBJS}/hp"
|
||||
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
|
||||
|
||||
#Core Module
|
||||
MODULE_ID="CORE"
|
||||
MODULE_DEPENDS=()
|
||||
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot})
|
||||
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS})
|
||||
MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
|
||||
"srs_core_error" "srs_core_conn" "srs_core_client"
|
||||
"srs_core_rtmp" "srs_core_socket" "srs_core_buffer"
|
||||
|
@ -144,7 +99,7 @@ CORE_OBJS="${MODULE_OBJS[@]}"
|
|||
#Main Module
|
||||
MODULE_ID="MAIN"
|
||||
MODULE_DEPENDS=("CORE")
|
||||
ModuleLibIncs=(${LibSTRoot})
|
||||
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS})
|
||||
MODULE_FILES=("srs_main_server")
|
||||
MODULE_DIR="src/main" . auto/modules.sh
|
||||
MAIN_OBJS="${MODULE_OBJS[@].o}"
|
||||
|
@ -155,7 +110,12 @@ MAIN_ENTRANCES=("srs_main_server")
|
|||
# srs(simple rtmp server) over st(state-threads)
|
||||
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
|
||||
MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
|
||||
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" LINK_OPTIONS="-ldl -lssl -lcrypto" SO_PATH="" . auto/apps.sh
|
||||
if [ $SRS_SSL = YES ]; then
|
||||
LINK_OPTIONS="-ldl -lssl -lcrypto"
|
||||
else
|
||||
LINK_OPTIONS="-ldl"
|
||||
fi
|
||||
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" SO_PATH="" . auto/apps.sh
|
||||
|
||||
echo 'configure ok! '
|
||||
|
||||
|
@ -163,5 +123,7 @@ echo 'configure ok! '
|
|||
echo "you can:"
|
||||
echo "\" make \" to build the srs(simple rtmp server)."
|
||||
echo "\" make help \" to get the usage of make"
|
||||
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
|
||||
if [ $SRS_HLS = YES ]; then
|
||||
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
|
||||
fi
|
||||
echo "\" ./objs/simple_rtmp_server -c conf/srs.conf \" to start the srs live server"
|
||||
|
|
|
@ -46,6 +46,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// generated by configure.
|
||||
#include <srs_auto_headers.hpp>
|
||||
|
||||
// free the p and set to NULL.
|
||||
// p must be a T*.
|
||||
#define srs_freep(p) \
|
||||
|
|
|
@ -703,6 +703,8 @@ int SrsConfig::parse_file(const char* filename)
|
|||
}
|
||||
// TODO: check the hls.
|
||||
// TODO: check other config.
|
||||
// TODO: check hls.
|
||||
// TODO: check ssl.
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -756,6 +758,7 @@ void SrsConfig::print_help(char** argv)
|
|||
{
|
||||
printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION
|
||||
" Copyright (c) 2013 winlin\n"
|
||||
"configuration: "SRS_CONFIGURE"\n"
|
||||
"Usage: %s [-h?vV] [-c <filename>]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
|
@ -765,7 +768,8 @@ void SrsConfig::print_help(char** argv)
|
|||
"\n"
|
||||
RTMP_SIG_SRS_WEB"\n"
|
||||
RTMP_SIG_SRS_URL"\n"
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n",
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n"
|
||||
"\n",
|
||||
argv[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ void srs_random_generate(char* bytes, int size)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SRS_SSL
|
||||
|
||||
// 68bytes FMS key which is used to sign the sever packet.
|
||||
u_int8_t SrsGenuineFMSKey[] = {
|
||||
0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20,
|
||||
|
@ -1055,6 +1057,8 @@ void c1s1::destroy_blocks()
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SrsSimpleHandshake::SrsSimpleHandshake()
|
||||
{
|
||||
}
|
||||
|
@ -1129,10 +1133,16 @@ SrsComplexHandshake::~SrsComplexHandshake()
|
|||
{
|
||||
}
|
||||
|
||||
#ifndef SRS_SSL
|
||||
int SrsComplexHandshake::handshake(SrsSocket& /*skt*/, char* /*_c1*/)
|
||||
{
|
||||
return ERROR_RTMP_TRY_SIMPLE_HS;
|
||||
}
|
||||
#else
|
||||
int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
ssize_t nsize;
|
||||
|
||||
static bool _random_initialized = false;
|
||||
|
@ -1204,4 +1214,5 @@ int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_core_hls.hpp>
|
||||
|
||||
#ifdef SRS_HLS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -731,11 +733,11 @@ int SrsHls::reopen()
|
|||
}
|
||||
if (!segment_to_remove.empty()) {
|
||||
segments.erase(segments.begin(), segments.begin() + segment_to_remove.size());
|
||||
}
|
||||
|
||||
// refresh the m3u8, donot contains the removed ts
|
||||
if ((ret = refresh_m3u8()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
// refresh the m3u8, donot contains the removed ts
|
||||
if ((ret = refresh_m3u8()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// remove the ts file.
|
||||
|
@ -1152,3 +1154,5 @@ bool SrsTSMuxer::fresh()
|
|||
return _fresh;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
*/
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#ifdef SRS_HLS
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -173,4 +175,6 @@ public:
|
|||
virtual bool fresh();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -257,7 +257,10 @@ SrsSource* SrsSource::find(std::string stream_url)
|
|||
SrsSource::SrsSource(std::string _stream_url)
|
||||
{
|
||||
stream_url = _stream_url;
|
||||
|
||||
#ifdef SRS_HLS
|
||||
hls = new SrsHls();
|
||||
#endif
|
||||
|
||||
cache_metadata = cache_sh_video = cache_sh_audio = NULL;
|
||||
|
||||
|
@ -282,17 +285,21 @@ SrsSource::~SrsSource()
|
|||
srs_freep(cache_sh_video);
|
||||
srs_freep(cache_sh_audio);
|
||||
|
||||
#ifdef SRS_HLS
|
||||
srs_freep(hls);
|
||||
#endif
|
||||
}
|
||||
|
||||
int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_meta_data(metadata)) != ERROR_SUCCESS) {
|
||||
srs_error("hls process onMetaData message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
metadata->metadata->set("server", new SrsAmf0String(
|
||||
RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));
|
||||
|
@ -363,10 +370,12 @@ int SrsSource::on_audio(SrsCommonMessage* audio)
|
|||
}
|
||||
srs_verbose("initialize shared ptr audio success.");
|
||||
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) {
|
||||
srs_error("hls process audio message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
// detach the original audio
|
||||
audio->payload = NULL;
|
||||
|
@ -413,11 +422,12 @@ int SrsSource::on_video(SrsCommonMessage* video)
|
|||
}
|
||||
srs_verbose("initialize shared ptr video success.");
|
||||
|
||||
// TODO: when return error, crash.
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) {
|
||||
srs_error("hls process video message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
// detach the original audio
|
||||
video->payload = NULL;
|
||||
|
@ -452,15 +462,24 @@ int SrsSource::on_video(SrsCommonMessage* video)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_HLS
|
||||
int SrsSource::on_publish(std::string vhost, std::string app, std::string stream)
|
||||
{
|
||||
return hls->on_publish(vhost, app, stream);
|
||||
}
|
||||
#else
|
||||
int SrsSource::on_publish(std::string /*vhost*/, std::string /*app*/, std::string /*stream*/)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SrsSource::on_unpublish()
|
||||
{
|
||||
#ifdef SRS_HLS
|
||||
hls->on_unpublish();
|
||||
|
||||
#endif
|
||||
|
||||
clear_gop_cache();
|
||||
|
||||
srs_freep(cache_metadata);
|
||||
|
|
|
@ -38,7 +38,9 @@ class SrsSource;
|
|||
class SrsCommonMessage;
|
||||
class SrsOnMetaDataPacket;
|
||||
class SrsSharedPtrMessage;
|
||||
#ifdef SRS_HLS
|
||||
class SrsHls;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* time jitter detect and correct,
|
||||
|
@ -125,7 +127,9 @@ public:
|
|||
*/
|
||||
static SrsSource* find(std::string stream_url);
|
||||
private:
|
||||
#ifdef SRS_HLS
|
||||
SrsHls* hls;
|
||||
#endif
|
||||
std::string stream_url;
|
||||
std::vector<SrsConsumer*> consumers;
|
||||
// gop cache for client fast startup.
|
||||
|
|
2
trunk/src/srs/srs.upp
Normal file → Executable file
2
trunk/src/srs/srs.upp
Normal file → Executable file
|
@ -1,6 +1,8 @@
|
|||
file
|
||||
main readonly separator,
|
||||
..\main\srs_main_server.cpp,
|
||||
auto readonly separator,
|
||||
..\..\objs\srs_auto_headers.hpp,
|
||||
core readonly separator,
|
||||
..\core\srs_core.hpp,
|
||||
..\core\srs_core.cpp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue