diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index e312cff9b..a1147b212 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -289,21 +289,21 @@ if [ $SRS_HTTP_PARSER = YES ]; then fi if [ $SRS_HTTP_PARSER = YES ]; then - echo "#define SRS_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_HTTP_SERVER = YES ]; then - echo "#define SRS_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_HTTP_API = YES ]; then - echo "#define SRS_HTTP_API" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_HTTP_API" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### @@ -373,15 +373,21 @@ ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/f echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html if [ $SRS_NGINX = YES ]; then - echo "#define SRS_NGINX" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_NGINX" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H +fi + +if [ $SRS_DVR = YES ]; then + echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H +else + echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_HLS = YES ]; then - echo "#define SRS_HLS" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_HLS" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### @@ -405,9 +411,9 @@ if [ $SRS_HTTP_CALLBACK = YES ]; then fi if [ $SRS_HTTP_CALLBACK = YES ]; then - echo "#define SRS_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H fi echo "link players to cherrypy static-dir" @@ -489,9 +495,9 @@ if [ $SRS_SSL = YES ]; then fi if [ $SRS_SSL = YES ]; then - echo "#define SRS_SSL" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### @@ -520,21 +526,21 @@ __SRS_FFMPEG_STUB=NO if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG_STUB=YES; fi if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG_STUB=YES; fi if [ $__SRS_FFMPEG_STUB = YES ]; then - echo "#define SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_TRANSCODE = YES ]; then - echo "#define SRS_RTMP_TRANSCODE" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_RTMP_TRANSCODE" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_INGEST = YES ]; then - echo "#define SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### @@ -591,38 +597,38 @@ if [ $SRS_GPERF = YES ]; then fi if [ $SRS_GPERF = YES ]; then - echo "#define SRS_GPERF" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_GPERF" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_GPERF_MC = YES ]; then - echo "#define SRS_GPERF_MC" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_GPERF_MC" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_GPERF_MP = YES ]; then - echo "#define SRS_GPERF_MP" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_GPERF_MP" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H fi if [ $SRS_GPERF_CP = YES ]; then - echo "#define SRS_GPERF_CP" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_GPERF_CP" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### # for arm. ##################################################################################### if [ $SRS_ARM_UBUNTU12 = YES ]; then - echo "#define SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H fi echo "" >> $SRS_AUTO_HEADERS_H # prefix -echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H @@ -634,7 +640,7 @@ if [ $OS_IS_CENTOS = YES ]; then else SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'` fi -echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H done diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 6936a018a..8a62f847e 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -14,6 +14,7 @@ help=no SRS_HLS=RESERVED +SRS_DVR=RESERVED SRS_NGINX=RESERVED SRS_SSL=RESERVED SRS_FFMPEG_TOOL=RESERVED @@ -74,6 +75,7 @@ do --with-ssl) SRS_SSL=YES ;; --with-hls) SRS_HLS=YES ;; + --with-dvr) SRS_DVR=YES ;; --with-nginx) SRS_NGINX=YES ;; --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; --with-transcode) SRS_TRANSCODE=YES ;; @@ -94,6 +96,7 @@ do --without-ssl) SRS_SSL=NO ;; --without-hls) SRS_HLS=NO ;; + --without-dvr) SRS_DVR=NO ;; --without-nginx) SRS_NGINX=NO ;; --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; --without-transcode) SRS_TRANSCODE=NO ;; @@ -142,6 +145,7 @@ if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMP # if arm specified, set some default to disabled. if [ $SRS_ARM_UBUNTU12 = YES ]; then if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi + if [ $SRS_DVR = RESERVED ]; then SRS_DVR=YES; fi SRS_NGINX=NO if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi SRS_FFMPEG_TOOL=NO @@ -167,6 +171,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_STATIC=YES else if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi + if [ $SRS_DVR = RESERVED ]; then SRS_DVR=YES; fi if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=NO; fi @@ -194,6 +199,7 @@ fi # if dev specified, open features if possible. if [ $SRS_DEV = YES ]; then SRS_HLS=YES + SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES SRS_FFMPEG_TOOL=YES @@ -220,6 +226,7 @@ fi # if raspberry-pi specified, open ssl/hls/static features if [ $SRS_PI = YES ]; then SRS_HLS=YES + SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES SRS_FFMPEG_TOOL=NO @@ -264,6 +271,7 @@ if [ $help = yes ]; then --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, mux RTMP to m3u8/ts files. + --with-dvr enable dvr, mux RTMP to flv files. --with-nginx enable delivery HTTP stream with nginx. build nginx at: ./objs/nginx/sbin/nginx --with-http-callback enable http hooks, build cherrypy as demo api server. @@ -288,6 +296,7 @@ if [ $help = yes ]; then --without-ssl disable rtmp complex handshake. --without-hls disable hls, rtmp streaming only. + --without-dvr disable dvr, donot support record RTMP stream to flv. --without-nginx disable delivery HTTP stream with nginx. --without-http-callback disable http, http hooks callback. --without-http-server disable http server, use external server to delivery http stream. @@ -360,6 +369,7 @@ fi # check variable neccessary if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi +if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi @@ -386,6 +396,7 @@ SRS_CONFIGURE="" if [ $SRS_DEV = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --dev"; fi if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi +if [ $SRS_DVR = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-dvr"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-dvr"; fi if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi diff --git a/trunk/configure b/trunk/configure index df1709d5b..8a8d09d70 100755 --- a/trunk/configure +++ b/trunk/configure @@ -35,10 +35,10 @@ echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H -echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H -echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H -echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H -echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H # new empty line to auto headers file. echo "" >> $SRS_AUTO_HEADERS_H @@ -54,7 +54,7 @@ if [[ -z $SrsArmAR ]]; then SrsArmAR="arm-linux-gnueabi-ar"; fi if [[ -z $SrsArmLD ]]; then SrsArmLD="arm-linux-gnueabi-ld"; fi if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; fi echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" -echo "#define SRS_ARM_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H +echo "#define SRS_AUTO_ARM_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H # apply user options. @@ -82,6 +82,7 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE) ##################################################################################### # colorful summary SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi +SrsDvrSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_DVR = YES ]; then SrsDvrSummaryColor="\${GREEN}"; fi SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi @@ -149,6 +150,8 @@ echo -e " \${BLACK}+-------------------------------------------------------- echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" +echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DVR\${BLACK}" +echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}" echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\${BLACK}" @@ -436,7 +439,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke "srs_app_http" "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" "srs_app_json" "srs_app_ingest" - "srs_app_ffmpeg" "srs_app_utility") + "srs_app_ffmpeg" "srs_app_utility" "srs_app_flv") APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh APP_OBJS="${MODULE_OBJS[@]}" # @@ -504,7 +507,7 @@ mkdir -p ${SRS_OBJS}/logs # summary echo "" echo "configure summary:" -echo " ${SRS_CONFIGURE}" +echo " ${SRS_AUTO_CONFIGURE}" if [ $SRS_HLS = YES ]; then echo -e "${GREEN}HLS is enabled${BLACK}" else @@ -515,6 +518,11 @@ if [ $SRS_NGINX = YES ]; then else echo -e "${GREEN}note: Nginx http server is disabled${BLACK}" fi +if [ $SRS_DVR = YES ]; then + echo -e "${GREEN}DVR is enabled${BLACK}" +else + echo -e "${YELLOW}warning: without DVR support${BLACK}" +fi if [ $SRS_SSL = YES ]; then echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}" else diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index b3c481a18..709279e77 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1206,7 +1206,7 @@ void SrsConfig::print_help(char** argv) printf( RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION" "RTMP_SIG_SRS_COPYRIGHT"\n" "Primary Authors: "RTMP_SIG_SRS_PRIMARY_AUTHROS"\n" - "Build: "SRS_BUILD_DATE" Configuration:"SRS_CONFIGURE"\n" + "Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_CONFIGURE"\n" "Usage: %s [-h?vV] [[-t] -c ]\n" "\n" "Options:\n" @@ -2132,13 +2132,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest) SrsConfDirective* conf = ingest->get("input"); if (!conf) { - return SRS_RTMP_INGEST_TYPE_FILE; + return SRS_AUTO_INGEST_TYPE_FILE; } conf = conf->get("type"); if (!conf) { - return SRS_RTMP_INGEST_TYPE_FILE; + return SRS_AUTO_INGEST_TYPE_FILE; } return conf->arg0(); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 03b220392..7a108c8ad 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -70,8 +70,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SRS_STAGE_INGESTER_INTERVAL_MS 2000 #define SRS_STAGE_HLS_INTERVAL_MS 2000 -#define SRS_RTMP_INGEST_TYPE_FILE "file" -#define SRS_RTMP_INGEST_TYPE_STREAM "stream" +#define SRS_AUTO_INGEST_TYPE_FILE "file" +#define SRS_AUTO_INGEST_TYPE_STREAM "stream" class SrsFileBuffer; diff --git a/trunk/src/app/srs_app_encoder.cpp b/trunk/src/app/srs_app_encoder.cpp index 587a3740c..f4848aacf 100644 --- a/trunk/src/app/srs_app_encoder.cpp +++ b/trunk/src/app/srs_app_encoder.cpp @@ -34,7 +34,7 @@ using namespace std; #include #include -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE // when error, encoder sleep for a while and retry. #define SRS_RTMP_ENCODER_SLEEP_US (int64_t)(3*1000*1000LL) diff --git a/trunk/src/app/srs_app_encoder.hpp b/trunk/src/app/srs_app_encoder.hpp index ba5bf0a16..c11114182 100644 --- a/trunk/src/app/srs_app_encoder.hpp +++ b/trunk/src/app/srs_app_encoder.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE #include #include diff --git a/trunk/src/app/srs_app_ffmpeg.cpp b/trunk/src/app/srs_app_ffmpeg.cpp index e03e360d4..c11b85228 100644 --- a/trunk/src/app/srs_app_ffmpeg.cpp +++ b/trunk/src/app/srs_app_ffmpeg.cpp @@ -39,7 +39,7 @@ using namespace std; #include #include -#ifdef SRS_FFMPEG_STUB +#ifdef SRS_AUTO_FFMPEG #define SRS_RTMP_ENCODER_COPY "copy" #define SRS_RTMP_ENCODER_NO_VIDEO "vn" diff --git a/trunk/src/app/srs_app_ffmpeg.hpp b/trunk/src/app/srs_app_ffmpeg.hpp index 55aa46310..8c6b64c72 100644 --- a/trunk/src/app/srs_app_ffmpeg.hpp +++ b/trunk/src/app/srs_app_ffmpeg.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_FFMPEG_STUB +#ifdef SRS_AUTO_FFMPEG #include #include diff --git a/trunk/src/app/srs_app_flv.cpp b/trunk/src/app/srs_app_flv.cpp new file mode 100644 index 000000000..b13e9c88d --- /dev/null +++ b/trunk/src/app/srs_app_flv.cpp @@ -0,0 +1,29 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#ifdef SRS_AUTO_DVR + +#endif + diff --git a/trunk/src/app/srs_app_flv.hpp b/trunk/src/app/srs_app_flv.hpp new file mode 100644 index 000000000..a545f540b --- /dev/null +++ b/trunk/src/app/srs_app_flv.hpp @@ -0,0 +1,36 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SRS_APP_FLV_HPP +#define SRS_APP_FLV_HPP + +/* +#include +*/ +#include + +#ifdef SRS_AUTO_DVR + +#endif + +#endif \ No newline at end of file diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 8e3b4481c..01437e2d8 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS #include #include @@ -45,14 +45,14 @@ using namespace std; #include // max PES packets size to flush the video. -#define SRS_HLS_AUDIO_CACHE_SIZE 1024 * 1024 +#define SRS_AUTO_HLS_AUDIO_CACHE_SIZE 1024 * 1024 // drop the segment when duration of ts too small. -#define SRS_HLS_SEGMENT_MIN_DURATION_MS 100 +#define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 // @see: NGX_RTMP_HLS_DELAY, // 63000: 700ms, ts_tbn=90000 -#define SRS_HLS_DELAY 63000 +#define SRS_AUTO_HLS_DELAY 63000 // the mpegts header specifed the video/audio pid. #define TS_VIDEO_PID 256 @@ -199,7 +199,7 @@ public: p[-1] |= 0x20; // Both Adaption and Payload *p++ = 7; // size *p++ = 0x50; // random access + PCR - p = write_pcr(p, frame->dts - SRS_HLS_DELAY); + p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); } // PES header @@ -255,11 +255,11 @@ public: *p++ = header_size; // pts; // 33bits - p = write_pts(p, flags >> 6, frame->pts + SRS_HLS_DELAY); + p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY); // dts; // 33bits if (frame->dts != frame->pts) { - p = write_pts(p, 1, frame->dts + SRS_HLS_DELAY); + p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY); } } @@ -684,7 +684,7 @@ int SrsHlsMuxer::segment_close(string log_desc) srs_assert(it == segments.end()); // valid, add to segments if segment duration is ok - if (current->duration * 1000 >= SRS_HLS_SEGMENT_MIN_DURATION_MS) { + if (current->duration * 1000 >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS) { segments.push_back(current); srs_trace("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64"", @@ -1026,7 +1026,7 @@ int SrsHlsCache::write_audio(SrsCodec* codec, SrsHlsMuxer* muxer, int64_t pts, S } // flush if buffer exceed max size. - if (ab->size > SRS_HLS_AUDIO_CACHE_SIZE) { + if (ab->size > SRS_AUTO_HLS_AUDIO_CACHE_SIZE) { if ((ret = muxer->flush_audio(af, ab)) != ERROR_SUCCESS) { return ret; } diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index dd42fcca5..577abdedc 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS #include #include diff --git a/trunk/src/app/srs_app_http.cpp b/trunk/src/app/srs_app_http.cpp index 638c70d25..234cba7ea 100644 --- a/trunk/src/app/srs_app_http.cpp +++ b/trunk/src/app/srs_app_http.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_PARSER +#ifdef SRS_AUTO_HTTP_PARSER #include diff --git a/trunk/src/app/srs_app_http.hpp b/trunk/src/app/srs_app_http.hpp index fdce5b179..70927193b 100644 --- a/trunk/src/app/srs_app_http.hpp +++ b/trunk/src/app/srs_app_http.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_HTTP_PARSER +#ifdef SRS_AUTO_HTTP_PARSER #include #include diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index b659e4984..f3f9467e1 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API #include using namespace std; @@ -193,7 +193,7 @@ int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req) << JFIELD_ORG("data", JOBJECT_START) << JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT << JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT - << JFIELD_STR("contributors", SRS_CONSTRIBUTORS) + << JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS) << JOBJECT_END << JOBJECT_END; diff --git a/trunk/src/app/srs_app_http_api.hpp b/trunk/src/app/srs_app_http_api.hpp index 62fee9f76..2b66aeb2b 100644 --- a/trunk/src/app/srs_app_http_api.hpp +++ b/trunk/src/app/srs_app_http_api.hpp @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API class SrsSocket; class SrsHttpMessage; diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index c5fbfe7f7..89c44162f 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER #include using namespace std; diff --git a/trunk/src/app/srs_app_http_conn.hpp b/trunk/src/app/srs_app_http_conn.hpp index 3e4fc69cd..c959f5cfe 100644 --- a/trunk/src/app/srs_app_http_conn.hpp +++ b/trunk/src/app/srs_app_http_conn.hpp @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER #include #include diff --git a/trunk/src/app/srs_app_http_hooks.cpp b/trunk/src/app/srs_app_http_hooks.cpp index 892126b19..01e82a835 100644 --- a/trunk/src/app/srs_app_http_hooks.cpp +++ b/trunk/src/app/srs_app_http_hooks.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK #include using namespace std; diff --git a/trunk/src/app/srs_app_http_hooks.hpp b/trunk/src/app/srs_app_http_hooks.hpp index d42e25ef7..26c10b6de 100644 --- a/trunk/src/app/srs_app_http_hooks.hpp +++ b/trunk/src/app/srs_app_http_hooks.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK #include diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index 0595161ec..91da1d869 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST using namespace std; @@ -35,7 +35,7 @@ using namespace std; // when error, ingester sleep for a while and retry. // ingest never sleep a long time, for we must start the stream ASAP. -#define SRS_RTMP_INGESTER_SLEEP_US (int64_t)(6*100*1000LL) +#define SRS_AUTO_INGESTER_SLEEP_US (int64_t)(6*100*1000LL) SrsIngesterFFMPEG::SrsIngesterFFMPEG(SrsFFMPEG* _ffmpeg, string _vhost, string _id) { @@ -53,7 +53,7 @@ SrsIngester::SrsIngester() { _srs_config->subscribe(this); - pthread = new SrsThread(this, SRS_RTMP_INGESTER_SLEEP_US); + pthread = new SrsThread(this, SRS_AUTO_INGESTER_SLEEP_US); pithy_print = new SrsPithyPrint(SRS_STAGE_INGESTER); } @@ -187,7 +187,7 @@ int SrsIngester::cycle() // pithy print ingester(); - pithy_print->elapse(SRS_RTMP_INGESTER_SLEEP_US / 1000); + pithy_print->elapse(SRS_AUTO_INGESTER_SLEEP_US / 1000); return ret; } @@ -282,7 +282,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S return ret; } - if (input_type == SRS_RTMP_INGEST_TYPE_FILE) { + if (input_type == SRS_AUTO_INGEST_TYPE_FILE) { std::string input_url = _srs_config->get_ingest_input_url(ingest); if (input_url.empty()) { ret = ERROR_ENCODER_NO_INPUT; @@ -296,7 +296,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { return ret; } - } else if (input_type == SRS_RTMP_INGEST_TYPE_STREAM) { + } else if (input_type == SRS_AUTO_INGEST_TYPE_STREAM) { std::string input_url = _srs_config->get_ingest_input_url(ingest); if (input_url.empty()) { ret = ERROR_ENCODER_NO_INPUT; diff --git a/trunk/src/app/srs_app_ingest.hpp b/trunk/src/app/srs_app_ingest.hpp index 53bb3f519..a56788455 100644 --- a/trunk/src/app/srs_app_ingest.hpp +++ b/trunk/src/app/srs_app_ingest.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST #include diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 3d960a621..fe75df413 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -68,7 +68,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd) skt = new SrsSocket(client_stfd); rtmp = new SrsRtmpServer(skt); refer = new SrsRefer(); -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK http_hooks = new SrsHttpHooks(); #endif bandwidth = new SrsBandwidth(); @@ -86,7 +86,7 @@ SrsRtmpConn::~SrsRtmpConn() srs_freep(rtmp); srs_freep(skt); srs_freep(refer); -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK srs_freep(http_hooks); #endif srs_freep(bandwidth); @@ -727,7 +727,7 @@ int SrsRtmpConn::on_connect() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // HTTP: on_connect SrsConfDirective* on_connect = _srs_config->get_vhost_on_connect(req->vhost); if (!on_connect) { @@ -749,7 +749,7 @@ int SrsRtmpConn::on_connect() void SrsRtmpConn::on_close() { -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // whatever the ret code, notify the api hooks. // HTTP: on_close SrsConfDirective* on_close = _srs_config->get_vhost_on_close(req->vhost); @@ -769,7 +769,7 @@ int SrsRtmpConn::on_publish() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // HTTP: on_publish SrsConfDirective* on_publish = _srs_config->get_vhost_on_publish(req->vhost); if (!on_publish) { @@ -791,7 +791,7 @@ int SrsRtmpConn::on_publish() void SrsRtmpConn::on_unpublish() { -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // whatever the ret code, notify the api hooks. // HTTP: on_unpublish SrsConfDirective* on_unpublish = _srs_config->get_vhost_on_unpublish(req->vhost); @@ -811,7 +811,7 @@ int SrsRtmpConn::on_play() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // HTTP: on_play SrsConfDirective* on_play = _srs_config->get_vhost_on_play(req->vhost); if (!on_play) { @@ -833,7 +833,7 @@ int SrsRtmpConn::on_play() void SrsRtmpConn::on_stop() { -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK // whatever the ret code, notify the api hooks. // HTTP: on_stop SrsConfDirective* on_stop = _srs_config->get_vhost_on_stop(req->vhost); diff --git a/trunk/src/app/srs_app_rtmp_conn.hpp b/trunk/src/app/srs_app_rtmp_conn.hpp index 8c4ba9293..ba3274503 100644 --- a/trunk/src/app/srs_app_rtmp_conn.hpp +++ b/trunk/src/app/srs_app_rtmp_conn.hpp @@ -42,7 +42,7 @@ class SrsRefer; class SrsConsumer; class SrsCommonMessage; class SrsSocket; -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK class SrsHttpHooks; #endif class SrsBandwidth; @@ -58,7 +58,7 @@ private: SrsSocket* skt; SrsRtmpServer* rtmp; SrsRefer* refer; -#ifdef SRS_HTTP_CALLBACK +#ifdef SRS_AUTO_HTTP_CALLBACK SrsHttpHooks* http_hooks; #endif SrsBandwidth* bandwidth; diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 76fbd99b6..a2b123e7c 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST #include #endif @@ -169,13 +169,13 @@ SrsServer::SrsServer() // donot new object in constructor, // for some global instance is not ready now, // new these objects in initialize instead. -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API http_api_handler = NULL; #endif -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER http_stream_handler = NULL; #endif -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST ingester = NULL; #endif } @@ -202,14 +202,14 @@ SrsServer::~SrsServer() pid_fd = -1; } -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API srs_freep(http_api_handler); #endif -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER srs_freep(http_stream_handler); #endif -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST srs_freep(ingester); #endif } @@ -224,26 +224,26 @@ int SrsServer::initialize() srs_assert(_srs_config); _srs_config->subscribe(this); -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API srs_assert(!http_api_handler); http_api_handler = SrsHttpHandler::create_http_api(); #endif -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER srs_assert(!http_stream_handler); http_stream_handler = SrsHttpHandler::create_http_stream(); #endif -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST srs_assert(!ingester); ingester = new SrsIngester(); #endif -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API if ((ret = http_api_handler->initialize()) != ERROR_SUCCESS) { return ret; } #endif -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER if ((ret = http_stream_handler->initialize()) != ERROR_SUCCESS) { return ret; } @@ -377,7 +377,7 @@ int SrsServer::ingest() { int ret = ERROR_SUCCESS; -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST if ((ret = ingester->start()) != ERROR_SUCCESS) { srs_error("start ingest streams failed. ret=%d", ret); return ret; @@ -401,7 +401,7 @@ int SrsServer::cycle() // if user interrupt the program, exit to check mem leak. // but, if gperf, use reload to ensure main return normally, // because directly exit will cause core-dump. -#ifdef SRS_GPERF_MC +#ifdef SRS_AUTO_GPERF_MC if (signal_gmc_stop) { break; } @@ -419,7 +419,7 @@ int SrsServer::cycle() } } -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST ingester->stop(); #endif @@ -449,7 +449,7 @@ void SrsServer::on_signal(int signo) } if (signo == SIGINT) { -#ifdef SRS_GPERF_MC +#ifdef SRS_AUTO_GPERF_MC srs_trace("gmc is on, main cycle will terminate normally."); signal_gmc_stop = true; #else @@ -494,7 +494,7 @@ int SrsServer::listen_http_api() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API close_listeners(SrsListenerHttpApi); if (_srs_config->get_http_api_enabled()) { SrsListener* listener = new SrsListener(this, SrsListenerHttpApi); @@ -515,7 +515,7 @@ int SrsServer::listen_http_stream() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER close_listeners(SrsListenerHttpStream); if (_srs_config->get_http_stream_enabled()) { SrsListener* listener = new SrsListener(this, SrsListenerHttpStream); @@ -568,7 +568,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) if (type == SrsListenerRtmpStream) { conn = new SrsRtmpConn(this, client_stfd); } else if (type == SrsListenerHttpApi) { -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API conn = new SrsHttpApi(this, client_stfd, http_api_handler); #else srs_warn("close http client for server not support http-api"); @@ -576,7 +576,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) return ret; #endif } else if (type == SrsListenerHttpStream) { -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER conn = new SrsHttpConn(this, client_stfd, http_stream_handler); #else srs_warn("close http client for server not support http-server"); @@ -622,7 +622,7 @@ int SrsServer::on_reload_vhost_added(std::string vhost) { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER if (!_srs_config->get_vhost_http_enabled(vhost)) { return ret; } @@ -639,7 +639,7 @@ int SrsServer::on_reload_vhost_removed(std::string vhost) { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { return ret; } @@ -652,7 +652,7 @@ int SrsServer::on_reload_vhost_http_updated() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER srs_freep(http_stream_handler); http_stream_handler = SrsHttpHandler::create_http_stream(); @@ -668,7 +668,7 @@ int SrsServer::on_reload_http_api_enabled() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API ret = listen_http_api(); #endif @@ -679,7 +679,7 @@ int SrsServer::on_reload_http_api_disabled() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API close_listeners(SrsListenerHttpApi); #endif @@ -690,7 +690,7 @@ int SrsServer::on_reload_http_stream_enabled() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER ret = listen_http_stream(); #endif @@ -701,7 +701,7 @@ int SrsServer::on_reload_http_stream_disabled() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER close_listeners(SrsListenerHttpStream); #endif @@ -712,7 +712,7 @@ int SrsServer::on_reload_http_stream_updated() { int ret = ERROR_SUCCESS; -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER if ((ret = on_reload_http_stream_enabled()) != ERROR_SUCCESS) { return ret; } diff --git a/trunk/src/app/srs_app_server.hpp b/trunk/src/app/srs_app_server.hpp index 9956076eb..d0fcdb279 100644 --- a/trunk/src/app/srs_app_server.hpp +++ b/trunk/src/app/srs_app_server.hpp @@ -79,13 +79,13 @@ class SrsServer : public ISrsReloadHandler { friend class SrsListener; private: -#ifdef SRS_HTTP_API +#ifdef SRS_AUTO_HTTP_API SrsHttpHandler* http_api_handler; #endif -#ifdef SRS_HTTP_SERVER +#ifdef SRS_AUTO_HTTP_SERVER SrsHttpHandler* http_stream_handler; #endif -#ifdef SRS_RTMP_INGEST +#ifdef SRS_AUTO_INGEST SrsIngester* ingester; #endif private: diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index f83aef7ae..7faca8971 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -428,10 +428,10 @@ SrsSource::SrsSource(SrsRequest* _req) { req = _req->copy(); -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS hls = new SrsHls(this); #endif -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE encoder = new SrsEncoder(); #endif @@ -474,10 +474,10 @@ SrsSource::~SrsSource() srs_freep(gop_cache); -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS srs_freep(hls); #endif -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE srs_freep(encoder); #endif @@ -585,7 +585,7 @@ int SrsSource::on_reload_vhost_hls(string vhost) return ret; } -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS hls->on_unpublish(); if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { srs_error("hls publish failed. ret=%d", ret); @@ -605,7 +605,7 @@ int SrsSource::on_reload_vhost_transcode(string vhost) return ret; } -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE encoder->on_unpublish(); if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { srs_error("start encoder failed. ret=%d", ret); @@ -643,7 +643,7 @@ int SrsSource::on_hls_start() { int ret = ERROR_SUCCESS; -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS // feed the hls the metadata/sequence header, // when reload to enable the hls. @@ -671,7 +671,7 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata { int ret = ERROR_SUCCESS; -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS if (metadata && (ret = hls->on_meta_data(metadata->metadata)) != ERROR_SUCCESS) { srs_error("hls process onMetaData message failed. ret=%d", ret); return ret; @@ -760,7 +760,7 @@ int SrsSource::on_audio(SrsCommonMessage* audio) } srs_verbose("initialize shared ptr audio success."); -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); @@ -837,7 +837,7 @@ int SrsSource::on_video(SrsCommonMessage* video) } srs_verbose("initialize shared ptr video success."); -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); @@ -919,14 +919,14 @@ int SrsSource::on_publish(SrsRequest* _req) return ret; } -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { srs_error("start encoder failed. ret=%d", ret); return ret; } #endif -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { srs_error("start hls failed. ret=%d", ret); return ret; @@ -941,12 +941,12 @@ void SrsSource::on_unpublish() // destroy all forwarders destroy_forwarders(); -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE encoder->on_unpublish(); #endif // TODO: HLS should continue previous sequence and stream. -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS hls->on_unpublish(); #endif diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index ba300f031..93732e777 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -43,10 +43,10 @@ class SrsOnMetaDataPacket; class SrsSharedPtrMessage; class SrsForwarder; class SrsRequest; -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS class SrsHls; #endif -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE class SrsEncoder; #endif @@ -220,11 +220,11 @@ private: // to delivery stream to clients. std::vector consumers; // hls handler. -#ifdef SRS_HLS +#ifdef SRS_AUTO_HLS SrsHls* hls; #endif // transcoding handler. -#ifdef SRS_RTMP_TRANSCODE +#ifdef SRS_AUTO_TRANSCODE SrsEncoder* encoder; #endif // gop cache for client fast startup. diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index 5de542537..0b1122f8b 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -181,7 +181,7 @@ int srs_simple_handshake(srs_rtmp_t rtmp) int srs_complex_handshake(srs_rtmp_t rtmp) { -#ifndef SRS_SSL +#ifndef SRS_AUTO_SSL return ERROR_RTMP_HS_SSL_REQUIRE; #endif @@ -378,7 +378,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int srs_ssl_enabled() { -#ifndef SRS_SSL +#ifndef SRS_AUTO_SSL return false; #endif return true; diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 23b7e5447..d2ea894e1 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -29,10 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#ifdef SRS_GPERF_MP +#ifdef SRS_AUTO_GPERF_MP #include #endif -#ifdef SRS_GPERF_CP +#ifdef SRS_AUTO_GPERF_CP #include #endif @@ -71,15 +71,15 @@ int main(int argc, char** argv) // TODO: support both little and big endian. srs_assert(srs_is_little_endian()); -#ifdef SRS_GPERF_MP +#ifdef SRS_AUTO_GPERF_MP HeapProfilerStart("gperf.srs.gmp"); #endif -#ifdef SRS_GPERF_CP +#ifdef SRS_AUTO_GPERF_CP ProfilerStart("gperf.srs.gcp"); #endif -#ifdef SRS_GPERF_MC - #ifdef SRS_GPERF_MP +#ifdef SRS_AUTO_GPERF_MC + #ifdef SRS_AUTO_GPERF_MP srs_error("option --with-gmc confict with --with-gmp, " "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" "Note that since the heap-checker uses the heap-profiling framework internally, " @@ -100,11 +100,11 @@ int main(int argc, char** argv) } srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION); - srs_trace("uname: "SRS_UNAME); - srs_trace("build: %s, %s", SRS_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian"); - srs_trace("configure: "SRS_CONFIGURE); -#ifdef SRS_ARM_UBUNTU12 - srs_trace("arm tool chain: "SRS_ARM_TOOL_CHAIN); + srs_trace("uname: "SRS_AUTO_UNAME); + srs_trace("build: %s, %s", SRS_AUTO_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian"); + srs_trace("configure: "SRS_AUTO_CONFIGURE); +#ifdef SRS_AUTO_ARM_UBUNTU12 + srs_trace("arm tool chain: "SRS_AUTO_ARM_TOOL_CHAIN); #endif if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { diff --git a/trunk/src/rtmp/srs_protocol_handshake.cpp b/trunk/src/rtmp/srs_protocol_handshake.cpp index 981304683..34cb088ad 100644 --- a/trunk/src/rtmp/srs_protocol_handshake.cpp +++ b/trunk/src/rtmp/srs_protocol_handshake.cpp @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#ifdef SRS_SSL +#ifdef SRS_AUTO_SSL using namespace srs; @@ -1070,7 +1070,7 @@ SrsComplexHandshake::~SrsComplexHandshake() { } -#ifndef SRS_SSL +#ifndef SRS_AUTO_SSL int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) { srs_trace("directly use simple handshake for ssl disabled."); @@ -1169,7 +1169,7 @@ int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrs } #endif -#ifndef SRS_SSL +#ifndef SRS_AUTO_SSL int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) { return ERROR_RTMP_TRY_SIMPLE_HS; diff --git a/trunk/src/rtmp/srs_protocol_handshake.hpp b/trunk/src/rtmp/srs_protocol_handshake.hpp index 05b29482f..156107c39 100644 --- a/trunk/src/rtmp/srs_protocol_handshake.hpp +++ b/trunk/src/rtmp/srs_protocol_handshake.hpp @@ -34,7 +34,7 @@ class ISrsProtocolReaderWriter; class SrsComplexHandshake; class SrsHandshakeBytes; -#ifdef SRS_SSL +#ifdef SRS_AUTO_SSL namespace srs { diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index d582fe6ed..3ed79d2e1 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -51,6 +51,8 @@ file ..\app\srs_app_encoder.cpp, ..\app\srs_app_ffmpeg.hpp, ..\app\srs_app_ffmpeg.cpp, + ..\app\srs_app_flv.hpp, + ..\app\srs_app_flv.cpp, ..\app\srs_app_forward.hpp, ..\app\srs_app_forward.cpp, ..\app\srs_app_hls.hpp,