diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index b7f6f2e71..ec4d03cc5 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -510,6 +510,12 @@ else echo "#undef SRS_FFMPEG" >> $SRS_AUTO_HEADERS_H fi +if [ $SRS_TRANSCODE = YES ]; then + echo "#define SRS_TRANSCODE" >> $SRS_AUTO_HEADERS_H +else + echo "#undef SRS_TRANSCODE" >> $SRS_AUTO_HEADERS_H +fi + ##################################################################################### # build research code ##################################################################################### diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index d0f2a3855..6b100d1bb 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -76,6 +76,7 @@ do --with-hls) SRS_HLS=YES ;; --with-nginx) SRS_NGINX=YES ;; --with-ffmpeg) SRS_FFMPEG=YES ;; + --with-transcode) SRS_TRANSCODE=YES ;; --with-http-callback) SRS_HTTP_CALLBACK=YES ;; --with-http-server) SRS_HTTP_SERVER=YES ;; --with-http-api) SRS_HTTP_API=YES ;; @@ -94,6 +95,7 @@ do --without-hls) SRS_HLS=NO ;; --without-nginx) SRS_NGINX=NO ;; --without-ffmpeg) SRS_FFMPEG=NO ;; + --without-transcode) SRS_TRANSCODE=NO ;; --without-http-callback) SRS_HTTP_CALLBACK=NO ;; --without-http-server) SRS_HTTP_SERVER=NO ;; --without-http-api) SRS_HTTP_API=NO ;; @@ -132,6 +134,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi + if [ $SRS_TRANSCODE = RESERVED ]; then SRS_TRANSCODE=NO; fi if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; fi @@ -154,6 +157,7 @@ else if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi + if [ $SRS_TRANSCODE = RESERVED ]; then SRS_TRANSCODE=NO; fi if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; fi @@ -178,6 +182,7 @@ if [ $SRS_DEV = YES ]; then SRS_NGINX=NO SRS_SSL=YES SRS_FFMPEG=YES + SRS_TRANSCODE=YES SRS_HTTP_CALLBACK=YES SRS_HTTP_SERVER=YES SRS_HTTP_API=YES @@ -201,6 +206,7 @@ if [ $SRS_PI = YES ]; then SRS_NGINX=NO SRS_SSL=YES if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi + if [ $SRS_TRANSCODE = RESERVED ]; then SRS_TRANSCODE=NO; fi SRS_HTTP_CALLBACK=NO SRS_HTTP_SERVER=YES SRS_HTTP_API=YES @@ -223,6 +229,9 @@ if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi +# if transcode specified, try ffmpeg if possible. +if [ $SRS_TRANSCODE = YES ]; then if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=YES; fi fi + # parse the jobs for make if [[ "" -eq SRS_JOBS ]]; then export SRS_JOBS="--jobs" @@ -249,8 +258,10 @@ if [ $help = yes ]; then --with-http-callback enable http hooks, build cherrypy as demo api server. --with-http-server enable http server to delivery http stream. --with-http-api enable http api, to manage SRS by http api. - --with-ffmpeg enable transcoding with ffmpeg. + --with-ffmpeg enable transcoding tool ffmpeg. build ffmpeg at: ./objs/ffmpeg/bin/ffmpeg + --with-transcode enable transcoding features. + user must specifies the transcode tools in conf. --with-librtmp enable srs-librtmp, library for client. --with-bwtc enable SRS bandwidth test client tool. --with-research build the research tools. @@ -268,7 +279,8 @@ if [ $help = yes ]; then --without-http-callback disable http, http hooks callback. --without-http-server disable http server, use external server to delivery http stream. --without-http-api disable http api, only use console to manage SRS process. - --without-ffmpeg disable the ffmpeg transcoding feature. + --without-ffmpeg disable the ffmpeg transcode tool feature. + --without-transcode disable the transcoding feature. --without-librtmp disable srs-librtmp, library for client. --without-bwtc disable SRS bandwidth test client tool. --without-research do not build the research tools. @@ -364,6 +376,7 @@ if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SR 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 = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi +if [ $SRS_TRANSCODE = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-transcode"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-transcode"; fi if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-http-callback"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-http-callback"; fi if [ $SRS_HTTP_SERVER = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-http-server"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-http-server"; fi if [ $SRS_HTTP_API = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-http-api"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-http-api"; fi diff --git a/trunk/configure b/trunk/configure index 3edb26b84..be24e858e 100755 --- a/trunk/configure +++ b/trunk/configure @@ -82,9 +82,10 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE) ##################################################################################### # colorful summary SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi -SrsNginxSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${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 = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi +SrsTranscodeSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_TRANSCODE = YES ]; then SrsTranscodeSummaryColor="\${GREEN}"; fi SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi @@ -152,7 +153,9 @@ echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\$ echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\${BLACK}" echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\${BLACK}" echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\${BLACK}" -echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: support transcoding RTMP stream with FFMPEG\${BLACK}" +echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: transcode, mux, ingest tool\${BLACK}" +echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG\${BLACK}" +echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}" echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback\${BLACK}" echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}" echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPServer\${BLACK}" diff --git a/trunk/scripts/_step.build.sh b/trunk/scripts/_step.build.sh index 6a41958a6..6a06ce19e 100755 --- a/trunk/scripts/_step.build.sh +++ b/trunk/scripts/_step.build.sh @@ -3,7 +3,7 @@ src_dir='src' if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi echo "编译SRS" -./configure --with-ssl --with-hls --with-http-server --with-ffmpeg --with-http-callback && make +./configure --with-ssl --with-hls --with-http-server --with-ffmpeg --with-transcode --with-http-callback && make ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:编译SRS失败"; exit $ret; fi echo "编译SRS成功" diff --git a/trunk/src/app/srs_app_encoder.cpp b/trunk/src/app/srs_app_encoder.cpp index 9ba2f566c..6b77165b2 100644 --- a/trunk/src/app/srs_app_encoder.cpp +++ b/trunk/src/app/srs_app_encoder.cpp @@ -39,7 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE #define SRS_ENCODER_COPY "copy" #define SRS_ENCODER_NO_VIDEO "vn" diff --git a/trunk/src/app/srs_app_encoder.hpp b/trunk/src/app/srs_app_encoder.hpp index 0f1502dea..02090edba 100644 --- a/trunk/src/app/srs_app_encoder.hpp +++ b/trunk/src/app/srs_app_encoder.hpp @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#ifdef SRS_TRANSCODE + #include #include @@ -38,8 +40,6 @@ class SrsConfDirective; class SrsRequest; class SrsPithyPrint; -#ifdef SRS_FFMPEG - /** * a transcode engine: ffmepg, * used to transcode a stream to another. diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 7df605e4d..25db3734a 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -431,7 +431,7 @@ SrsSource::SrsSource(SrsRequest* _req) #ifdef SRS_HLS hls = new SrsHls(this); #endif -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE encoder = new SrsEncoder(); #endif @@ -477,7 +477,7 @@ SrsSource::~SrsSource() #ifdef SRS_HLS srs_freep(hls); #endif -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE srs_freep(encoder); #endif @@ -586,7 +586,7 @@ int SrsSource::on_reload_transcode(string vhost) return ret; } -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE encoder->on_unpublish(); if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { srs_error("start encoder failed. ret=%d", ret); @@ -900,7 +900,7 @@ int SrsSource::on_publish(SrsRequest* _req) return ret; } -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { srs_error("start encoder failed. ret=%d", ret); return ret; @@ -922,7 +922,7 @@ void SrsSource::on_unpublish() // destroy all forwarders destroy_forwarders(); -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE encoder->on_unpublish(); #endif diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 0e3bdb4a1..2f5490643 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -46,7 +46,7 @@ class SrsRequest; #ifdef SRS_HLS class SrsHls; #endif -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE class SrsEncoder; #endif @@ -224,7 +224,7 @@ private: SrsHls* hls; #endif // transcoding handler. -#ifdef SRS_FFMPEG +#ifdef SRS_TRANSCODE SrsEncoder* encoder; #endif // gop cache for client fast startup.