正在显示
8 个修改的文件
包含
63 行增加
和
5 行删除
trunk/3rdparty/CherryPy-3.2.4.zip
0 → 100644
不能预览此文件类型
| @@ -7,6 +7,9 @@ nginx-1.5.7.zip | @@ -7,6 +7,9 @@ nginx-1.5.7.zip | ||
| 7 | st-1.9.zip | 7 | st-1.9.zip |
| 8 | basic framework for srs. | 8 | basic framework for srs. |
| 9 | 9 | ||
| 10 | +CherryPy-3.2.4.zip | ||
| 11 | + sample api server for srs. | ||
| 12 | + | ||
| 10 | ffmpeg-2.1.1.tar.gz | 13 | ffmpeg-2.1.1.tar.gz |
| 11 | yasm-1.2.0.tar.gz | 14 | yasm-1.2.0.tar.gz |
| 12 | lame-3.99.5.tar.gz | 15 | lame-3.99.5.tar.gz |
| @@ -38,4 +41,7 @@ links: | @@ -38,4 +41,7 @@ links: | ||
| 38 | yasm: | 41 | yasm: |
| 39 | http://yasm.tortall.net/ | 42 | http://yasm.tortall.net/ |
| 40 | http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz | 43 | http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz |
| 44 | + cherrypy: | ||
| 45 | + http://www.cherrypy.org/ | ||
| 46 | + https://pypi.python.org/pypi/CherryPy/3.2.4 | ||
| 41 | 47 |
trunk/auto/depends.sh
100644 → 100755
| @@ -79,6 +79,31 @@ else | @@ -79,6 +79,31 @@ else | ||
| 79 | fi | 79 | fi |
| 80 | 80 | ||
| 81 | ##################################################################################### | 81 | ##################################################################################### |
| 82 | +# cherrypy for http hooks callback, CherryPy-3.2.4 | ||
| 83 | +##################################################################################### | ||
| 84 | +if [ $SRS_HTTP = YES ]; then | ||
| 85 | + if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then | ||
| 86 | + echo "CherryPy-3.2.4 is ok."; | ||
| 87 | + else | ||
| 88 | + echo "install CherryPy-3.2.4"; | ||
| 89 | + ( | ||
| 90 | + sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} && | ||
| 91 | + unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 && | ||
| 92 | + sudo python setup.py install | ||
| 93 | + ) | ||
| 94 | + fi | ||
| 95 | + # check status | ||
| 96 | + ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi | ||
| 97 | + if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi | ||
| 98 | +fi | ||
| 99 | + | ||
| 100 | +if [ $SRS_HTTP = YES ]; then | ||
| 101 | + echo "#define SRS_HTTP" >> $SRS_AUTO_HEADERS_H | ||
| 102 | +else | ||
| 103 | + echo "#undef SRS_HTTP" >> $SRS_AUTO_HEADERS_H | ||
| 104 | +fi | ||
| 105 | + | ||
| 106 | +##################################################################################### | ||
| 82 | # openssl, for rtmp complex handshake | 107 | # openssl, for rtmp complex handshake |
| 83 | ##################################################################################### | 108 | ##################################################################################### |
| 84 | if [ $SRS_SSL = YES ]; then | 109 | if [ $SRS_SSL = YES ]; then |
trunk/auto/options.sh
100644 → 100755
| @@ -5,11 +5,13 @@ help=no | @@ -5,11 +5,13 @@ help=no | ||
| 5 | SRS_HLS=RESERVED | 5 | SRS_HLS=RESERVED |
| 6 | SRS_SSL=RESERVED | 6 | SRS_SSL=RESERVED |
| 7 | SRS_FFMPEG=RESERVED | 7 | SRS_FFMPEG=RESERVED |
| 8 | +SRS_HTTP=RESERVED | ||
| 8 | 9 | ||
| 9 | # TODO: remove the default to yes. | 10 | # TODO: remove the default to yes. |
| 10 | SRS_HLS=YES | 11 | SRS_HLS=YES |
| 11 | SRS_SSL=YES | 12 | SRS_SSL=YES |
| 12 | SRS_FFMPEG=YES | 13 | SRS_FFMPEG=YES |
| 14 | +SRS_HTTP=YES | ||
| 13 | 15 | ||
| 14 | opt= | 16 | opt= |
| 15 | 17 | ||
| @@ -28,10 +30,12 @@ do | @@ -28,10 +30,12 @@ do | ||
| 28 | --with-ssl) SRS_SSL=YES ;; | 30 | --with-ssl) SRS_SSL=YES ;; |
| 29 | --with-hls) SRS_HLS=YES ;; | 31 | --with-hls) SRS_HLS=YES ;; |
| 30 | --with-ffmpeg) SRS_FFMPEG=YES ;; | 32 | --with-ffmpeg) SRS_FFMPEG=YES ;; |
| 33 | + --with-http) SRS_HTTP=YES ;; | ||
| 31 | 34 | ||
| 32 | --without-ssl) SRS_SSL=NO ;; | 35 | --without-ssl) SRS_SSL=NO ;; |
| 33 | --without-hls) SRS_HLS=NO ;; | 36 | --without-hls) SRS_HLS=NO ;; |
| 34 | --without-ffmpeg) SRS_FFMPEG=NO ;; | 37 | --without-ffmpeg) SRS_FFMPEG=NO ;; |
| 38 | + --without-http) SRS_HTTP=NO ;; | ||
| 35 | 39 | ||
| 36 | *) | 40 | *) |
| 37 | echo "$0: error: invalid option \"$option\"" | 41 | echo "$0: error: invalid option \"$option\"" |
| @@ -50,10 +54,13 @@ cat << END | @@ -50,10 +54,13 @@ cat << END | ||
| 50 | 54 | ||
| 51 | --with-ssl enable rtmp complex handshake, requires openssl-devel installed. | 55 | --with-ssl enable rtmp complex handshake, requires openssl-devel installed. |
| 52 | to delivery h264 video and aac audio to flash player. | 56 | to delivery h264 video and aac audio to flash player. |
| 57 | + --with-http enable http hooks, build cherrypy as demo api server. | ||
| 58 | + srs will call the http hooks, such as: on_connect. | ||
| 53 | --with-hls enable hls streaming, build nginx as http server for hls. | 59 | --with-hls enable hls streaming, build nginx as http server for hls. |
| 54 | 60 | ||
| 55 | --without-ssl disable rtmp complex handshake. | 61 | --without-ssl disable rtmp complex handshake. |
| 56 | --without-hls disable hls, rtmp streaming only. | 62 | --without-hls disable hls, rtmp streaming only. |
| 63 | + --without-http disable http, http hooks callback. | ||
| 57 | 64 | ||
| 58 | END | 65 | END |
| 59 | 66 | ||
| @@ -73,6 +80,10 @@ if [ $SRS_FFMPEG = RESERVED ]; then | @@ -73,6 +80,10 @@ if [ $SRS_FFMPEG = RESERVED ]; then | ||
| 73 | echo "you must specifies the ffmpeg, see: ./configure --help"; | 80 | echo "you must specifies the ffmpeg, see: ./configure --help"; |
| 74 | __check_ok=NO | 81 | __check_ok=NO |
| 75 | fi | 82 | fi |
| 83 | +if [ $SRS_HTTP = RESERVED ]; then | ||
| 84 | + echo "you must specifies the http, see: ./configure --help"; | ||
| 85 | + __check_ok=NO | ||
| 86 | +fi | ||
| 76 | if [ $__check_ok = NO ]; then | 87 | if [ $__check_ok = NO ]; then |
| 77 | exit 1; | 88 | exit 1; |
| 78 | fi | 89 | fi |
| @@ -81,14 +81,14 @@ vhost __defaultVhost__ { | @@ -81,14 +81,14 @@ vhost __defaultVhost__ { | ||
| 81 | vhost dev { | 81 | vhost dev { |
| 82 | enabled on; | 82 | enabled on; |
| 83 | gop_cache on; | 83 | gop_cache on; |
| 84 | - hls on; | 84 | + hls off; |
| 85 | hls_path ./objs/nginx/html; | 85 | hls_path ./objs/nginx/html; |
| 86 | hls_fragment 5; | 86 | hls_fragment 5; |
| 87 | hls_window 30; | 87 | hls_window 30; |
| 88 | - forward 127.0.0.1:19350; | 88 | + #forward 127.0.0.1:19350; |
| 89 | #forward 127.0.0.1:1936; | 89 | #forward 127.0.0.1:1936; |
| 90 | transcode { | 90 | transcode { |
| 91 | - enabled on; | 91 | + enabled off; |
| 92 | ffmpeg ./objs/ffmpeg/bin/ffmpeg; | 92 | ffmpeg ./objs/ffmpeg/bin/ffmpeg; |
| 93 | engine dev { | 93 | engine dev { |
| 94 | enabled off; | 94 | enabled off; |
| @@ -15,6 +15,15 @@ BLACK="\\e[0m" | @@ -15,6 +15,15 @@ BLACK="\\e[0m" | ||
| 15 | # parse user options. | 15 | # parse user options. |
| 16 | . auto/options.sh | 16 | . auto/options.sh |
| 17 | 17 | ||
| 18 | +# if specifies http, requires sudo to install the CherryPy. | ||
| 19 | +if [ $SRS_HTTP = YES ]; then | ||
| 20 | + sudo echo "" >/dev/null 2>&1 | ||
| 21 | + ret=$?; if [[ 0 -ne $ret ]]; then echo | ||
| 22 | + "--with-http requires sudoer, ret=$ret"; | ||
| 23 | + exit $ret; | ||
| 24 | + fi | ||
| 25 | +fi | ||
| 26 | + | ||
| 18 | # clean the exists | 27 | # clean the exists |
| 19 | if [[ -f Makefile ]]; then | 28 | if [[ -f Makefile ]]; then |
| 20 | make clean | 29 | make clean |
| @@ -22,6 +31,8 @@ fi | @@ -22,6 +31,8 @@ fi | ||
| 22 | 31 | ||
| 23 | # generate the audo headers file. | 32 | # generate the audo headers file. |
| 24 | echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H | 33 | echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H |
| 34 | +echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H | ||
| 35 | +echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H | ||
| 25 | 36 | ||
| 26 | # apply user options. | 37 | # apply user options. |
| 27 | . auto/depends.sh | 38 | . auto/depends.sh |
| @@ -143,6 +154,11 @@ if [ $SRS_FFMPEG = YES ]; then | @@ -143,6 +154,11 @@ if [ $SRS_FFMPEG = YES ]; then | ||
| 143 | else | 154 | else |
| 144 | echo -e "${YELLOW}warning: without live stream transcoding over FFMPEG support${BLACK}" | 155 | echo -e "${YELLOW}warning: without live stream transcoding over FFMPEG support${BLACK}" |
| 145 | fi | 156 | fi |
| 157 | +if [ $SRS_HTTP = YES ]; then | ||
| 158 | + echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}" | ||
| 159 | +else | ||
| 160 | + echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}" | ||
| 161 | +fi | ||
| 146 | 162 | ||
| 147 | # mkdir dirs | 163 | # mkdir dirs |
| 148 | mkdir -p ${SRS_OBJS}/logs | 164 | mkdir -p ${SRS_OBJS}/logs |
trunk/src/core/srs_core.hpp
100644 → 100755
| @@ -66,7 +66,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -66,7 +66,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 66 | (void)0 | 66 | (void)0 |
| 67 | 67 | ||
| 68 | // current release version | 68 | // current release version |
| 69 | -#define RTMP_SIG_SRS_VERSION "0.5.0" | 69 | +#define RTMP_SIG_SRS_VERSION "0.8.0" |
| 70 | // server info. | 70 | // server info. |
| 71 | #define RTMP_SIG_SRS_KEY "srs" | 71 | #define RTMP_SIG_SRS_KEY "srs" |
| 72 | #define RTMP_SIG_SRS_ROLE "origin server" | 72 | #define RTMP_SIG_SRS_ROLE "origin server" |
trunk/src/core/srs_core_config.cpp
100644 → 100755
| @@ -1182,7 +1182,7 @@ void SrsConfig::print_help(char** argv) | @@ -1182,7 +1182,7 @@ void SrsConfig::print_help(char** argv) | ||
| 1182 | printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION | 1182 | printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION |
| 1183 | " Copyright (c) 2013 winlin\n" | 1183 | " Copyright (c) 2013 winlin\n" |
| 1184 | "Contributors: "RTMP_SIG_SRS_CONTRIBUTOR"\n" | 1184 | "Contributors: "RTMP_SIG_SRS_CONTRIBUTOR"\n" |
| 1185 | - "Configuration: "SRS_CONFIGURE"\n" | 1185 | + "Build: "SRS_BUILD_DATE" Configuration: "SRS_CONFIGURE"\n" |
| 1186 | "Usage: %s [-h?vV] [-c <filename>]\n" | 1186 | "Usage: %s [-h?vV] [-c <filename>]\n" |
| 1187 | "\n" | 1187 | "\n" |
| 1188 | "Options:\n" | 1188 | "Options:\n" |
-
请 注册 或 登录 后发表评论