diff --git a/AUTHORS.txt b/AUTHORS.txt index 2cf59e8e2..93cf0f7c8 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -7,7 +7,7 @@ PRIMARY ordered by first contribution. * winlin "Plan, arch, implement SRS1.0 and SRS2.0" AUTHORS ordered by first contribution. -* wenjie.zhao<740936897@qq.com> "The bandwidth test module and bug fixed." +* wenjie.zhao<740936897@qq.com> "The bandwidth test module, HDS and bug fixed." CONTRIBUTORS ordered by first contribution. * xiangcheng.liu "Bug fixed" diff --git a/README.md b/README.md index 39341c337..aa36f169a 100755 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Enjoy it! SRS(SIMPLE RTMP Server) over state-threads created in 2013.10. -SRS delivers rtmp/hls/http live on x86/x64/arm/mips linux/osx, +SRS delivers rtmp/hls/http/hds live on x86/x64/arm/mips linux/osx, supports origin/edge/vhost and transcode/ingest and dvr/forward and http-api/http-callback/reload, introduces tracable session-oriented log, exports client srs-librtmp, @@ -56,6 +56,10 @@ HLS( [CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS), [EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_DeliveryHLS) ), +HDS( +[CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHDS), +[EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_DeliveryHDS) +), HTTP( [CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHttpStream), [EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHttpStream) @@ -509,6 +513,10 @@ Supported operating systems and hardware: [#301](https://github.com/winlinvip/simple-rtmp-server/issues/301). 1. Rewrite HLS(h.264+aac/mp3) streaming, read [#304](https://github.com/winlinvip/simple-rtmp-server/issues/304). +1. Support Adobe HDS(f4m)( +[CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHDS), +[EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_DeliveryHDS) +) dynamic streaming. 1. [experiment] Support push MPEG-TS over UDP to SRS, read [#250](https://github.com/winlinvip/simple-rtmp-server/issues/250). 1. [experiment] Support push RTSP to SRS, read @@ -550,6 +558,7 @@ Supported operating systems and hardware: ### SRS 2.0 history +* v2.0, 2015-03-12, fix [#328](https://github.com/winlinvip/simple-rtmp-server/issues/328), support adobe hds. 2.0.138. * v2.0, 2015-03-10, fix [#155](https://github.com/winlinvip/simple-rtmp-server/issues/155), support osx(darwin) for mac pro. 2.0.137. * v2.0, 2015-03-08, fix [#316](https://github.com/winlinvip/simple-rtmp-server/issues/316), http api provides stream/vhost/srs/server bytes, codec and count. 2.0.136. * v2.0, 2015-03-08, fix [#310](https://github.com/winlinvip/simple-rtmp-server/issues/310), refine aac LC, support aac HE/HEv2. 2.0.134. diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index c559c3dfb..928c35ca5 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -118,6 +118,12 @@ else echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H fi +if [ $SRS_HDS = YES ]; then + echo "#define SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H +else + echo "#undef SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H +fi + if [ $SRS_HTTP_CALLBACK = YES ]; then echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H else diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index d4e8b723d..d02dfe27f 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -16,6 +16,7 @@ help=no ################################################################ # feature options SRS_HLS=RESERVED +SRS_HDS=RESERVED SRS_DVR=RESERVED SRS_NGINX=RESERVED SRS_SSL=RESERVED @@ -112,6 +113,7 @@ Options: --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-hds enable hds streaming, mux RTMP to f4m/f4v 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 @@ -137,7 +139,8 @@ Options: --with-arm-ubuntu12 build SRS on ubuntu12 for armhf(v7cpu). --without-ssl disable rtmp complex handshake. - --without-hls disable hls, rtmp streaming only. + --without-hls disable hls, the apple http live streaming. + --without-hds disable hds, the adobe http dynamic streaming. --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. @@ -211,6 +214,7 @@ function parse_user_option() { --with-ssl) SRS_SSL=YES ;; --with-hls) SRS_HLS=YES ;; + --with-hds) SRS_HDS=YES ;; --with-dvr) SRS_DVR=YES ;; --with-nginx) SRS_NGINX=YES ;; --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; @@ -234,6 +238,7 @@ function parse_user_option() { --without-ssl) SRS_SSL=NO ;; --without-hls) SRS_HLS=NO ;; + --without-hds) SRS_HDS=NO ;; --without-dvr) SRS_DVR=NO ;; --without-nginx) SRS_NGINX=NO ;; --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; @@ -363,6 +368,7 @@ function apply_user_presets() { # all disabled. if [ $SRS_DISABLE_ALL = YES ]; then SRS_HLS=NO + SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO SRS_SSL=NO @@ -389,6 +395,7 @@ function apply_user_presets() { # all enabled. if [ $SRS_ENABLE_ALL = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=YES SRS_SSL=YES @@ -415,6 +422,7 @@ function apply_user_presets() { # only rtmp vp6 if [ $SRS_FAST = YES ]; then SRS_HLS=NO + SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO SRS_SSL=NO @@ -441,6 +449,7 @@ function apply_user_presets() { # all disabled. if [ $SRS_RTMP_HLS = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=NO SRS_NGINX=NO SRS_SSL=YES @@ -467,6 +476,7 @@ function apply_user_presets() { # only ssl for RTMP with complex handshake. if [ $SRS_PURE_RTMP = YES ]; then SRS_HLS=NO + SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO SRS_SSL=YES @@ -493,6 +503,7 @@ function apply_user_presets() { # if arm specified, set some default to disabled. if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -520,6 +531,7 @@ function apply_user_presets() { # if mips specified, set some default to disabled. if [ $SRS_MIPS_UBUNTU12 = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -546,6 +558,7 @@ function apply_user_presets() { # defaults for x86/x64 if [ $SRS_X86_X64 = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -572,6 +585,7 @@ function apply_user_presets() { # for osx(darwin) if [ $SRS_OSX = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -598,6 +612,7 @@ function apply_user_presets() { # if dev specified, open features if possible. if [ $SRS_DEV = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -624,6 +639,7 @@ function apply_user_presets() { # if fast dev specified, open main server features. if [ $SRS_FAST_DEV = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -650,6 +666,7 @@ function apply_user_presets() { # for srs demo if [ $SRS_DEMO = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -676,6 +693,7 @@ function apply_user_presets() { # if raspberry-pi specified, open ssl/hls/static features if [ $SRS_PI = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -702,6 +720,7 @@ function apply_user_presets() { # if cubieboard specified, open features except ffmpeg/nginx. if [ $SRS_CUBIE = YES ]; then SRS_HLS=YES + SRS_HDS=YES SRS_DVR=YES SRS_NGINX=NO SRS_SSL=YES @@ -763,6 +782,7 @@ function apply_user_detail_options() { # disable almost all features for export srs-librtmp. if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then SRS_HLS=NO + SRS_HDS=NO SRS_DVR=NO SRS_NGINX=NO SRS_SSL=NO @@ -792,8 +812,9 @@ function regenerate_options() { # save all config options to macro to write to auto headers file SRS_AUTO_USER_CONFIGURE="$opt" # regenerate the options for default values. - SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" +SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" if [ $SRS_HLS = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-hls"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-hls"; fi + if [ $SRS_HDS = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-hds"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-hds"; fi if [ $SRS_DVR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-dvr"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-dvr"; fi if [ $SRS_NGINX = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nginx"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nginx"; fi if [ $SRS_SSL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ssl"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ssl"; fi @@ -874,6 +895,7 @@ function check_option_conflicts() { # check variable neccessary if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_HDS = RESERVED ]; then echo "you must specifies the hds, 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 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index d95954c5f..7e5979e9f 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -554,6 +554,24 @@ vhost no-hls.srs.com { } } +# the vhost with adobe hds +vhost hds.srs.com { + hds { + # whether hds enabled + # default: off + enabled on; + # the hds fragment in seconds. + # default: 10 + hds_fragment 10; + # the hds window in seconds, erase the segment when exceed the window. + # default: 60 + hds_window 60; + # the path to store the hds files. + # default: ./objs/nginx/html + hds_path ./objs/nginx/html; + } +} + # the http hook callback vhost, srs will invoke the hooks for specified events. vhost hooks.callback.srs.com { http_hooks { diff --git a/trunk/configure b/trunk/configure index e94cc15d8..87e3e7f46 100755 --- a/trunk/configure +++ b/trunk/configure @@ -173,7 +173,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then "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_dvr" "srs_app_edge" "srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" - "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" + "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds" "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener") # add each modules for app for SRS_MODULE in $SRS_MODULES; do @@ -493,6 +493,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then else echo -e "${YELLOW}warning: without HLS support${BLACK}" fi + if [ $SRS_HDS = YES ]; then + echo -e "${GREEN}HDS is enabled${BLACK}" + else + echo -e "${YELLOW}warning: without HDS support${BLACK}" + fi if [ $SRS_NGINX = YES ]; then echo -e "${GREEN}Nginx http server is enabled${BLACK}" else diff --git a/trunk/doc/FlashMediaManifestFormatSpecificationErrataMay2014.pdf b/trunk/doc/FlashMediaManifestFormatSpecificationErrataMay2014.pdf new file mode 100644 index 000000000..9a56b4742 Binary files /dev/null and b/trunk/doc/FlashMediaManifestFormatSpecificationErrataMay2014.pdf differ diff --git a/trunk/doc/HTTPDynamicStreamingSpecificationErrataMay2014.pdf b/trunk/doc/HTTPDynamicStreamingSpecificationErrataMay2014.pdf new file mode 100644 index 000000000..70deaf48b Binary files /dev/null and b/trunk/doc/HTTPDynamicStreamingSpecificationErrataMay2014.pdf differ diff --git a/trunk/doc/adobe-hds-specification.pdf b/trunk/doc/adobe-hds-specification.pdf new file mode 100644 index 000000000..a3afdc2fb Binary files /dev/null and b/trunk/doc/adobe-hds-specification.pdf differ diff --git a/trunk/doc/adobe-media-manifest-specification.pdf b/trunk/doc/adobe-media-manifest-specification.pdf new file mode 100644 index 000000000..be2f6652c Binary files /dev/null and b/trunk/doc/adobe-media-manifest-specification.pdf differ diff --git a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj index 867df88b9..3d4c0fcd1 100644 --- a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj +++ b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj @@ -73,6 +73,8 @@ 3C1232E91AAEA5D000CE8F6C /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232E71AAEA5D000CE8F6C /* libcrypto.a */; }; 3C1232EA1AAEA5D000CE8F6C /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232E81AAEA5D000CE8F6C /* libssl.a */; }; 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; + 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; + 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; 3C663F0E1AB0155100286D8B /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F011AB0155100286D8B /* Makefile */; }; 3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; }; 3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; }; @@ -101,7 +103,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 3C1231E51AAE64A400CE8F6C /* srs_xcode */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; includeInIndex = 0; path = srs_xcode; sourceTree = BUILT_PRODUCTS_DIR; }; + 3C1231E51AAE64A400CE8F6C /* srs_xcode */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = srs_xcode; sourceTree = BUILT_PRODUCTS_DIR; }; 3C1231F01AAE652C00CE8F6C /* srs_core_autofree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_core_autofree.cpp; path = ../../../src/core/srs_core_autofree.cpp; sourceTree = ""; }; 3C1231F11AAE652C00CE8F6C /* srs_core_autofree.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_core_autofree.hpp; path = ../../../src/core/srs_core_autofree.hpp; sourceTree = ""; }; 3C1231F21AAE652C00CE8F6C /* srs_core_performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_core_performance.cpp; path = ../../../src/core/srs_core_performance.cpp; sourceTree = ""; }; @@ -237,7 +239,7 @@ 3C1232C21AAE827E00CE8F6C /* libs.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = libs.sh; path = ../../../auto/libs.sh; sourceTree = ""; }; 3C1232C31AAE827E00CE8F6C /* local_ip.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = local_ip.sh; path = ../../../auto/local_ip.sh; sourceTree = ""; }; 3C1232C41AAE827E00CE8F6C /* modules.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = modules.sh; path = ../../../auto/modules.sh; sourceTree = ""; }; - 3C1232C51AAE827E00CE8F6C /* options.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = options.sh; path = ../../../auto/options.sh; sourceTree = ""; }; + 3C1232C51AAE827E00CE8F6C /* options.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = options.sh; path = ../../../auto/options.sh; sourceTree = ""; wrapsLines = 0; }; 3C1232C61AAE827E00CE8F6C /* summary.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = summary.sh; path = ../../../auto/summary.sh; sourceTree = ""; }; 3C1232C71AAE827E00CE8F6C /* utest.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = utest.sh; path = ../../../auto/utest.sh; sourceTree = ""; }; 3C1232C81AAE833300CE8F6C /* _log.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = _log.sh; path = ../../../scripts/_log.sh; sourceTree = ""; }; @@ -258,6 +260,46 @@ 3C1232F21AAEAC7000CE8F6C /* srs-api */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-api"; path = "../../../etc/init.d/srs-api"; sourceTree = ""; }; 3C1232F31AAEAC7000CE8F6C /* srs-demo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-demo"; path = "../../../etc/init.d/srs-demo"; sourceTree = ""; }; 3C1232F41AAEAC7000CE8F6C /* srs-demo-19350 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-demo-19350"; path = "../../../etc/init.d/srs-demo-19350"; sourceTree = ""; }; + 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_hds.cpp; path = ../../../src/app/srs_app_hds.cpp; sourceTree = ""; }; + 3C1EE6AD1AB1055800576EE9 /* srs_app_hds.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_hds.hpp; path = ../../../src/app/srs_app_hds.hpp; sourceTree = ""; }; + 3C1EE6B01AB1080900576EE9 /* bandwidth.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = bandwidth.conf; path = ../../../conf/bandwidth.conf; sourceTree = ""; }; + 3C1EE6B11AB1080900576EE9 /* console.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = console.conf; path = ../../../conf/console.conf; sourceTree = ""; }; + 3C1EE6B21AB1080900576EE9 /* demo.19350.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = demo.19350.conf; path = ../../../conf/demo.19350.conf; sourceTree = ""; }; + 3C1EE6B31AB1080900576EE9 /* demo.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = demo.conf; path = ../../../conf/demo.conf; sourceTree = ""; }; + 3C1EE6B41AB1080900576EE9 /* dvr.path.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dvr.path.conf; path = ../../../conf/dvr.path.conf; sourceTree = ""; }; + 3C1EE6B51AB1080900576EE9 /* dvr.segment.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dvr.segment.conf; path = ../../../conf/dvr.segment.conf; sourceTree = ""; }; + 3C1EE6B61AB1080900576EE9 /* dvr.session.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dvr.session.conf; path = ../../../conf/dvr.session.conf; sourceTree = ""; }; + 3C1EE6B71AB1080900576EE9 /* edge.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = edge.conf; path = ../../../conf/edge.conf; sourceTree = ""; }; + 3C1EE6B81AB1080900576EE9 /* edge.token.traverse.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = edge.token.traverse.conf; path = ../../../conf/edge.token.traverse.conf; sourceTree = ""; }; + 3C1EE6B91AB1080900576EE9 /* ffmpeg.transcode.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ffmpeg.transcode.conf; path = ../../../conf/ffmpeg.transcode.conf; sourceTree = ""; }; + 3C1EE6BA1AB1080900576EE9 /* forward.master.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = forward.master.conf; path = ../../../conf/forward.master.conf; sourceTree = ""; }; + 3C1EE6BB1AB1080900576EE9 /* forward.slave.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = forward.slave.conf; path = ../../../conf/forward.slave.conf; sourceTree = ""; }; + 3C1EE6BC1AB1080900576EE9 /* full.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = full.conf; path = ../../../conf/full.conf; sourceTree = ""; }; + 3C1EE6BD1AB1080900576EE9 /* hds.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hds.conf; path = ../../../conf/hds.conf; sourceTree = ""; }; + 3C1EE6BE1AB1080900576EE9 /* hls.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = hls.conf; path = ../../../conf/hls.conf; sourceTree = ""; }; + 3C1EE6BF1AB1080900576EE9 /* http.aac.live.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.aac.live.conf; path = ../../../conf/http.aac.live.conf; sourceTree = ""; }; + 3C1EE6C01AB1080900576EE9 /* http.flv.live.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.flv.live.conf; path = ../../../conf/http.flv.live.conf; sourceTree = ""; }; + 3C1EE6C11AB1080900576EE9 /* http.heartbeat.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.heartbeat.conf; path = ../../../conf/http.heartbeat.conf; sourceTree = ""; }; + 3C1EE6C21AB1080900576EE9 /* http.hls.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.hls.conf; path = ../../../conf/http.hls.conf; sourceTree = ""; }; + 3C1EE6C31AB1080900576EE9 /* http.hooks.callback.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.hooks.callback.conf; path = ../../../conf/http.hooks.callback.conf; sourceTree = ""; }; + 3C1EE6C41AB1080900576EE9 /* http.mp3.live.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.mp3.live.conf; path = ../../../conf/http.mp3.live.conf; sourceTree = ""; }; + 3C1EE6C51AB1080900576EE9 /* http.server.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.server.conf; path = ../../../conf/http.server.conf; sourceTree = ""; }; + 3C1EE6C61AB1080900576EE9 /* http.ts.live.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.ts.live.conf; path = ../../../conf/http.ts.live.conf; sourceTree = ""; }; + 3C1EE6C71AB1080900576EE9 /* ingest.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ingest.conf; path = ../../../conf/ingest.conf; sourceTree = ""; }; + 3C1EE6C81AB1080900576EE9 /* mac.dev.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mac.dev.conf; path = ../../../conf/mac.dev.conf; sourceTree = ""; }; + 3C1EE6C91AB1080900576EE9 /* origin.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = origin.conf; path = ../../../conf/origin.conf; sourceTree = ""; }; + 3C1EE6CA1AB1080900576EE9 /* push.mpegts.over.udp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = push.mpegts.over.udp.conf; path = ../../../conf/push.mpegts.over.udp.conf; sourceTree = ""; }; + 3C1EE6CB1AB1080900576EE9 /* push.rtsp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = push.rtsp.conf; path = ../../../conf/push.rtsp.conf; sourceTree = ""; }; + 3C1EE6CC1AB1080900576EE9 /* ram.hls.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ram.hls.conf; path = ../../../conf/ram.hls.conf; sourceTree = ""; }; + 3C1EE6CD1AB1080900576EE9 /* realtime.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = realtime.conf; path = ../../../conf/realtime.conf; sourceTree = ""; }; + 3C1EE6CE1AB1080900576EE9 /* rtmp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rtmp.conf; path = ../../../conf/rtmp.conf; sourceTree = ""; }; + 3C1EE6CF1AB1080900576EE9 /* security.deny.publish.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = security.deny.publish.conf; path = ../../../conf/security.deny.publish.conf; sourceTree = ""; }; + 3C1EE6D01AB1080900576EE9 /* srs.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = srs.conf; path = ../../../conf/srs.conf; sourceTree = ""; }; + 3C1EE6D11AB1080900576EE9 /* transcode2hls.audio.only.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = transcode2hls.audio.only.conf; path = ../../../conf/transcode2hls.audio.only.conf; sourceTree = ""; }; + 3C1EE6D31AB1367D00576EE9 /* AUTHORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = AUTHORS.txt; path = ../../../AUTHORS.txt; sourceTree = ""; }; + 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = ""; }; + 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = ""; }; + 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../README.md; sourceTree = ""; wrapsLines = 0; }; 3C663F011AB0155100286D8B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../research/librtmp/Makefile; sourceTree = ""; }; 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_aac_raw_publish.c; path = ../../../research/librtmp/srs_aac_raw_publish.c; sourceTree = ""; }; 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_audio_raw_publish.c; path = ../../../research/librtmp/srs_audio_raw_publish.c; sourceTree = ""; }; @@ -291,6 +333,7 @@ 3C1231DC1AAE64A400CE8F6C = { isa = PBXGroup; children = ( + 3C1EE6D21AB1366500576EE9 /* doc */, 3C1231E61AAE64A400CE8F6C /* Products */, 3C1232EE1AAEA71C00CE8F6C /* links */, 3C1231E71AAE64A400CE8F6C /* srs_xcode */, @@ -310,6 +353,7 @@ isa = PBXGroup; children = ( 3C1232B81AAE824500CE8F6C /* configure */, + 3C1EE6AF1AB107EE00576EE9 /* conf */, 3C1232EF1AAEAC5800CE8F6C /* etc */, 3C1232BA1AAE826F00CE8F6C /* auto */, 3C1232B91AAE825100CE8F6C /* scripts */, @@ -433,6 +477,8 @@ 3C12325D1AAE81D900CE8F6C /* srs_app_forward.hpp */, 3C12325E1AAE81D900CE8F6C /* srs_app_heartbeat.cpp */, 3C12325F1AAE81D900CE8F6C /* srs_app_heartbeat.hpp */, + 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */, + 3C1EE6AD1AB1055800576EE9 /* srs_app_hds.hpp */, 3C1232601AAE81D900CE8F6C /* srs_app_hls.cpp */, 3C1232611AAE81D900CE8F6C /* srs_app_hls.hpp */, 3C1232621AAE81D900CE8F6C /* srs_app_http_api.cpp */, @@ -556,6 +602,58 @@ name = init.d; sourceTree = ""; }; + 3C1EE6AF1AB107EE00576EE9 /* conf */ = { + isa = PBXGroup; + children = ( + 3C1EE6B01AB1080900576EE9 /* bandwidth.conf */, + 3C1EE6B11AB1080900576EE9 /* console.conf */, + 3C1EE6B21AB1080900576EE9 /* demo.19350.conf */, + 3C1EE6B31AB1080900576EE9 /* demo.conf */, + 3C1EE6B41AB1080900576EE9 /* dvr.path.conf */, + 3C1EE6B51AB1080900576EE9 /* dvr.segment.conf */, + 3C1EE6B61AB1080900576EE9 /* dvr.session.conf */, + 3C1EE6B71AB1080900576EE9 /* edge.conf */, + 3C1EE6B81AB1080900576EE9 /* edge.token.traverse.conf */, + 3C1EE6B91AB1080900576EE9 /* ffmpeg.transcode.conf */, + 3C1EE6BA1AB1080900576EE9 /* forward.master.conf */, + 3C1EE6BB1AB1080900576EE9 /* forward.slave.conf */, + 3C1EE6BC1AB1080900576EE9 /* full.conf */, + 3C1EE6BD1AB1080900576EE9 /* hds.conf */, + 3C1EE6BE1AB1080900576EE9 /* hls.conf */, + 3C1EE6BF1AB1080900576EE9 /* http.aac.live.conf */, + 3C1EE6C01AB1080900576EE9 /* http.flv.live.conf */, + 3C1EE6C11AB1080900576EE9 /* http.heartbeat.conf */, + 3C1EE6C21AB1080900576EE9 /* http.hls.conf */, + 3C1EE6C31AB1080900576EE9 /* http.hooks.callback.conf */, + 3C1EE6C41AB1080900576EE9 /* http.mp3.live.conf */, + 3C1EE6C51AB1080900576EE9 /* http.server.conf */, + 3C1EE6C61AB1080900576EE9 /* http.ts.live.conf */, + 3C1EE6C71AB1080900576EE9 /* ingest.conf */, + 3C1EE6C81AB1080900576EE9 /* mac.dev.conf */, + 3C1EE6C91AB1080900576EE9 /* origin.conf */, + 3C1EE6CA1AB1080900576EE9 /* push.mpegts.over.udp.conf */, + 3C1EE6CB1AB1080900576EE9 /* push.rtsp.conf */, + 3C1EE6CC1AB1080900576EE9 /* ram.hls.conf */, + 3C1EE6CD1AB1080900576EE9 /* realtime.conf */, + 3C1EE6CE1AB1080900576EE9 /* rtmp.conf */, + 3C1EE6CF1AB1080900576EE9 /* security.deny.publish.conf */, + 3C1EE6D01AB1080900576EE9 /* srs.conf */, + 3C1EE6D11AB1080900576EE9 /* transcode2hls.audio.only.conf */, + ); + name = conf; + sourceTree = ""; + }; + 3C1EE6D21AB1366500576EE9 /* doc */ = { + isa = PBXGroup; + children = ( + 3C1EE6D31AB1367D00576EE9 /* AUTHORS.txt */, + 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */, + 3C1EE6D51AB1367D00576EE9 /* LICENSE */, + 3C1EE6D61AB1367D00576EE9 /* README.md */, + ); + name = doc; + sourceTree = ""; + }; 3C663F001AB014B500286D8B /* research */ = { isa = PBXGroup; children = ( @@ -651,6 +749,7 @@ 3C12324A1AAE81A400CE8F6C /* srs_rtsp_stack.cpp in Sources */, 3C1232A51AAE81D900CE8F6C /* srs_app_json.cpp in Sources */, 3C12329F1AAE81D900CE8F6C /* srs_app_http_api.cpp in Sources */, + 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */, 3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */, 3C663F111AB0155100286D8B /* srs_bandwidth_check.c in Sources */, 3C1232A11AAE81D900CE8F6C /* srs_app_http_conn.cpp in Sources */, @@ -663,6 +762,7 @@ 3C1232AB1AAE81D900CE8F6C /* srs_app_recv_thread.cpp in Sources */, 3C663F151AB0155100286D8B /* srs_h264_raw_publish.c in Sources */, 3C1231F61AAE652D00CE8F6C /* srs_core_autofree.cpp in Sources */, + 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */, 3C1232411AAE81A400CE8F6C /* srs_raw_avc.cpp in Sources */, 3C1232491AAE81A400CE8F6C /* srs_rtmp_utility.cpp in Sources */, 3C663F191AB0155100286D8B /* srs_publish.c in Sources */, diff --git a/trunk/src/app/srs_app_hds.cpp b/trunk/src/app/srs_app_hds.cpp index 18c67d2ad..c67f8b731 100644 --- a/trunk/src/app/srs_app_hds.cpp +++ b/trunk/src/app/srs_app_hds.cpp @@ -2,7 +2,6 @@ The MIT License (MIT) Copyright (c) 2013-2015 wenjiegit -Copyright (c) 2013-2015 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 @@ -21,12 +20,17 @@ 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_HDS + +#include #include #include #include #include #include +using namespace std; #include #include @@ -38,8 +42,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -using namespace std; - static void update_box(char *start, int size) { char *p_size = (char*)&size; @@ -276,6 +278,9 @@ SrsHds::~SrsHds() int SrsHds::on_publish(SrsRequest *req) { + // TODO: FIXME: check whether disabled. + // TODO: FIXME: support reload. + hds_req = req->copy(); return flush_mainfest(); @@ -462,7 +467,9 @@ int SrsHds::flush_bootstrap() char *start_afrt = NULL; int size_afrt = 0; - abst.initialize(start_abst, size); + if ((ret = abst.initialize(start_abst, size)) != ERROR_SUCCESS) { + return ret; + } // @see video_file_format_spec_v10_1 // page: 46 @@ -716,3 +723,5 @@ void SrsHds::adjust_windows() srs_freep(fragment); } } + +#endif diff --git a/trunk/src/app/srs_app_hds.hpp b/trunk/src/app/srs_app_hds.hpp index ef1b202d3..2de6912d7 100644 --- a/trunk/src/app/srs_app_hds.hpp +++ b/trunk/src/app/srs_app_hds.hpp @@ -2,7 +2,6 @@ The MIT License (MIT) Copyright (c) 2013-2015 wenjiegit -Copyright (c) 2013-2015 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 @@ -25,6 +24,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef SRS_APP_HDS_HPP #define SRS_APP_HDS_HPP +#include + +#ifdef SRS_AUTO_HDS + #include class SrsRequest; @@ -32,8 +35,6 @@ class SrsSharedPtrMessage; class SrsHdsFragment; class SrsSource; -using namespace std; - class SrsHds { public: @@ -52,7 +53,7 @@ private: void adjust_windows(); private: - list fragments; + std::list fragments; SrsHdsFragment *currentSegment; SrsSource *source; int fragment_index; @@ -62,4 +63,6 @@ private: SrsRequest *hds_req; }; -#endif // SRS_APP_HDS_HPP +#endif + +#endif diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 2030ee00d..4cdb1e6c1 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -782,8 +782,9 @@ SrsSource::SrsSource() #ifdef SRS_AUTO_TRANSCODE encoder = new SrsEncoder(); #endif - +#ifdef SRS_AUTO_HDS hds = new SrsHds(this); +#endif cache_metadata = cache_sh_video = cache_sh_audio = NULL; @@ -835,6 +836,9 @@ SrsSource::~SrsSource() #ifdef SRS_AUTO_TRANSCODE srs_freep(encoder); #endif +#ifdef SRS_AUTO_HDS + srs_freep(hds); +#endif srs_freep(_req); } @@ -1349,14 +1353,16 @@ int SrsSource::on_audio(SrsCommonMessage* __audio) } #endif +#ifdef SRS_AUTO_HDS if ((ret = hds->on_audio(&msg)) != ERROR_SUCCESS) { + srs_warn("hds process audio message failed, ignore and disable dvr. ret=%d", ret); + // unpublish, ignore ret. hds->on_unpublish(); // ignore. ret = ERROR_SUCCESS; - - srs_warn("hds process audio message failed, ignore and disable dvr. ret=%d", ret); } +#endif // copy to all consumer int nb_consumers = (int)consumers.size(); @@ -1498,14 +1504,16 @@ int SrsSource::on_video(SrsCommonMessage* __video) } #endif +#ifdef SRS_AUTO_HDS if ((ret = hds->on_video(&msg)) != ERROR_SUCCESS) { + srs_warn("hds process video message failed, ignore and disable dvr. ret=%d", ret); + // unpublish, ignore ret. hds->on_unpublish(); // ignore. ret = ERROR_SUCCESS; - - srs_warn("hds process video message failed, ignore and disable dvr. ret=%d", ret); } +#endif // copy to all consumer if (true) { @@ -1751,10 +1759,12 @@ int SrsSource::on_publish() } #endif +#ifdef SRS_AUTO_HDS if ((ret = hds->on_publish(_req)) != ERROR_SUCCESS) { srs_error("start hds failed. ret=%d", ret); return ret; } +#endif // notify the handler. srs_assert(handler); @@ -1783,7 +1793,9 @@ void SrsSource::on_unpublish() dvr->on_unpublish(); #endif +#ifdef SRS_AUTO_HDS hds->on_unpublish(); +#endif gop_cache->clear(); diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 86401b16b..148a8263d 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -62,7 +62,9 @@ class SrsEncoder; #endif class SrsStream; class ISrsHlsHandler; +#ifdef SRS_AUTO_HDS class SrsHds; +#endif /** * the time jitter algorithm: @@ -417,7 +419,9 @@ private: #ifdef SRS_AUTO_TRANSCODE SrsEncoder* encoder; #endif +#ifdef SRS_AUTO_HDS SrsHds *hds; +#endif // edge control service SrsPlayEdge* play_edge; SrsPublishEdge* publish_edge; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 1ee018e04..643d4936f 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 137 +#define VERSION_REVISION 138 // server info. #define RTMP_SIG_SRS_KEY "SRS" diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index bb6ded30d..339b10e59 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -72,6 +72,12 @@ void show_macro_features() srs_warn("check feature hls: off"); #endif +#ifdef SRS_AUTO_HDS + srs_trace("check feature hds: on"); +#else + srs_warn("check feature hds: off"); +#endif + #ifdef SRS_AUTO_HTTP_CALLBACK srs_trace("check feature http callback: on"); #else