Skip to content

Commit

Permalink
For #820, extract service module.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 26, 2017
1 parent 0a57a46 commit ff822b5
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 213 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,17 +858,17 @@ SRS always use the most simple architecture to support complex transaction.

```
+------------------------------------------------------+
| Main(srs/ingest-hls/librtmp) |
| SRS server | Programs in Main or Research |
+------------------------------------------------------+
| Modules(1)(User defined modularity) |
| App(For SRS) | Modules(1) | research/librtmp |
+------------------------------------------------------+
| App(Server/Client application) |
| Service(C/S apps over ST) | Libs(Export librtmp) |
+------------------------------------------------------+
| RTMP/HTTP/RTSP/RawStream(Protocol stack) |
| Protocol Stack(RTMP/HTTP/RTSP/JSON/AMF/Format) |
+------------------------------------------------------+
| Kernel(depends on Core, provides error/log) |
| Kernel(File, Codec, Stream, LB services) |
+------------------------------------------------------+
| Core(depends only on system apis) |
| Core(Macros and very low-level APIs) |
+------------------------------------------------------+
```

Expand Down
32 changes: 20 additions & 12 deletions trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,32 @@ MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_rtmp_stack"
PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
PROTOCOL_OBJS="${MODULE_OBJS[@]}"
#
#App Module
#Service Module, for both Server and Client Modules.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="SERVICE"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
ModuleLibIncs=(${LibSTRoot} ${LibSSLRoot} ${SRS_OBJS_DIR})
MODULE_FILES=("srs_service_log" "srs_service_st")
DEFINES=""
SERVICE_INCS="src/service"; MODULE_DIR=${SERVICE_INCS} . auto/modules.sh
SERVICE_OBJS="${MODULE_OBJS[@]}"
fi
#
#App Module, for SRS server only.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${LibSSLRoot} ${SRS_OBJS_DIR})
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
"srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
"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_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge"
"srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_edge"
"srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static"
"srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
"srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
"srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec" "srs_app_kafka"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment")
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr")
DEFINES=""
# add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do
Expand All @@ -210,7 +221,7 @@ LIBS_OBJS="${MODULE_OBJS[@]}"
#Main Module
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
MODULE_FILES=("srs_main_server")
DEFINES=""
Expand All @@ -231,7 +242,7 @@ fi
# disable all app when export librtmp
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all main entrances
MAIN_ENTRANCES=("srs_main_server" "srs_main_ingest_hls")
MAIN_ENTRANCES=("srs_main_server")
# add each modules for main
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
Expand All @@ -241,14 +252,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all depends libraries
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
# all depends objects
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
#
# srs: srs(simple rtmp server) over st(state-threads)
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
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config
Expand All @@ -270,8 +278,8 @@ if [ $SRS_UTEST = YES ]; then
"srs_utest_reload")
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot})
ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]}"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP")
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]}"
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
fi

Expand Down
46 changes: 29 additions & 17 deletions trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
3C1232941AAE81D900CE8F6C /* srs_app_bandwidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C12324C1AAE81D900CE8F6C /* srs_app_bandwidth.cpp */; };
3C1232951AAE81D900CE8F6C /* srs_app_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C12324E1AAE81D900CE8F6C /* srs_app_config.cpp */; };
3C1232961AAE81D900CE8F6C /* srs_app_conn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1232501AAE81D900CE8F6C /* srs_app_conn.cpp */; };
3C1232971AAE81D900CE8F6C /* srs_app_dvr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1232521AAE81D900CE8F6C /* srs_app_dvr.cpp */; };
3C1232981AAE81D900CE8F6C /* srs_app_edge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1232541AAE81D900CE8F6C /* srs_app_edge.cpp */; };
3C1232991AAE81D900CE8F6C /* srs_app_empty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1232561AAE81D900CE8F6C /* srs_app_empty.cpp */; };
3C12329A1AAE81D900CE8F6C /* srs_app_encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1232581AAE81D900CE8F6C /* srs_app_encoder.cpp */; };
Expand Down Expand Up @@ -72,7 +71,6 @@
3C1232D31AAEA56B00CE8F6C /* libst.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232D21AAEA56B00CE8F6C /* libst.a */; };
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 */; };
3C24ECCD1C3B824800460622 /* memory.error.notcmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C24ECCB1C3B824800460622 /* memory.error.notcmalloc.cpp */; };
Expand Down Expand Up @@ -126,6 +124,9 @@
3CD247C31BB3F14100DC1922 /* srs_kernel_balance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CD247C11BB3F14000DC1922 /* srs_kernel_balance.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 */; };
3CE893B51E87508D000B742D /* srs_app_dvr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CE893B31E87508D000B742D /* srs_app_dvr.cpp */; };
3CE893B91E8750A9000B742D /* srs_service_log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CE893B71E8750A9000B742D /* srs_service_log.cpp */; };
3CE893BC1E875108000B742D /* srs_service_st.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CE893BA1E875108000B742D /* srs_service_st.cpp */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -208,8 +209,6 @@
3C12324F1AAE81D900CE8F6C /* srs_app_config.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_config.hpp; path = ../../../src/app/srs_app_config.hpp; sourceTree = "<group>"; };
3C1232501AAE81D900CE8F6C /* srs_app_conn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_conn.cpp; path = ../../../src/app/srs_app_conn.cpp; sourceTree = "<group>"; };
3C1232511AAE81D900CE8F6C /* srs_app_conn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_conn.hpp; path = ../../../src/app/srs_app_conn.hpp; sourceTree = "<group>"; };
3C1232521AAE81D900CE8F6C /* srs_app_dvr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_dvr.cpp; path = ../../../src/app/srs_app_dvr.cpp; sourceTree = "<group>"; };
3C1232531AAE81D900CE8F6C /* srs_app_dvr.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_dvr.hpp; path = ../../../src/app/srs_app_dvr.hpp; sourceTree = "<group>"; };
3C1232541AAE81D900CE8F6C /* srs_app_edge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_edge.cpp; path = ../../../src/app/srs_app_edge.cpp; sourceTree = "<group>"; };
3C1232551AAE81D900CE8F6C /* srs_app_edge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_edge.hpp; path = ../../../src/app/srs_app_edge.hpp; sourceTree = "<group>"; };
3C1232561AAE81D900CE8F6C /* srs_app_empty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_empty.cpp; path = ../../../src/app/srs_app_empty.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -426,14 +425,19 @@
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>"; };
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>"; };
3CE893B31E87508D000B742D /* srs_app_dvr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_dvr.cpp; path = ../../../src/app/srs_app_dvr.cpp; sourceTree = "<group>"; };
3CE893B41E87508D000B742D /* srs_app_dvr.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_dvr.hpp; path = ../../../src/app/srs_app_dvr.hpp; sourceTree = "<group>"; };
3CE893B71E8750A9000B742D /* srs_service_log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_service_log.cpp; path = ../../../src/service/srs_service_log.cpp; sourceTree = "<group>"; };
3CE893B81E8750A9000B742D /* srs_service_log.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_service_log.hpp; path = ../../../src/service/srs_service_log.hpp; sourceTree = "<group>"; };
3CE893BA1E875108000B742D /* srs_service_st.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_service_st.cpp; path = ../../../src/service/srs_service_st.cpp; sourceTree = "<group>"; };
3CE893BB1E875108000B742D /* srs_service_st.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_service_st.hpp; path = ../../../src/service/srs_service_st.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
3C1231E21AAE64A400CE8F6C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */,
3C1232E91AAEA5D000CE8F6C /* libcrypto.a in Frameworks */,
3C1232EA1AAEA5D000CE8F6C /* libssl.a in Frameworks */,
3C1232D31AAEA56B00CE8F6C /* libst.a in Frameworks */,
Expand Down Expand Up @@ -473,6 +477,7 @@
3C12322C1AAE819900CE8F6C /* protocol */,
3C12324B1AAE81CE00CE8F6C /* app */,
3C96ADC41B00A71000885304 /* modules */,
3CE893B61E875095000B742D /* service */,
3C1232041AAE80CB00CE8F6C /* main */,
3C36DB541ABD1CA70066CCAF /* libs */,
3C1231F91AAE670E00CE8F6C /* objs */,
Expand Down Expand Up @@ -604,8 +609,8 @@
3C1232511AAE81D900CE8F6C /* srs_app_conn.hpp */,
3C9F82201E4ECA8200F5B2D2 /* srs_app_dash.cpp */,
3C9F82211E4ECA8200F5B2D2 /* srs_app_dash.hpp */,
3C1232521AAE81D900CE8F6C /* srs_app_dvr.cpp */,
3C1232531AAE81D900CE8F6C /* srs_app_dvr.hpp */,
3CE893B31E87508D000B742D /* srs_app_dvr.cpp */,
3CE893B41E87508D000B742D /* srs_app_dvr.hpp */,
3C1232541AAE81D900CE8F6C /* srs_app_edge.cpp */,
3C1232551AAE81D900CE8F6C /* srs_app_edge.hpp */,
3C1232561AAE81D900CE8F6C /* srs_app_empty.cpp */,
Expand Down Expand Up @@ -911,6 +916,17 @@
name = utest;
sourceTree = "<group>";
};
3CE893B61E875095000B742D /* service */ = {
isa = PBXGroup;
children = (
3CE893B71E8750A9000B742D /* srs_service_log.cpp */,
3CE893B81E8750A9000B742D /* srs_service_log.hpp */,
3CE893BA1E875108000B742D /* srs_service_st.cpp */,
3CE893BB1E875108000B742D /* srs_service_st.hpp */,
);
name = service;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -978,11 +994,11 @@
3C26E3C61BB146FF00D0F9DB /* srs_app_kafka.cpp in Sources */,
3C663F131AB0155100286D8B /* srs_flv_injecter.c in Sources */,
3C24ECCD1C3B824800460622 /* memory.error.notcmalloc.cpp in Sources */,
3C1232971AAE81D900CE8F6C /* srs_app_dvr.cpp in Sources */,
3CD247C31BB3F14100DC1922 /* srs_kernel_balance.cpp in Sources */,
3C1232271AAE814D00CE8F6C /* srs_kernel_log.cpp in Sources */,
3C1232A81AAE81D900CE8F6C /* srs_app_log.cpp in Sources */,
3C1232A41AAE81D900CE8F6C /* srs_app_ingest.cpp in Sources */,
3CE893B51E87508D000B742D /* srs_app_dvr.cpp in Sources */,
3C0D422E1B87165900C2508B /* srs_protocol_json.cpp in Sources */,
3C1232B41AAE81D900CE8F6C /* srs_app_st.cpp in Sources */,
3C9F82221E4ECA8200F5B2D2 /* srs_app_dash.cpp in Sources */,
Expand Down Expand Up @@ -1044,6 +1060,7 @@
3C1232B21AAE81D900CE8F6C /* srs_app_source.cpp in Sources */,
3C1231F71AAE652D00CE8F6C /* srs_core_performance.cpp in Sources */,
3C4D184C1E73F133008806F7 /* srs_app_fragment.cpp in Sources */,
3CE893BC1E875108000B742D /* srs_service_st.cpp in Sources */,
3CC52DD81ACE4023006FEB01 /* srs_utest_amf0.cpp in Sources */,
3C4F97121B8B466D00FF0E46 /* srs_app_process.cpp in Sources */,
3C1232981AAE81D900CE8F6C /* srs_app_edge.cpp in Sources */,
Expand All @@ -1067,6 +1084,7 @@
3C663F181AB0155100286D8B /* srs_play.c in Sources */,
3C1232B61AAE81D900CE8F6C /* srs_app_thread.cpp in Sources */,
3C1232A91AAE81D900CE8F6C /* srs_app_mpegts_udp.cpp in Sources */,
3CE893B91E8750A9000B742D /* srs_service_log.cpp in Sources */,
3C1232AE1AAE81D900CE8F6C /* srs_app_rtmp_conn.cpp in Sources */,
3C1232B51AAE81D900CE8F6C /* srs_app_statistic.cpp in Sources */,
3C663F161AB0155100286D8B /* srs_ingest_flv.c in Sources */,
Expand Down Expand Up @@ -1169,12 +1187,9 @@
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
CLANG_CXX_LIBRARY = "libstdc++";
LIBRARY_SEARCH_PATHS = (
"../../objs/**",
"/Users/winlin/Desktop/git/ossrs/trunk/objs/http-parser-2.1",
);
LIBRARY_SEARCH_PATHS = "../../objs/**";
PRODUCT_NAME = "$(TARGET_NAME)";
"USER_HEADER_SEARCH_PATHS[arch=*]" = "../../src/** ../../objs ../../objs/st ../../objs/hp ../../objs/openssl";
"USER_HEADER_SEARCH_PATHS[arch=*]" = "../../src/** ../../objs ../../objs/st ../../objs/openssl";
};
name = Debug;
};
Expand All @@ -1184,10 +1199,7 @@
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
CLANG_CXX_LIBRARY = "libstdc++";
LIBRARY_SEARCH_PATHS = (
"../../objs/**",
"/Users/winlin/Desktop/git/ossrs/trunk/objs/http-parser-2.1",
);
LIBRARY_SEARCH_PATHS = "../../objs/**";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
Loading

0 comments on commit ff822b5

Please sign in to comment.