Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-04-15 14:01:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
23a1b299354bf8b0fe3975138db2724497ccb15b
23a1b299
1 parent
1ae91786
add dvr option. refine macros of auto headers
隐藏空白字符变更
内嵌
并排对比
正在显示
34 个修改的文件
包含
242 行增加
和
150 行删除
trunk/auto/depends.sh
trunk/auto/options.sh
trunk/configure
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_encoder.cpp
trunk/src/app/srs_app_encoder.hpp
trunk/src/app/srs_app_ffmpeg.cpp
trunk/src/app/srs_app_ffmpeg.hpp
trunk/src/app/srs_app_flv.cpp
trunk/src/app/srs_app_flv.hpp
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_api.hpp
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.hpp
trunk/src/app/srs_app_http_hooks.cpp
trunk/src/app/srs_app_http_hooks.hpp
trunk/src/app/srs_app_ingest.cpp
trunk/src/app/srs_app_ingest.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_source.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/main/srs_main_server.cpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/rtmp/srs_protocol_handshake.hpp
trunk/src/srs/srs.upp
trunk/auto/depends.sh
查看文件 @
23a1b29
...
...
@@ -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_A
UTO_A
RM_UBUNTU12"
>>
$SRS_AUTO_HEADERS_H
else
echo
"#undef SRS_ARM_UBUNTU12"
>>
$SRS_AUTO_HEADERS_H
echo
"#undef SRS_A
UTO_A
RM_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
...
...
trunk/auto/options.sh
查看文件 @
23a1b29
...
...
@@ -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
...
...
trunk/configure
查看文件 @
23a1b29
...
...
@@ -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_A
UTO_A
RM_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
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
23a1b29
...
...
@@ -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 <filename>]
\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
();
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
23a1b29
...
...
@@ -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
;
...
...
trunk/src/app/srs_app_encoder.cpp
查看文件 @
23a1b29
...
...
@@ -34,7 +34,7 @@ using namespace std;
#include <srs_protocol_rtmp_stack.hpp>
#include <srs_app_ffmpeg.hpp>
#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)
...
...
trunk/src/app/srs_app_encoder.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_
RTMP
_TRANSCODE
#ifdef SRS_
AUTO
_TRANSCODE
#include <string>
#include <vector>
...
...
trunk/src/app/srs_app_ffmpeg.cpp
查看文件 @
23a1b29
...
...
@@ -39,7 +39,7 @@ using namespace std;
#include <srs_app_pithy_print.hpp>
#include <srs_protocol_rtmp_stack.hpp>
#ifdef SRS_
FFMPEG_STUB
#ifdef SRS_
AUTO_FFMPEG
#define SRS_RTMP_ENCODER_COPY "copy"
#define SRS_RTMP_ENCODER_NO_VIDEO "vn"
...
...
trunk/src/app/srs_app_ffmpeg.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_
FFMPEG_STUB
#ifdef SRS_
AUTO_FFMPEG
#include <string>
#include <vector>
...
...
trunk/src/app/srs_app_flv.cpp
0 → 100644
查看文件 @
23a1b29
/*
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 <srs_app_flv.hpp>
#ifdef SRS_AUTO_DVR
#endif
...
...
trunk/src/app/srs_app_flv.hpp
0 → 100644
查看文件 @
23a1b29
/*
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 <srs_app_flv.hpp>
*/
#include <srs_core.hpp>
#ifdef SRS_AUTO_DVR
#endif
#endif
\ No newline at end of file
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_hls.hpp>
#ifdef SRS_HLS
#ifdef SRS_
AUTO_
HLS
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -45,14 +45,14 @@ using namespace std;
#include <srs_app_pithy_print.hpp>
// 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
;
}
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_HLS
#ifdef SRS_
AUTO_
HLS
#include <string>
#include <vector>
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http.hpp>
#ifdef SRS_HTTP_PARSER
#ifdef SRS_
AUTO_
HTTP_PARSER
#include <stdlib.h>
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_HTTP_PARSER
#ifdef SRS_
AUTO_
HTTP_PARSER
#include <string>
#include <vector>
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_api.hpp>
#ifdef SRS_HTTP_API
#ifdef SRS_
AUTO_
HTTP_API
#include <sstream>
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
;
...
...
trunk/src/app/srs_app_http_api.hpp
查看文件 @
23a1b29
...
...
@@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#ifdef SRS_HTTP_API
#ifdef SRS_
AUTO_
HTTP_API
class
SrsSocket
;
class
SrsHttpMessage
;
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_conn.hpp>
#ifdef SRS_HTTP_SERVER
#ifdef SRS_
AUTO_
HTTP_SERVER
#include <sstream>
using
namespace
std
;
...
...
trunk/src/app/srs_app_http_conn.hpp
查看文件 @
23a1b29
...
...
@@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#ifdef SRS_HTTP_SERVER
#ifdef SRS_
AUTO_
HTTP_SERVER
#include <srs_app_st.hpp>
#include <srs_app_conn.hpp>
...
...
trunk/src/app/srs_app_http_hooks.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_hooks.hpp>
#ifdef SRS_HTTP_CALLBACK
#ifdef SRS_
AUTO_
HTTP_CALLBACK
#include <sstream>
using
namespace
std
;
...
...
trunk/src/app/srs_app_http_hooks.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_HTTP_CALLBACK
#ifdef SRS_
AUTO_
HTTP_CALLBACK
#include <http_parser.h>
...
...
trunk/src/app/srs_app_ingest.cpp
查看文件 @
23a1b29
...
...
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_ingest.hpp>
#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
;
...
...
trunk/src/app/srs_app_ingest.hpp
查看文件 @
23a1b29
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_
RTMP
_INGEST
#ifdef SRS_
AUTO
_INGEST
#include <vector>
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
23a1b29
...
...
@@ -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
);
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
23a1b29
...
...
@@ -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
;
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
23a1b29
...
...
@@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_api.hpp>
#include <srs_app_http_conn.hpp>
#include <srs_app_http.hpp>
#ifdef SRS_
RTMP
_INGEST
#ifdef SRS_
AUTO
_INGEST
#include <srs_app_ingest.hpp>
#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
;
}
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
23a1b29
...
...
@@ -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
:
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
23a1b29
...
...
@@ -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
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
23a1b29
...
...
@@ -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
<
SrsConsumer
*>
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.
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
23a1b29
...
...
@@ -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
;
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
23a1b29
...
...
@@ -29,10 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sys/types.h>
#include <sys/wait.h>
#ifdef SRS_GPERF_MP
#ifdef SRS_
AUTO_
GPERF_MP
#include <gperftools/heap-profiler.h>
#endif
#ifdef SRS_GPERF_CP
#ifdef SRS_
AUTO_
GPERF_CP
#include <gperftools/profiler.h>
#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
)
{
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
23a1b29
...
...
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_utility.hpp>
#include <srs_protocol_rtmp.hpp>
#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
;
...
...
trunk/src/rtmp/srs_protocol_handshake.hpp
查看文件 @
23a1b29
...
...
@@ -34,7 +34,7 @@ class ISrsProtocolReaderWriter;
class
SrsComplexHandshake
;
class
SrsHandshakeBytes
;
#ifdef SRS_SSL
#ifdef SRS_
AUTO_
SSL
namespace
srs
{
...
...
trunk/src/srs/srs.upp
查看文件 @
23a1b29
...
...
@@ -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,
...
...
请
注册
或
登录
后发表评论