mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
support ingest hls live stream to RTMP.
This commit is contained in:
parent
23b978c0bb
commit
2239e9f1fd
7 changed files with 1103 additions and 10 deletions
|
@ -562,6 +562,7 @@ Supported operating systems and hardware:
|
||||||
|
|
||||||
### SRS 2.0 history
|
### SRS 2.0 history
|
||||||
|
|
||||||
|
* v2.0, 2015-04-20, support ingest hls live stream to RTMP.
|
||||||
* v2.0, 2015-04-15, for [#383](https://github.com/winlinvip/simple-rtmp-server/issues/383), support mix_correct algorithm. 2.0.161.
|
* v2.0, 2015-04-15, for [#383](https://github.com/winlinvip/simple-rtmp-server/issues/383), support mix_correct algorithm. 2.0.161.
|
||||||
* v2.0, 2015-04-13, for [#381](https://github.com/winlinvip/simple-rtmp-server/issues/381), support reap hls/ts by gop or not. 2.0.160.
|
* v2.0, 2015-04-13, for [#381](https://github.com/winlinvip/simple-rtmp-server/issues/381), support reap hls/ts by gop or not. 2.0.160.
|
||||||
* v2.0, 2015-04-10, enhanced on_hls_notify, support HTTP GET when reap ts.
|
* v2.0, 2015-04-10, enhanced on_hls_notify, support HTTP GET when reap ts.
|
||||||
|
|
|
@ -57,8 +57,6 @@ echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/co
|
||||||
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
|
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
|
||||||
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
|
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
|
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
|
||||||
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
|
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
|
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
|
||||||
|
@ -71,6 +69,12 @@ echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/
|
||||||
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
|
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
|
||||||
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
|
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
|
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
|
||||||
|
echo -e " | ${SrsResearchSummaryColor} @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||||
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
|
echo -e " |\${GREEN}tools: important tool, others @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||||
|
echo -e " | \${GREEN}./objs/srs_ingest_hls -i http://ossrs.net/live/livestream.m3u8 -y rtmp://127.0.0.1/live/livestream\${BLACK}"
|
||||||
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${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/v2_CN_DeliveryHLS\${BLACK}"
|
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}"
|
||||||
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
|
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
|
||||||
|
|
21
trunk/configure
vendored
21
trunk/configure
vendored
|
@ -100,7 +100,7 @@ AR = ar
|
||||||
LINK = g++
|
LINK = g++
|
||||||
CXXFLAGS = ${CXXFLAGS}
|
CXXFLAGS = ${CXXFLAGS}
|
||||||
|
|
||||||
.PHONY: default srs librtmp
|
.PHONY: default srs srs_ingest_hls librtmp
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
MODULE_ID="MAIN"
|
MODULE_ID="MAIN"
|
||||||
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
||||||
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot})
|
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot})
|
||||||
MODULE_FILES=("srs_main_server")
|
MODULE_FILES=("srs_main_server" "srs_main_ingest_hls")
|
||||||
# add each modules for main
|
# add each modules for main
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -217,7 +217,7 @@ fi
|
||||||
# disable all app when export librtmp
|
# disable all app when export librtmp
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
# all main entrances
|
# all main entrances
|
||||||
MAIN_ENTRANCES=("srs_main_server")
|
MAIN_ENTRANCES=("srs_main_server" "srs_main_ingest_hls")
|
||||||
# add each modules for main
|
# add each modules for main
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -232,6 +232,9 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
#
|
#
|
||||||
# srs: srs(simple rtmp server) over st(state-threads)
|
# srs: srs(simple rtmp server) over st(state-threads)
|
||||||
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
|
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
|
||||||
|
#
|
||||||
|
# srs_ingest_hls: to ingest hls stream to srs.
|
||||||
|
BUILD_KEY="srs_ingest_hls" APP_MAIN="srs_main_ingest_hls" APP_NAME="srs_ingest_hls" . auto/apps.sh
|
||||||
# add each modules for application
|
# add each modules for application
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -272,7 +275,7 @@ mv ${SRS_WORKDIR}/${SRS_MAKEFILE} ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk
|
||||||
|
|
||||||
# generate phony header
|
# generate phony header
|
||||||
cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir $__mphonys
|
.PHONY: default _default install install-api help clean server srs_ingest_hls librtmp utest _prepare_dir $__mphonys
|
||||||
|
|
||||||
# install prefix.
|
# install prefix.
|
||||||
SRS_PREFIX=${SRS_PREFIX}
|
SRS_PREFIX=${SRS_PREFIX}
|
||||||
|
@ -300,14 +303,15 @@ fi
|
||||||
# the server, librtmp and utest
|
# the server, librtmp and utest
|
||||||
# where the bellow will check and disable some entry by only echo.
|
# where the bellow will check and disable some entry by only echo.
|
||||||
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
_default: server librtmp utest $__mdefaults
|
_default: server srs_ingest_hls librtmp utest $__mdefaults
|
||||||
@bash objs/_srs_build_summary.sh
|
@bash objs/_srs_build_summary.sh
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
|
@echo "Usage: make <help>|<clean>|<server>|<srs_ingest_hls>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
|
||||||
@echo " help display this help menu"
|
@echo " help display this help menu"
|
||||||
@echo " clean cleanup project"
|
@echo " clean cleanup project"
|
||||||
@echo " server build the srs(simple rtmp server) over st(state-threads)"
|
@echo " server build the srs(simple rtmp server) over st(state-threads)"
|
||||||
|
@echo " srs_ingest_hls build the hls ingest tool of srs."
|
||||||
@echo " librtmp build the client publish/play library, and samples"
|
@echo " librtmp build the client publish/play library, and samples"
|
||||||
@echo " utest build the utest for srs"
|
@echo " utest build the utest for srs"
|
||||||
@echo " install install srs to the prefix path"
|
@echo " install install srs to the prefix path"
|
||||||
|
@ -332,6 +336,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
|
||||||
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
server: _prepare_dir
|
server: _prepare_dir
|
||||||
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
|
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
|
||||||
|
srs_ingest_hls: _prepare_dir
|
||||||
|
@echo "donot build the srs_ingest_hls for srs-librtmp"
|
||||||
|
|
||||||
END
|
END
|
||||||
else
|
else
|
||||||
|
@ -339,6 +345,9 @@ else
|
||||||
server: _prepare_dir
|
server: _prepare_dir
|
||||||
@echo "build the srs(simple rtmp server) over st(state-threads)"
|
@echo "build the srs(simple rtmp server) over st(state-threads)"
|
||||||
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
|
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
|
||||||
|
srs_ingest_hls: _prepare_dir
|
||||||
|
@echo "build the srs_ingest_hls for srs"
|
||||||
|
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs_ingest_hls
|
||||||
|
|
||||||
END
|
END
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
file
|
file
|
||||||
main readonly separator,
|
main readonly separator,
|
||||||
../../src/main/srs_main_server.cpp,
|
../../src/main/srs_main_server.cpp,
|
||||||
|
../../src/main/srs_main_ingest_hls.cpp,
|
||||||
auto readonly separator,
|
auto readonly separator,
|
||||||
../../objs/srs_auto_headers.hpp,
|
../../objs/srs_auto_headers.hpp,
|
||||||
libs readonly separator,
|
libs readonly separator,
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
3CC52DDD1ACE4023006FEB01 /* srs_utest_reload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD41ACE4023006FEB01 /* srs_utest_reload.cpp */; };
|
3CC52DDD1ACE4023006FEB01 /* srs_utest_reload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD41ACE4023006FEB01 /* srs_utest_reload.cpp */; };
|
||||||
3CC52DDE1ACE4023006FEB01 /* srs_utest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD61ACE4023006FEB01 /* srs_utest.cpp */; };
|
3CC52DDE1ACE4023006FEB01 /* srs_utest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD61ACE4023006FEB01 /* srs_utest.cpp */; };
|
||||||
3CD88B3F1ACA9C58000359E0 /* srs_app_async_call.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */; };
|
3CD88B3F1ACA9C58000359E0 /* srs_app_async_call.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */; };
|
||||||
|
3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
@ -361,6 +362,7 @@
|
||||||
3CC52DD71ACE4023006FEB01 /* srs_utest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest.hpp; path = ../../src/utest/srs_utest.hpp; sourceTree = "<group>"; };
|
3CC52DD71ACE4023006FEB01 /* srs_utest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest.hpp; path = ../../src/utest/srs_utest.hpp; sourceTree = "<group>"; };
|
||||||
3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_async_call.cpp; path = ../../../src/app/srs_app_async_call.cpp; sourceTree = "<group>"; };
|
3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_async_call.cpp; path = ../../../src/app/srs_app_async_call.cpp; sourceTree = "<group>"; };
|
||||||
3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_async_call.hpp; path = ../../../src/app/srs_app_async_call.hpp; sourceTree = "<group>"; };
|
3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_async_call.hpp; path = ../../../src/app/srs_app_async_call.hpp; sourceTree = "<group>"; };
|
||||||
|
3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_main_ingest_hls.cpp; path = ../../../src/main/srs_main_ingest_hls.cpp; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -442,6 +444,7 @@
|
||||||
3C1232041AAE80CB00CE8F6C /* main */ = {
|
3C1232041AAE80CB00CE8F6C /* main */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */,
|
||||||
3C1232051AAE812C00CE8F6C /* srs_main_server.cpp */,
|
3C1232051AAE812C00CE8F6C /* srs_main_server.cpp */,
|
||||||
);
|
);
|
||||||
name = main;
|
name = main;
|
||||||
|
@ -904,6 +907,7 @@
|
||||||
3C1232A71AAE81D900CE8F6C /* srs_app_listener.cpp in Sources */,
|
3C1232A71AAE81D900CE8F6C /* srs_app_listener.cpp in Sources */,
|
||||||
3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */,
|
3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */,
|
||||||
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
|
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
|
||||||
|
3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */,
|
||||||
3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
|
3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
|
||||||
3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
|
3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
|
||||||
3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
|
3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
|
||||||
|
|
|
@ -274,7 +274,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co
|
||||||
|
|
||||||
// to calendar time
|
// to calendar time
|
||||||
struct tm* tm;
|
struct tm* tm;
|
||||||
if (_srs_config->get_utc_time()) {
|
if (_srs_config && _srs_config->get_utc_time()) {
|
||||||
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
1074
trunk/src/main/srs_main_ingest_hls.cpp
Normal file
1074
trunk/src/main/srs_main_ingest_hls.cpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue