正在显示
14 个修改的文件
包含
257 行增加
和
90 行删除
| @@ -12,7 +12,7 @@ step 1: build srs <br/> | @@ -12,7 +12,7 @@ step 1: build srs <br/> | ||
| 12 | <pre> | 12 | <pre> |
| 13 | tar xf simple-rtmp-server-*.*.tar.gz | 13 | tar xf simple-rtmp-server-*.*.tar.gz |
| 14 | cd simple-rtmp-server-*.*/trunk | 14 | cd simple-rtmp-server-*.*/trunk |
| 15 | -./configure | 15 | +./configure --with-ssl --with-hls |
| 16 | make | 16 | make |
| 17 | </pre> | 17 | </pre> |
| 18 | step 2: start srs <br/> | 18 | step 2: start srs <br/> |
| @@ -64,6 +64,8 @@ m3u8 url: http://127.0.0.1:80/live/livestream.m3u8 | @@ -64,6 +64,8 @@ m3u8 url: http://127.0.0.1:80/live/livestream.m3u8 | ||
| 64 | * nginx v1.5.0: 139524 lines <br/> | 64 | * nginx v1.5.0: 139524 lines <br/> |
| 65 | 65 | ||
| 66 | ### History | 66 | ### History |
| 67 | +* v0.6, 2013-11-27, support --with or --without -hls and -ssl options. | ||
| 68 | +* v0.6, 2013-11-27, support AAC 44100HZ sample rate for iphone, adjust the timestamp. | ||
| 67 | * v0.5, 2013-11-26, v0.5 released. 14449 lines. | 69 | * v0.5, 2013-11-26, v0.5 released. 14449 lines. |
| 68 | * v0.5, 2013-11-24, support HLS(m3u8), fragment and window. | 70 | * v0.5, 2013-11-24, support HLS(m3u8), fragment and window. |
| 69 | * v0.5, 2013-11-24, support record to ts file for HLS. | 71 | * v0.5, 2013-11-24, support record to ts file for HLS. |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | # params: | 3 | # params: |
| 4 | -# $GLOBAL_DIR_OBJS the objs directory. ie. objs | ||
| 5 | -# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile | 4 | +# $SRS_OBJS the objs directory. ie. objs |
| 5 | +# $SRS_MAKEFILE the makefile name. ie. Makefile | ||
| 6 | # $MAIN_ENTRANCES array, all main entrance, disable all except the $APP_MAIN itself | 6 | # $MAIN_ENTRANCES array, all main entrance, disable all except the $APP_MAIN itself |
| 7 | # $MODULE_OBJS array, the objects to compile the app. | 7 | # $MODULE_OBJS array, the objects to compile the app. |
| 8 | # $BUILD_KEY a string indicates the build key for Makefile. ie. dump | 8 | # $BUILD_KEY a string indicates the build key for Makefile. ie. dump |
| @@ -12,9 +12,9 @@ | @@ -12,9 +12,9 @@ | ||
| 12 | # $LINK_OPTIONS the linker options. | 12 | # $LINK_OPTIONS the linker options. |
| 13 | # $SO_PATH the libssl.so.10 and other so file path. | 13 | # $SO_PATH the libssl.so.10 and other so file path. |
| 14 | 14 | ||
| 15 | -FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} | 15 | +FILE=${SRS_OBJS}/${SRS_MAKEFILE} |
| 16 | 16 | ||
| 17 | -APP_TARGET="${GLOBAL_DIR_OBJS}/${APP_NAME}" | 17 | +APP_TARGET="${SRS_OBJS}/${APP_NAME}" |
| 18 | 18 | ||
| 19 | echo "generate app ${APP_NAME} depends..."; | 19 | echo "generate app ${APP_NAME} depends..."; |
| 20 | 20 | ||
| @@ -42,7 +42,7 @@ for item in ${MODULE_OBJS[*]}; do | @@ -42,7 +42,7 @@ for item in ${MODULE_OBJS[*]}; do | ||
| 42 | continue; | 42 | continue; |
| 43 | fi | 43 | fi |
| 44 | 44 | ||
| 45 | - OBJ_FILE=${GLOBAL_DIR_OBJS}/$item | 45 | + OBJ_FILE=${SRS_OBJS}/$item |
| 46 | OBJ_FILE="${OBJ_FILE%.*}.o" | 46 | OBJ_FILE="${OBJ_FILE%.*}.o" |
| 47 | echo -n "${OBJ_FILE} " >> ${FILE} | 47 | echo -n "${OBJ_FILE} " >> ${FILE} |
| 48 | done | 48 | done |
| @@ -71,7 +71,7 @@ for item in ${MODULE_OBJS[*]}; do | @@ -71,7 +71,7 @@ for item in ${MODULE_OBJS[*]}; do | ||
| 71 | continue; | 71 | continue; |
| 72 | fi | 72 | fi |
| 73 | 73 | ||
| 74 | - OBJ_FILE=${GLOBAL_DIR_OBJS}/$item | 74 | + OBJ_FILE=${SRS_OBJS}/$item |
| 75 | OBJ_FILE="${OBJ_FILE%.*}.o" | 75 | OBJ_FILE="${OBJ_FILE%.*}.o" |
| 76 | echo -n "${OBJ_FILE} " >> ${FILE} | 76 | echo -n "${OBJ_FILE} " >> ${FILE} |
| 77 | done | 77 | done |
trunk/auto/depends.sh
0 → 100644
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +# TODO: check gcc/g++ | ||
| 4 | +echo "check gcc/g++/gdb/make/openssl-devel" | ||
| 5 | +echo "depends tools are ok" | ||
| 6 | + | ||
| 7 | +##################################################################################### | ||
| 8 | +# st-1.9 | ||
| 9 | +##################################################################################### | ||
| 10 | +if [[ -f ${SRS_OBJS}/st-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; then | ||
| 11 | + echo "st-1.9t is ok."; | ||
| 12 | +else | ||
| 13 | + echo "build st-1.9t"; | ||
| 14 | + ( | ||
| 15 | + rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && | ||
| 16 | + unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug && | ||
| 17 | + cd .. && rm -f st && ln -sf st-1.9/obj st | ||
| 18 | + ) | ||
| 19 | +fi | ||
| 20 | +# check status | ||
| 21 | +ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi | ||
| 22 | +if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi | ||
| 23 | +if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi | ||
| 24 | + | ||
| 25 | +##################################################################################### | ||
| 26 | +# http-parser-2.1 | ||
| 27 | +##################################################################################### | ||
| 28 | +if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then | ||
| 29 | + echo "http-parser-2.1 is ok."; | ||
| 30 | +else | ||
| 31 | + echo "build http-parser-2.1"; | ||
| 32 | + ( | ||
| 33 | + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && | ||
| 34 | + cd http-parser-2.1 && | ||
| 35 | + sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && | ||
| 36 | + sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && | ||
| 37 | + make package && | ||
| 38 | + cd .. && rm -f hp && ln -sf http-parser-2.1 hp | ||
| 39 | + ) | ||
| 40 | +fi | ||
| 41 | +# check status | ||
| 42 | +ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi | ||
| 43 | +if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 44 | +if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 45 | + | ||
| 46 | +##################################################################################### | ||
| 47 | +# nginx for HLS, nginx-1.5.0 | ||
| 48 | +##################################################################################### | ||
| 49 | +if [ $SRS_HLS = YES ]; then | ||
| 50 | + if [[ -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then | ||
| 51 | + echo "nginx-1.5.7 is ok."; | ||
| 52 | + else | ||
| 53 | + echo "build nginx-1.5.7"; | ||
| 54 | + ( | ||
| 55 | + rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && | ||
| 56 | + unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && | ||
| 57 | + ./configure --prefix=`pwd`/_release && make && make install && | ||
| 58 | + ln -sf `pwd`/_release ../nginx | ||
| 59 | + ) | ||
| 60 | + fi | ||
| 61 | + # check status | ||
| 62 | + ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi | ||
| 63 | + if [ ! -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi | ||
| 64 | + | ||
| 65 | + # use current user to config nginx, | ||
| 66 | + # srs will write ts/m3u8 file use current user, | ||
| 67 | + # nginx default use nobody, so cannot read the ts/m3u8 created by srs. | ||
| 68 | + cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk | ||
| 69 | + sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf | ||
| 70 | +fi | ||
| 71 | + | ||
| 72 | +if [ $SRS_HLS = YES ]; then | ||
| 73 | + echo "#define SRS_HLS" >> $SRS_AUTO_HEADERS_H | ||
| 74 | +else | ||
| 75 | + echo "#undef SRS_HLS" >> $SRS_AUTO_HEADERS_H | ||
| 76 | +fi | ||
| 77 | + | ||
| 78 | +##################################################################################### | ||
| 79 | +# openssl, for rtmp complex handshake | ||
| 80 | +##################################################################################### | ||
| 81 | +if [ $SRS_SSL = YES ]; then | ||
| 82 | + echo "#define SRS_SSL" >> $SRS_AUTO_HEADERS_H | ||
| 83 | +else | ||
| 84 | + echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H | ||
| 85 | +fi |
trunk/auto/modules.sh
100755 → 100644
| 1 | # params: | 1 | # params: |
| 2 | -# $GLOBAL_DIR_OBJS the objs directory. ie. objs | ||
| 3 | -# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile | 2 | +# $SRS_OBJS the objs directory. ie. objs |
| 3 | +# $SRS_MAKEFILE the makefile name. ie. Makefile | ||
| 4 | # $MODULE_DIR the module dir. ie. src/os/linux | 4 | # $MODULE_DIR the module dir. ie. src/os/linux |
| 5 | # $MODULE_ID the id of module. ie. CORE | 5 | # $MODULE_ID the id of module. ie. CORE |
| 6 | # $MODULE_DEPENDS array, the denpend MODULEs id. ie. (CORE OS) | 6 | # $MODULE_DEPENDS array, the denpend MODULEs id. ie. (CORE OS) |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | # returns: | 10 | # returns: |
| 11 | # $MODULE_OBJS array, the objects of the modules. | 11 | # $MODULE_OBJS array, the objects of the modules. |
| 12 | 12 | ||
| 13 | -FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} | 13 | +FILE=${SRS_OBJS}/${SRS_MAKEFILE} |
| 14 | 14 | ||
| 15 | # INCS | 15 | # INCS |
| 16 | INCS_NAME="${MODULE_ID}_INCS" | 16 | INCS_NAME="${MODULE_ID}_INCS" |
| @@ -46,16 +46,17 @@ echo "" >> ${FILE}; echo "" >> ${FILE} | @@ -46,16 +46,17 @@ echo "" >> ${FILE}; echo "" >> ${FILE} | ||
| 46 | MODULE_OBJS=() | 46 | MODULE_OBJS=() |
| 47 | for item in ${MODULE_FILES[*]}; do | 47 | for item in ${MODULE_FILES[*]}; do |
| 48 | CPP_FILE="${MODULE_DIR}/${item}.cpp" | 48 | CPP_FILE="${MODULE_DIR}/${item}.cpp" |
| 49 | - OBJ_FILE="${GLOBAL_DIR_OBJS}/${MODULE_DIR}/${item}.o" | 49 | + OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o" |
| 50 | MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" | 50 | MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" |
| 51 | if [ -f ${CPP_FILE} ]; then | 51 | if [ -f ${CPP_FILE} ]; then |
| 52 | echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE} | 52 | echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE} |
| 53 | - echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})-o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE} | 53 | + echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE} |
| 54 | + echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE} | ||
| 54 | fi | 55 | fi |
| 55 | done | 56 | done |
| 56 | echo "" >> ${FILE} | 57 | echo "" >> ${FILE} |
| 57 | 58 | ||
| 58 | # Makefile | 59 | # Makefile |
| 59 | -echo " mkdir -p ${GLOBAL_DIR_OBJS}/${MODULE_DIR}" >> ${GLOBAL_FILE_MAKEFILE} | 60 | +echo " mkdir -p ${SRS_OBJS}/${MODULE_DIR}" >> ${SRS_MAKEFILE} |
| 60 | 61 | ||
| 61 | echo -n "generate module ${MODULE_ID} ok"; echo '!'; | 62 | echo -n "generate module ${MODULE_ID} ok"; echo '!'; |
trunk/auto/options.sh
0 → 100644
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +help=no | ||
| 4 | + | ||
| 5 | +SRS_HLS=RESERVED | ||
| 6 | +SRS_SSL=RESERVED | ||
| 7 | + | ||
| 8 | +opt= | ||
| 9 | + | ||
| 10 | +for option | ||
| 11 | +do | ||
| 12 | + opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`" | ||
| 13 | + | ||
| 14 | + case "$option" in | ||
| 15 | + -*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; | ||
| 16 | + *) value="" ;; | ||
| 17 | + esac | ||
| 18 | + | ||
| 19 | + case "$option" in | ||
| 20 | + --help) help=yes ;; | ||
| 21 | + | ||
| 22 | + --with-ssl) SRS_SSL=YES ;; | ||
| 23 | + --with-hls) SRS_HLS=YES ;; | ||
| 24 | + | ||
| 25 | + --without-ssl) SRS_SSL=NO ;; | ||
| 26 | + --without-hls) SRS_HLS=NO ;; | ||
| 27 | + | ||
| 28 | + *) | ||
| 29 | + echo "$0: error: invalid option \"$option\"" | ||
| 30 | + exit 1 | ||
| 31 | + ;; | ||
| 32 | + esac | ||
| 33 | +done | ||
| 34 | + | ||
| 35 | +# save all config options to macro. | ||
| 36 | +SRS_CONFIGURE="$opt" | ||
| 37 | + | ||
| 38 | +if [ $help = yes ]; then | ||
| 39 | +cat << END | ||
| 40 | + | ||
| 41 | + --help print this message | ||
| 42 | + | ||
| 43 | + --with-ssl enable rtmp complex handshake, requires openssl-devel installed. | ||
| 44 | + to delivery h264 video and aac audio to flash player. | ||
| 45 | + --with-hls enable hls streaming, build nginx as http server for hls. | ||
| 46 | + | ||
| 47 | + --without-ssl disable rtmp complex handshake. | ||
| 48 | + --without-hls disable hls, rtmp streaming only. | ||
| 49 | + | ||
| 50 | +END | ||
| 51 | + | ||
| 52 | + exit 1 | ||
| 53 | +fi | ||
| 54 | + | ||
| 55 | +__check_ok=YES | ||
| 56 | +if [ $SRS_SSL = RESERVED ]; then | ||
| 57 | + echo "you must specifies the ssl, see: ./configure --help"; | ||
| 58 | + __check_ok=NO | ||
| 59 | +fi | ||
| 60 | +if [ $SRS_HLS = RESERVED ]; then | ||
| 61 | + echo "you must specifies the hls, see: ./configure --help"; | ||
| 62 | + __check_ok=NO | ||
| 63 | +fi | ||
| 64 | +if [ $__check_ok = NO ]; then | ||
| 65 | + exit 1; | ||
| 66 | +fi |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | -GLOBAL_FILE_MAKEFILE="Makefile" | ||
| 4 | -GLOBAL_DIR_OBJS="objs" | 3 | +SRS_MAKEFILE="Makefile" |
| 4 | +SRS_OBJS="objs" | ||
| 5 | +SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp" | ||
| 5 | 6 | ||
| 6 | -mkdir -p ${GLOBAL_DIR_OBJS} | 7 | +mkdir -p ${SRS_OBJS} |
| 7 | 8 | ||
| 8 | -echo "check gcc/g++/gdb/make/openssl-devel" | ||
| 9 | -echo "depends tools are ok" | ||
| 10 | - | ||
| 11 | -##################################################################################### | ||
| 12 | -# prepare the depends tools | ||
| 13 | -##################################################################################### | ||
| 14 | -# st-1.9 | ||
| 15 | -if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]]; then | ||
| 16 | - echo "st-1.9t is ok."; | ||
| 17 | -else | ||
| 18 | - echo "build st-1.9t"; | ||
| 19 | - ( | ||
| 20 | - rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} && | ||
| 21 | - unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug && | ||
| 22 | - cd .. && rm -f st && ln -sf st-1.9/obj st | ||
| 23 | - ) | ||
| 24 | -fi | ||
| 25 | -# check status | ||
| 26 | -ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi | ||
| 27 | -if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi | ||
| 28 | -if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi | ||
| 29 | - | ||
| 30 | -# http-parser-2.1 | ||
| 31 | -if [[ -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h && -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then | ||
| 32 | - echo "http-parser-2.1 is ok."; | ||
| 33 | -else | ||
| 34 | - echo "build http-parser-2.1"; | ||
| 35 | - ( | ||
| 36 | - rm -rf ${GLOBAL_DIR_OBJS}/http-parser-2.1 && cd ${GLOBAL_DIR_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && | ||
| 37 | - cd http-parser-2.1 && | ||
| 38 | - sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && | ||
| 39 | - sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && | ||
| 40 | - make package && | ||
| 41 | - cd .. && rm -f hp && ln -sf http-parser-2.1 hp | ||
| 42 | - ) | ||
| 43 | -fi | ||
| 44 | -# check status | ||
| 45 | -ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi | ||
| 46 | -if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 47 | -if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 48 | - | ||
| 49 | -# nginx for HLS, nginx-1.5.0 | ||
| 50 | -if [[ -f ${GLOBAL_DIR_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then | ||
| 51 | - echo "nginx-1.5.7 is ok."; | ||
| 52 | -else | ||
| 53 | - echo "build nginx-1.5.7"; | ||
| 54 | - ( | ||
| 55 | - rm -rf ${GLOBAL_DIR_OBJS}/nginx-1.5.7 && cd ${GLOBAL_DIR_OBJS} && | ||
| 56 | - unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && | ||
| 57 | - ./configure --prefix=`pwd`/_release && make && make install && | ||
| 58 | - ln -sf `pwd`/_release ../nginx | ||
| 59 | - ) | 9 | +# clean the exists |
| 10 | +if [[ -f Makefile ]]; then | ||
| 11 | + make clean | ||
| 60 | fi | 12 | fi |
| 61 | -# check status | ||
| 62 | -ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi | ||
| 63 | -if [ ! -f ${GLOBAL_DIR_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi | ||
| 64 | 13 | ||
| 65 | -# use current user to config nginx, | ||
| 66 | -# srs will write ts/m3u8 file use current user, | ||
| 67 | -# nginx default use nobody, so cannot read the ts/m3u8 created by srs. | ||
| 68 | -cp ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf.bk | ||
| 69 | -sed -i "s/^.user nobody;/user `whoami`;/g" ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf | 14 | +# parse user options. |
| 15 | +. auto/options.sh | ||
| 16 | + | ||
| 17 | +# generate the audo headers file. | ||
| 18 | +echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H | ||
| 19 | + | ||
| 20 | +# apply user options. | ||
| 21 | +. auto/depends.sh | ||
| 22 | + | ||
| 23 | +# new empty line to auto headers file. | ||
| 24 | +echo "" >> $SRS_AUTO_HEADERS_H | ||
| 70 | 25 | ||
| 71 | ##################################################################################### | 26 | ##################################################################################### |
| 72 | # generate Makefile. | 27 | # generate Makefile. |
| 73 | ##################################################################################### | 28 | ##################################################################################### |
| 74 | echo "generate Makefile" | 29 | echo "generate Makefile" |
| 75 | 30 | ||
| 76 | -cat << END > ${GLOBAL_FILE_MAKEFILE} | 31 | +cat << END > ${SRS_MAKEFILE} |
| 77 | .PHONY: default help clean server _prepare_dir | 32 | .PHONY: default help clean server _prepare_dir |
| 78 | default: server | 33 | default: server |
| 79 | 34 | ||
| @@ -84,15 +39,15 @@ help: | @@ -84,15 +39,15 @@ help: | ||
| 84 | @echo " server build the srs(simple rtmp server) over st(state-threads)" | 39 | @echo " server build the srs(simple rtmp server) over st(state-threads)" |
| 85 | 40 | ||
| 86 | clean: | 41 | clean: |
| 87 | - (cd ${GLOBAL_DIR_OBJS}; rm -rf src st_*_load) | 42 | + (rm -f Makefile; cd ${SRS_OBJS}; rm -rf Makefile *.hpp src st_*_load) |
| 88 | 43 | ||
| 89 | server: _prepare_dir | 44 | server: _prepare_dir |
| 90 | @echo "build the srs(simple rtmp server) over st(state-threads)" | 45 | @echo "build the srs(simple rtmp server) over st(state-threads)" |
| 91 | - \$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} simple_rtmp_server | 46 | + \$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} simple_rtmp_server |
| 92 | 47 | ||
| 93 | # the ./configure will generate it. | 48 | # the ./configure will generate it. |
| 94 | _prepare_dir: | 49 | _prepare_dir: |
| 95 | - @mkdir -p ${GLOBAL_DIR_OBJS} | 50 | + @mkdir -p ${SRS_OBJS} |
| 96 | END | 51 | END |
| 97 | 52 | ||
| 98 | echo 'generate Makefile ok!' | 53 | echo 'generate Makefile ok!' |
| @@ -108,7 +63,7 @@ CppStd="-ansi" | @@ -108,7 +63,7 @@ CppStd="-ansi" | ||
| 108 | # the cxx flag generated. | 63 | # the cxx flag generated. |
| 109 | CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}" | 64 | CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}" |
| 110 | #CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}" | 65 | #CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}" |
| 111 | -cat << END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} | 66 | +cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} |
| 112 | CXXFLAGS = ${CXXFLAGS} | 67 | CXXFLAGS = ${CXXFLAGS} |
| 113 | GCC = g++ | 68 | GCC = g++ |
| 114 | LINK = \$(GCC) | 69 | LINK = \$(GCC) |
| @@ -121,15 +76,15 @@ default: | @@ -121,15 +76,15 @@ default: | ||
| 121 | END | 76 | END |
| 122 | 77 | ||
| 123 | # Libraries | 78 | # Libraries |
| 124 | -LibSTRoot="${GLOBAL_DIR_OBJS}/st" | 79 | +LibSTRoot="${SRS_OBJS}/st" |
| 125 | LibSTfile="${LibSTRoot}/libst.a" | 80 | LibSTfile="${LibSTRoot}/libst.a" |
| 126 | -LibHttpParserRoot="${GLOBAL_DIR_OBJS}/hp" | 81 | +LibHttpParserRoot="${SRS_OBJS}/hp" |
| 127 | LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a" | 82 | LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a" |
| 128 | 83 | ||
| 129 | #Core Module | 84 | #Core Module |
| 130 | MODULE_ID="CORE" | 85 | MODULE_ID="CORE" |
| 131 | MODULE_DEPENDS=() | 86 | MODULE_DEPENDS=() |
| 132 | -ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot}) | 87 | +ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS}) |
| 133 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" | 88 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" |
| 134 | "srs_core_error" "srs_core_conn" "srs_core_client" | 89 | "srs_core_error" "srs_core_conn" "srs_core_client" |
| 135 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" | 90 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" |
| @@ -144,7 +99,7 @@ CORE_OBJS="${MODULE_OBJS[@]}" | @@ -144,7 +99,7 @@ CORE_OBJS="${MODULE_OBJS[@]}" | ||
| 144 | #Main Module | 99 | #Main Module |
| 145 | MODULE_ID="MAIN" | 100 | MODULE_ID="MAIN" |
| 146 | MODULE_DEPENDS=("CORE") | 101 | MODULE_DEPENDS=("CORE") |
| 147 | -ModuleLibIncs=(${LibSTRoot}) | 102 | +ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS}) |
| 148 | MODULE_FILES=("srs_main_server") | 103 | MODULE_FILES=("srs_main_server") |
| 149 | MODULE_DIR="src/main" . auto/modules.sh | 104 | MODULE_DIR="src/main" . auto/modules.sh |
| 150 | MAIN_OBJS="${MODULE_OBJS[@].o}" | 105 | MAIN_OBJS="${MODULE_OBJS[@].o}" |
| @@ -155,7 +110,12 @@ MAIN_ENTRANCES=("srs_main_server") | @@ -155,7 +110,12 @@ MAIN_ENTRANCES=("srs_main_server") | ||
| 155 | # srs(simple rtmp server) over st(state-threads) | 110 | # srs(simple rtmp server) over st(state-threads) |
| 156 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile}) | 111 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile}) |
| 157 | MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}" | 112 | MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}" |
| 158 | -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 | 113 | +if [ $SRS_SSL = YES ]; then |
| 114 | + LINK_OPTIONS="-ldl -lssl -lcrypto" | ||
| 115 | +else | ||
| 116 | + LINK_OPTIONS="-ldl" | ||
| 117 | +fi | ||
| 118 | +BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" SO_PATH="" . auto/apps.sh | ||
| 159 | 119 | ||
| 160 | echo 'configure ok! ' | 120 | echo 'configure ok! ' |
| 161 | 121 | ||
| @@ -163,5 +123,7 @@ echo 'configure ok! ' | @@ -163,5 +123,7 @@ echo 'configure ok! ' | ||
| 163 | echo "you can:" | 123 | echo "you can:" |
| 164 | echo "\" make \" to build the srs(simple rtmp server)." | 124 | echo "\" make \" to build the srs(simple rtmp server)." |
| 165 | echo "\" make help \" to get the usage of make" | 125 | echo "\" make help \" to get the usage of make" |
| 166 | -echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls" | 126 | +if [ $SRS_HLS = YES ]; then |
| 127 | + echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls" | ||
| 128 | +fi | ||
| 167 | echo "\" ./objs/simple_rtmp_server -c conf/srs.conf \" to start the srs live server" | 129 | 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. | @@ -46,6 +46,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 46 | #include <stddef.h> | 46 | #include <stddef.h> |
| 47 | #include <sys/types.h> | 47 | #include <sys/types.h> |
| 48 | 48 | ||
| 49 | +// generated by configure. | ||
| 50 | +#include <srs_auto_headers.hpp> | ||
| 51 | + | ||
| 49 | // free the p and set to NULL. | 52 | // free the p and set to NULL. |
| 50 | // p must be a T*. | 53 | // p must be a T*. |
| 51 | #define srs_freep(p) \ | 54 | #define srs_freep(p) \ |
| @@ -703,6 +703,8 @@ int SrsConfig::parse_file(const char* filename) | @@ -703,6 +703,8 @@ int SrsConfig::parse_file(const char* filename) | ||
| 703 | } | 703 | } |
| 704 | // TODO: check the hls. | 704 | // TODO: check the hls. |
| 705 | // TODO: check other config. | 705 | // TODO: check other config. |
| 706 | + // TODO: check hls. | ||
| 707 | + // TODO: check ssl. | ||
| 706 | 708 | ||
| 707 | return ret; | 709 | return ret; |
| 708 | } | 710 | } |
| @@ -756,6 +758,7 @@ void SrsConfig::print_help(char** argv) | @@ -756,6 +758,7 @@ void SrsConfig::print_help(char** argv) | ||
| 756 | { | 758 | { |
| 757 | printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION | 759 | printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION |
| 758 | " Copyright (c) 2013 winlin\n" | 760 | " Copyright (c) 2013 winlin\n" |
| 761 | + "configuration: "SRS_CONFIGURE"\n" | ||
| 759 | "Usage: %s [-h?vV] [-c <filename>]\n" | 762 | "Usage: %s [-h?vV] [-c <filename>]\n" |
| 760 | "\n" | 763 | "\n" |
| 761 | "Options:\n" | 764 | "Options:\n" |
| @@ -765,7 +768,8 @@ void SrsConfig::print_help(char** argv) | @@ -765,7 +768,8 @@ void SrsConfig::print_help(char** argv) | ||
| 765 | "\n" | 768 | "\n" |
| 766 | RTMP_SIG_SRS_WEB"\n" | 769 | RTMP_SIG_SRS_WEB"\n" |
| 767 | RTMP_SIG_SRS_URL"\n" | 770 | RTMP_SIG_SRS_URL"\n" |
| 768 | - "Email: "RTMP_SIG_SRS_EMAIL"\n", | 771 | + "Email: "RTMP_SIG_SRS_EMAIL"\n" |
| 772 | + "\n", | ||
| 769 | argv[0]); | 773 | argv[0]); |
| 770 | } | 774 | } |
| 771 | 775 |
| @@ -44,6 +44,8 @@ void srs_random_generate(char* bytes, int size) | @@ -44,6 +44,8 @@ void srs_random_generate(char* bytes, int size) | ||
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | +#ifdef SRS_SSL | ||
| 48 | + | ||
| 47 | // 68bytes FMS key which is used to sign the sever packet. | 49 | // 68bytes FMS key which is used to sign the sever packet. |
| 48 | u_int8_t SrsGenuineFMSKey[] = { | 50 | u_int8_t SrsGenuineFMSKey[] = { |
| 49 | 0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20, | 51 | 0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20, |
| @@ -1055,6 +1057,8 @@ void c1s1::destroy_blocks() | @@ -1055,6 +1057,8 @@ void c1s1::destroy_blocks() | ||
| 1055 | } | 1057 | } |
| 1056 | } | 1058 | } |
| 1057 | 1059 | ||
| 1060 | +#endif | ||
| 1061 | + | ||
| 1058 | SrsSimpleHandshake::SrsSimpleHandshake() | 1062 | SrsSimpleHandshake::SrsSimpleHandshake() |
| 1059 | { | 1063 | { |
| 1060 | } | 1064 | } |
| @@ -1129,6 +1133,12 @@ SrsComplexHandshake::~SrsComplexHandshake() | @@ -1129,6 +1133,12 @@ SrsComplexHandshake::~SrsComplexHandshake() | ||
| 1129 | { | 1133 | { |
| 1130 | } | 1134 | } |
| 1131 | 1135 | ||
| 1136 | +#ifndef SRS_SSL | ||
| 1137 | +int SrsComplexHandshake::handshake(SrsSocket& /*skt*/, char* /*_c1*/) | ||
| 1138 | +{ | ||
| 1139 | + return ERROR_RTMP_TRY_SIMPLE_HS; | ||
| 1140 | +} | ||
| 1141 | +#else | ||
| 1132 | int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1) | 1142 | int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1) |
| 1133 | { | 1143 | { |
| 1134 | int ret = ERROR_SUCCESS; | 1144 | int ret = ERROR_SUCCESS; |
| @@ -1204,4 +1214,5 @@ int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1) | @@ -1204,4 +1214,5 @@ int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1) | ||
| 1204 | 1214 | ||
| 1205 | return ret; | 1215 | return ret; |
| 1206 | } | 1216 | } |
| 1217 | +#endif | ||
| 1207 | 1218 |
| @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_core_hls.hpp> | 24 | #include <srs_core_hls.hpp> |
| 25 | 25 | ||
| 26 | +#ifdef SRS_HLS | ||
| 27 | + | ||
| 26 | #include <sys/types.h> | 28 | #include <sys/types.h> |
| 27 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| 28 | #include <fcntl.h> | 30 | #include <fcntl.h> |
| @@ -731,12 +733,12 @@ int SrsHls::reopen() | @@ -731,12 +733,12 @@ int SrsHls::reopen() | ||
| 731 | } | 733 | } |
| 732 | if (!segment_to_remove.empty()) { | 734 | if (!segment_to_remove.empty()) { |
| 733 | segments.erase(segments.begin(), segments.begin() + segment_to_remove.size()); | 735 | segments.erase(segments.begin(), segments.begin() + segment_to_remove.size()); |
| 734 | - } | ||
| 735 | 736 | ||
| 736 | // refresh the m3u8, donot contains the removed ts | 737 | // refresh the m3u8, donot contains the removed ts |
| 737 | if ((ret = refresh_m3u8()) != ERROR_SUCCESS) { | 738 | if ((ret = refresh_m3u8()) != ERROR_SUCCESS) { |
| 738 | return ret; | 739 | return ret; |
| 739 | } | 740 | } |
| 741 | + } | ||
| 740 | 742 | ||
| 741 | // remove the ts file. | 743 | // remove the ts file. |
| 742 | for (it = segment_to_remove.rbegin(); it != segment_to_remove.rend(); ++it) { | 744 | for (it = segment_to_remove.rbegin(); it != segment_to_remove.rend(); ++it) { |
| @@ -1152,3 +1154,5 @@ bool SrsTSMuxer::fresh() | @@ -1152,3 +1154,5 @@ bool SrsTSMuxer::fresh() | ||
| 1152 | return _fresh; | 1154 | return _fresh; |
| 1153 | } | 1155 | } |
| 1154 | 1156 | ||
| 1157 | +#endif | ||
| 1158 | + |
| @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | +#ifdef SRS_HLS | ||
| 33 | + | ||
| 32 | #include <string> | 34 | #include <string> |
| 33 | #include <vector> | 35 | #include <vector> |
| 34 | 36 | ||
| @@ -174,3 +176,5 @@ public: | @@ -174,3 +176,5 @@ public: | ||
| 174 | }; | 176 | }; |
| 175 | 177 | ||
| 176 | #endif | 178 | #endif |
| 179 | + | ||
| 180 | +#endif |
| @@ -257,7 +257,10 @@ SrsSource* SrsSource::find(std::string stream_url) | @@ -257,7 +257,10 @@ SrsSource* SrsSource::find(std::string stream_url) | ||
| 257 | SrsSource::SrsSource(std::string _stream_url) | 257 | SrsSource::SrsSource(std::string _stream_url) |
| 258 | { | 258 | { |
| 259 | stream_url = _stream_url; | 259 | stream_url = _stream_url; |
| 260 | + | ||
| 261 | +#ifdef SRS_HLS | ||
| 260 | hls = new SrsHls(); | 262 | hls = new SrsHls(); |
| 263 | +#endif | ||
| 261 | 264 | ||
| 262 | cache_metadata = cache_sh_video = cache_sh_audio = NULL; | 265 | cache_metadata = cache_sh_video = cache_sh_audio = NULL; |
| 263 | 266 | ||
| @@ -282,17 +285,21 @@ SrsSource::~SrsSource() | @@ -282,17 +285,21 @@ SrsSource::~SrsSource() | ||
| 282 | srs_freep(cache_sh_video); | 285 | srs_freep(cache_sh_video); |
| 283 | srs_freep(cache_sh_audio); | 286 | srs_freep(cache_sh_audio); |
| 284 | 287 | ||
| 288 | +#ifdef SRS_HLS | ||
| 285 | srs_freep(hls); | 289 | srs_freep(hls); |
| 290 | +#endif | ||
| 286 | } | 291 | } |
| 287 | 292 | ||
| 288 | int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata) | 293 | int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata) |
| 289 | { | 294 | { |
| 290 | int ret = ERROR_SUCCESS; | 295 | int ret = ERROR_SUCCESS; |
| 291 | 296 | ||
| 297 | +#ifdef SRS_HLS | ||
| 292 | if ((ret = hls->on_meta_data(metadata)) != ERROR_SUCCESS) { | 298 | if ((ret = hls->on_meta_data(metadata)) != ERROR_SUCCESS) { |
| 293 | srs_error("hls process onMetaData message failed. ret=%d", ret); | 299 | srs_error("hls process onMetaData message failed. ret=%d", ret); |
| 294 | return ret; | 300 | return ret; |
| 295 | } | 301 | } |
| 302 | +#endif | ||
| 296 | 303 | ||
| 297 | metadata->metadata->set("server", new SrsAmf0String( | 304 | metadata->metadata->set("server", new SrsAmf0String( |
| 298 | RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); | 305 | RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); |
| @@ -363,10 +370,12 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | @@ -363,10 +370,12 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | ||
| 363 | } | 370 | } |
| 364 | srs_verbose("initialize shared ptr audio success."); | 371 | srs_verbose("initialize shared ptr audio success."); |
| 365 | 372 | ||
| 373 | +#ifdef SRS_HLS | ||
| 366 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { | 374 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { |
| 367 | srs_error("hls process audio message failed. ret=%d", ret); | 375 | srs_error("hls process audio message failed. ret=%d", ret); |
| 368 | return ret; | 376 | return ret; |
| 369 | } | 377 | } |
| 378 | +#endif | ||
| 370 | 379 | ||
| 371 | // detach the original audio | 380 | // detach the original audio |
| 372 | audio->payload = NULL; | 381 | audio->payload = NULL; |
| @@ -413,11 +422,12 @@ int SrsSource::on_video(SrsCommonMessage* video) | @@ -413,11 +422,12 @@ int SrsSource::on_video(SrsCommonMessage* video) | ||
| 413 | } | 422 | } |
| 414 | srs_verbose("initialize shared ptr video success."); | 423 | srs_verbose("initialize shared ptr video success."); |
| 415 | 424 | ||
| 416 | - // TODO: when return error, crash. | 425 | +#ifdef SRS_HLS |
| 417 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { | 426 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { |
| 418 | srs_error("hls process video message failed. ret=%d", ret); | 427 | srs_error("hls process video message failed. ret=%d", ret); |
| 419 | return ret; | 428 | return ret; |
| 420 | } | 429 | } |
| 430 | +#endif | ||
| 421 | 431 | ||
| 422 | // detach the original audio | 432 | // detach the original audio |
| 423 | video->payload = NULL; | 433 | video->payload = NULL; |
| @@ -452,14 +462,23 @@ int SrsSource::on_video(SrsCommonMessage* video) | @@ -452,14 +462,23 @@ int SrsSource::on_video(SrsCommonMessage* video) | ||
| 452 | return ret; | 462 | return ret; |
| 453 | } | 463 | } |
| 454 | 464 | ||
| 465 | +#ifdef SRS_HLS | ||
| 455 | int SrsSource::on_publish(std::string vhost, std::string app, std::string stream) | 466 | int SrsSource::on_publish(std::string vhost, std::string app, std::string stream) |
| 456 | { | 467 | { |
| 457 | return hls->on_publish(vhost, app, stream); | 468 | return hls->on_publish(vhost, app, stream); |
| 458 | } | 469 | } |
| 470 | +#else | ||
| 471 | +int SrsSource::on_publish(std::string /*vhost*/, std::string /*app*/, std::string /*stream*/) | ||
| 472 | +{ | ||
| 473 | + return ERROR_SUCCESS; | ||
| 474 | +} | ||
| 475 | +#endif | ||
| 459 | 476 | ||
| 460 | void SrsSource::on_unpublish() | 477 | void SrsSource::on_unpublish() |
| 461 | { | 478 | { |
| 479 | +#ifdef SRS_HLS | ||
| 462 | hls->on_unpublish(); | 480 | hls->on_unpublish(); |
| 481 | +#endif | ||
| 463 | 482 | ||
| 464 | clear_gop_cache(); | 483 | clear_gop_cache(); |
| 465 | 484 |
| @@ -38,7 +38,9 @@ class SrsSource; | @@ -38,7 +38,9 @@ class SrsSource; | ||
| 38 | class SrsCommonMessage; | 38 | class SrsCommonMessage; |
| 39 | class SrsOnMetaDataPacket; | 39 | class SrsOnMetaDataPacket; |
| 40 | class SrsSharedPtrMessage; | 40 | class SrsSharedPtrMessage; |
| 41 | +#ifdef SRS_HLS | ||
| 41 | class SrsHls; | 42 | class SrsHls; |
| 43 | +#endif | ||
| 42 | 44 | ||
| 43 | /** | 45 | /** |
| 44 | * time jitter detect and correct, | 46 | * time jitter detect and correct, |
| @@ -125,7 +127,9 @@ public: | @@ -125,7 +127,9 @@ public: | ||
| 125 | */ | 127 | */ |
| 126 | static SrsSource* find(std::string stream_url); | 128 | static SrsSource* find(std::string stream_url); |
| 127 | private: | 129 | private: |
| 130 | +#ifdef SRS_HLS | ||
| 128 | SrsHls* hls; | 131 | SrsHls* hls; |
| 132 | +#endif | ||
| 129 | std::string stream_url; | 133 | std::string stream_url; |
| 130 | std::vector<SrsConsumer*> consumers; | 134 | std::vector<SrsConsumer*> consumers; |
| 131 | // gop cache for client fast startup. | 135 | // gop cache for client fast startup. |
trunk/src/srs/srs.upp
100644 → 100755
| 1 | file | 1 | file |
| 2 | main readonly separator, | 2 | main readonly separator, |
| 3 | ..\main\srs_main_server.cpp, | 3 | ..\main\srs_main_server.cpp, |
| 4 | + auto readonly separator, | ||
| 5 | + ..\..\objs\srs_auto_headers.hpp, | ||
| 4 | core readonly separator, | 6 | core readonly separator, |
| 5 | ..\core\srs_core.hpp, | 7 | ..\core\srs_core.hpp, |
| 6 | ..\core\srs_core.cpp, | 8 | ..\core\srs_core.cpp, |
-
请 注册 或 登录 后发表评论