1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1500, support push stream by GB28181. 4.0.18

This commit is contained in:
winlin 2020-03-31 23:06:07 +08:00
parent d81cde695d
commit 608f3d0fae
11 changed files with 59 additions and 12 deletions

View file

@ -79,6 +79,12 @@ else
srs_undefine_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GB28181 = YES ]; then
srs_define_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else

View file

@ -18,6 +18,7 @@ help=no
SRS_HDS=NO
SRS_SRT=NO
SRS_RTC=YES
SRS_GB28181=NO
SRS_NASM=YES
SRS_NGINX=NO
SRS_FFMPEG_TOOL=NO
@ -136,16 +137,18 @@ Features:
--with-utest Build the utest for SRS.
--with-srt Build the SRT support for SRS.
--with-rtc Build the WebRTC support for SRS.
--with-gb28181 Build the GB28181 support for SRS.
--without-ssl Disable rtmp complex handshake.
--without-hds Disable hds, the adobe http dynamic streaming.
--without-stream-caster Disable stream caster, only listen and serve RTMP/HTTP.
--without-stat Disable the data statistic feature.
--without-librtmp Disable srs-librtmp, library for client.
--without-research Do not build the research tools.
--without-utest Do not build the utest for SRS.
--without-srt Do not build the SRT support for SRS.
--without-rtc Do not build the WebRTC support for SRS.
--without-research Disable the research tools.
--without-utest Disable the utest for SRS.
--without-srt Disable the SRT support for SRS.
--without-rtc Disable the WebRTC support for SRS.
--without-gb28181 Disable the GB28181 support for SRS.
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
--static Whether add '-static' to link options.
@ -231,6 +234,7 @@ function parse_user_option() {
--with-utest) SRS_UTEST=YES ;;
--with-srt) SRS_SRT=YES ;;
--with-rtc) SRS_RTC=YES ;;
--with-gb28181) SRS_GB28181=YES ;;
--with-nasm) SRS_NASM=YES ;;
--with-gperf) SRS_GPERF=YES ;;
--with-gmc) SRS_GPERF_MC=YES ;;
@ -249,6 +253,7 @@ function parse_user_option() {
--without-utest) SRS_UTEST=NO ;;
--without-srt) SRS_SRT=NO ;;
--without-rtc) SRS_RTC=NO ;;
--without-gb28181) SRS_GB28181=NO ;;
--without-nasm) SRS_NASM=NO ;;
--without-gperf) SRS_GPERF=NO ;;
--without-gmc) SRS_GPERF_MC=NO ;;
@ -550,6 +555,7 @@ function regenerate_options() {
if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
if [ $SRS_SRT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-srt"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-srt"; fi
if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-rtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-rtc"; fi
if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gb28181"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gb28181"; fi
if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nasm"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nasm"; fi
if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi

5
trunk/configure vendored
View file

@ -277,10 +277,13 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"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_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers" "srs_app_hybrid" "srs_app_gb28181" "srs_app_gb28181_sip")
"srs_app_coworkers" "srs_app_hybrid")
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc" "srs_app_rtc_conn" "srs_app_dtls" "srs_app_audio_recode" "srs_app_sdp")
fi
if [[ $SRS_GB28181 == YES ]]; then
MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip")
fi
DEFINES=""
# add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do

View file

@ -1578,6 +1578,8 @@ srs_error_t SrsGoApiError::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage
return srs_api_response_code(w, r, 100);
}
#ifdef SRS_AUTO_GB28181
SrsGoApiGb28181::SrsGoApiGb28181()
{
}
@ -1703,8 +1705,10 @@ srs_error_t SrsGoApiGb28181::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
}
}
#endif
SrsHttpApi::SrsHttpApi(IConnectionManager* cm, srs_netfd_t fd, SrsHttpServeMux* m, string cip)
: SrsConnection(cm, fd, cip)
: SrsConnection(cm, fd, cip)
{
mux = m;
cors = new SrsHttpCorsMux();

View file

@ -233,6 +233,8 @@ public:
};
#ifdef SRS_AUTO_GB28181
class SrsGoApiGb28181 : public ISrsHttpHandler
{
public:
@ -242,6 +244,8 @@ public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
};
#endif
class SrsHttpApi : virtual public SrsConnection, virtual public ISrsReloadHandler
{
private:

View file

@ -349,6 +349,7 @@ SrsUdpCasterListener::~SrsUdpCasterListener()
srs_freep(caster);
}
#ifdef SRS_AUTO_GB28181
SrsGb28181Listener::SrsGb28181Listener(SrsServer* svr, SrsListenerType t, SrsConfDirective* c) : SrsUdpStreamListener(svr, t, NULL)
{
@ -369,6 +370,8 @@ SrsGb28181Listener::~SrsGb28181Listener()
srs_freep(caster);
}
#endif
SrsSignalManager* SrsSignalManager::instance = NULL;
SrsSignalManager::SrsSignalManager(SrsServer* s)
@ -692,8 +695,10 @@ void SrsServer::destroy()
srs_freep(signal_manager);
srs_freep(conn_manager);
#ifdef SRS_AUTO_GB28181
//free global gb28281 manager
srs_freep(_srs_gb28181);
#endif
}
void SrsServer::dispose()
@ -984,10 +989,11 @@ srs_error_t SrsServer::http_handle()
if ((err = http_api_mux->handle("/api/v1/clusters", new SrsGoApiClusters())) != srs_success) {
return srs_error_wrap(err, "handle raw");
}
#ifdef SRS_AUTO_GB28181
if ((err = http_api_mux->handle("/api/v1/gb28181", new SrsGoApiGb28181())) != srs_success) {
return srs_error_wrap(err, "handle raw");
}
#endif
// test the request info.
if ((err = http_api_mux->handle("/api/v1/tests/requests", new SrsGoApiRequests())) != srs_success) {
@ -1342,6 +1348,7 @@ srs_error_t SrsServer::listen_http_stream()
return err;
}
#ifdef SRS_AUTO_GB28181
srs_error_t SrsServer::listen_gb28281_sip(SrsConfDirective* stream_caster)
{
srs_error_t err = srs_success;
@ -1365,6 +1372,7 @@ srs_error_t SrsServer::listen_gb28281_sip(SrsConfDirective* stream_caster)
return err;
}
#endif
srs_error_t SrsServer::listen_stream_caster()
{
@ -1391,6 +1399,7 @@ srs_error_t SrsServer::listen_stream_caster()
} else if (srs_stream_caster_is_flv(caster)) {
listener = new SrsHttpFlvListener(this, SrsListenerFlv, stream_caster);
} else if (srs_stream_caster_is_gb28181(caster)) {
#ifdef SRS_AUTO_GB28181
//init global gb28281 manger
if (_srs_gb28181 == NULL){
_srs_gb28181 = new SrsGb28181Manger(stream_caster);
@ -1408,6 +1417,10 @@ srs_error_t SrsServer::listen_stream_caster()
//gb28281 stream listener
listener = new SrsGb28181Listener(this, SrsListenerGb28181RtpMux, stream_caster);
#else
srs_warn("gb28181 is disabled, please enable it by: ./configure --with-gb28181");
continue;
#endif
} else {
return srs_error_new(ERROR_STREAM_CASTER_ENGINE, "invalid caster %s", caster.c_str());
}

View file

@ -164,6 +164,8 @@ public:
virtual ~SrsUdpCasterListener();
};
#ifdef SRS_AUTO_GB28181
// A UDP gb28181 listener, for sip and rtp stream mux server.
class SrsGb28181Listener : public SrsUdpStreamListener
{
@ -172,6 +174,8 @@ public:
virtual ~SrsGb28181Listener();
};
#endif
// Convert signal to io,
// @see: st-1.9/docs/notes.html
class SrsSignalManager : public ISrsCoroutineHandler
@ -319,7 +323,9 @@ private:
virtual srs_error_t listen_http_api();
virtual srs_error_t listen_http_stream();
virtual srs_error_t listen_stream_caster();
#ifdef SRS_AUTO_GB28181
virtual srs_error_t listen_gb28281_sip(SrsConfDirective* c);
#endif
// Close the listeners for specified type,
// Remove the listen object from manager.
virtual void close_listeners(SrsListenerType type);

View file

@ -43,7 +43,7 @@
#define RTMP_SIG_SRS_CODE "Leo"
#define RTMP_SIG_SRS_URL "https://github.com/ossrs/srs"
#define RTMP_SIG_SRS_LICENSE "MIT"
#define RTMP_SIG_SRS_AUTHORS "Winlin,Wenjie,Runner365,John,B.P.Y"
#define RTMP_SIG_SRS_AUTHORS "Winlin,Wenjie,Runner365,John,B.P.Y,Lixin"
#define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR) "." SRS_XSTR(VERSION_MINOR) "." SRS_XSTR(VERSION_REVISION)
#define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY "/" RTMP_SIG_SRS_VERSION "(" RTMP_SIG_SRS_CODE ")"

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP
#define SRS_VERSION4_REVISION 17
#define SRS_VERSION4_REVISION 18
#endif