From 73c310cd2ee45a30b2637a9ab25598c143dbafee Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 14 Apr 2014 09:10:36 +0800 Subject: [PATCH] refine the macro. --- trunk/auto/depends.sh | 4 ++-- trunk/src/app/srs_app_config.cpp | 4 ++-- trunk/src/app/srs_app_config.hpp | 4 ++-- trunk/src/app/srs_app_encoder.cpp | 6 +++--- trunk/src/app/srs_app_ffmpeg.cpp | 36 +++++++++++++++---------------- trunk/src/app/srs_app_ingest.cpp | 12 +++++------ trunk/src/app/srs_app_ingest.hpp | 2 +- trunk/src/app/srs_app_server.cpp | 16 +++++++------- trunk/src/app/srs_app_server.hpp | 2 +- 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 8b5fdbb86..4d7220586 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -528,9 +528,9 @@ else fi if [ $SRS_INGEST = YES ]; then - echo "#define SRS_INGEST" >> $SRS_AUTO_HEADERS_H + echo "#define SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H else - echo "#undef SRS_INGEST" >> $SRS_AUTO_HEADERS_H + echo "#undef SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H fi ##################################################################################### diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 040b3fc0f..852b76e93 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -2128,13 +2128,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest) SrsConfDirective* conf = ingest->get("input"); if (!conf) { - return SRS_INGEST_TYPE_FILE; + return SRS_RTMP_INGEST_TYPE_FILE; } conf = conf->get("type"); if (!conf) { - return SRS_INGEST_TYPE_FILE; + return SRS_RTMP_INGEST_TYPE_FILE; } return conf->arg0(); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index e6488aae6..03b220392 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -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_INGEST_TYPE_FILE "file" -#define SRS_INGEST_TYPE_STREAM "stream" +#define SRS_RTMP_INGEST_TYPE_FILE "file" +#define SRS_RTMP_INGEST_TYPE_STREAM "stream" class SrsFileBuffer; diff --git a/trunk/src/app/srs_app_encoder.cpp b/trunk/src/app/srs_app_encoder.cpp index 0962e75db..587a3740c 100644 --- a/trunk/src/app/srs_app_encoder.cpp +++ b/trunk/src/app/srs_app_encoder.cpp @@ -37,14 +37,14 @@ using namespace std; #ifdef SRS_RTMP_TRANSCODE // when error, encoder sleep for a while and retry. -#define SRS_ENCODER_SLEEP_US (int64_t)(3*1000*1000LL) +#define SRS_RTMP_ENCODER_SLEEP_US (int64_t)(3*1000*1000LL) // for encoder to detect the dead loop static std::vector _transcoded_url; SrsEncoder::SrsEncoder() { - pthread = new SrsThread(this, SRS_ENCODER_SLEEP_US); + pthread = new SrsThread(this, SRS_RTMP_ENCODER_SLEEP_US); pithy_print = new SrsPithyPrint(SRS_STAGE_ENCODER); } @@ -112,7 +112,7 @@ int SrsEncoder::cycle() // pithy print encoder(); - pithy_print->elapse(SRS_ENCODER_SLEEP_US / 1000); + pithy_print->elapse(SRS_RTMP_ENCODER_SLEEP_US / 1000); return ret; } diff --git a/trunk/src/app/srs_app_ffmpeg.cpp b/trunk/src/app/srs_app_ffmpeg.cpp index ce7d9a4df..e03e360d4 100644 --- a/trunk/src/app/srs_app_ffmpeg.cpp +++ b/trunk/src/app/srs_app_ffmpeg.cpp @@ -41,14 +41,14 @@ using namespace std; #ifdef SRS_FFMPEG_STUB -#define SRS_ENCODER_COPY "copy" -#define SRS_ENCODER_NO_VIDEO "vn" -#define SRS_ENCODER_NO_AUDIO "an" +#define SRS_RTMP_ENCODER_COPY "copy" +#define SRS_RTMP_ENCODER_NO_VIDEO "vn" +#define SRS_RTMP_ENCODER_NO_AUDIO "an" // only support libx264 encoder. -#define SRS_ENCODER_VCODEC "libx264" +#define SRS_RTMP_ENCODER_VCODEC "libx264" // any aac encoder is ok which contains the aac, // for example, libaacplus, aac, fdkaac -#define SRS_ENCODER_ACODEC "aac" +#define SRS_RTMP_ENCODER_ACODEC "aac" SrsFFMPEG::SrsFFMPEG(std::string ffmpeg_bin) { @@ -118,17 +118,17 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine) vwidth -= vwidth % 2; vheight -= vheight % 2; - if (vcodec == SRS_ENCODER_NO_VIDEO && acodec == SRS_ENCODER_NO_AUDIO) { + if (vcodec == SRS_RTMP_ENCODER_NO_VIDEO && acodec == SRS_RTMP_ENCODER_NO_AUDIO) { ret = ERROR_ENCODER_VCODEC; srs_warn("video and audio disabled. ret=%d", ret); return ret; } - if (vcodec != SRS_ENCODER_COPY && vcodec != SRS_ENCODER_NO_VIDEO) { - if (vcodec != SRS_ENCODER_VCODEC) { + if (vcodec != SRS_RTMP_ENCODER_COPY && vcodec != SRS_RTMP_ENCODER_NO_VIDEO) { + if (vcodec != SRS_RTMP_ENCODER_VCODEC) { ret = ERROR_ENCODER_VCODEC; srs_error("invalid vcodec, must be %s, actual %s, ret=%d", - SRS_ENCODER_VCODEC, vcodec.c_str(), ret); + SRS_RTMP_ENCODER_VCODEC, vcodec.c_str(), ret); return ret; } if (vbitrate <= 0) { @@ -168,11 +168,11 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine) } } - if (acodec != SRS_ENCODER_COPY && acodec != SRS_ENCODER_NO_AUDIO) { - if (acodec.find(SRS_ENCODER_ACODEC) == std::string::npos) { + if (acodec != SRS_RTMP_ENCODER_COPY && acodec != SRS_RTMP_ENCODER_NO_AUDIO) { + if (acodec.find(SRS_RTMP_ENCODER_ACODEC) == std::string::npos) { ret = ERROR_ENCODER_ACODEC; srs_error("invalid acodec, must be %s, actual %s, ret=%d", - SRS_ENCODER_ACODEC, acodec.c_str(), ret); + SRS_RTMP_ENCODER_ACODEC, acodec.c_str(), ret); return ret; } if (abitrate <= 0) { @@ -207,8 +207,8 @@ int SrsFFMPEG::initialize_copy() { int ret = ERROR_SUCCESS; - vcodec = SRS_ENCODER_COPY; - acodec = SRS_ENCODER_COPY; + vcodec = SRS_RTMP_ENCODER_COPY; + acodec = SRS_RTMP_ENCODER_COPY; if (_output.empty()) { ret = ERROR_ENCODER_OUTPUT; @@ -261,7 +261,7 @@ int SrsFFMPEG::start() } // video specified. - if (vcodec != SRS_ENCODER_NO_VIDEO) { + if (vcodec != SRS_RTMP_ENCODER_NO_VIDEO) { params.push_back("-vcodec"); params.push_back(vcodec); } else { @@ -269,7 +269,7 @@ int SrsFFMPEG::start() } // the codec params is disabled when copy - if (vcodec != SRS_ENCODER_COPY && vcodec != SRS_ENCODER_NO_VIDEO) { + if (vcodec != SRS_RTMP_ENCODER_COPY && vcodec != SRS_RTMP_ENCODER_NO_VIDEO) { params.push_back("-b:v"); snprintf(tmp, sizeof(tmp), "%d", vbitrate * 1000); params.push_back(tmp); @@ -310,7 +310,7 @@ int SrsFFMPEG::start() } // audio specified. - if (acodec != SRS_ENCODER_NO_AUDIO) { + if (acodec != SRS_RTMP_ENCODER_NO_AUDIO) { params.push_back("-acodec"); params.push_back(acodec); } else { @@ -318,7 +318,7 @@ int SrsFFMPEG::start() } // the codec params is disabled when copy - if (acodec != SRS_ENCODER_COPY && acodec != SRS_ENCODER_NO_AUDIO) { + if (acodec != SRS_RTMP_ENCODER_COPY && acodec != SRS_RTMP_ENCODER_NO_AUDIO) { params.push_back("-b:a"); snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000); params.push_back(tmp); diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index df5b7cfaa..0595161ec 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#ifdef SRS_INGEST +#ifdef SRS_RTMP_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_INGESTER_SLEEP_US (int64_t)(6*100*1000LL) +#define SRS_RTMP_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_INGESTER_SLEEP_US); + pthread = new SrsThread(this, SRS_RTMP_INGESTER_SLEEP_US); pithy_print = new SrsPithyPrint(SRS_STAGE_INGESTER); } @@ -187,7 +187,7 @@ int SrsIngester::cycle() // pithy print ingester(); - pithy_print->elapse(SRS_INGESTER_SLEEP_US / 1000); + pithy_print->elapse(SRS_RTMP_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_INGEST_TYPE_FILE) { + if (input_type == SRS_RTMP_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_INGEST_TYPE_STREAM) { + } else if (input_type == SRS_RTMP_INGEST_TYPE_STREAM) { std::string input_url = _srs_config->get_ingest_input_url(ingest); if (input_url.empty()) { ret = ERROR_ENCODER_NO_INPUT; diff --git a/trunk/src/app/srs_app_ingest.hpp b/trunk/src/app/srs_app_ingest.hpp index efc953671..53bb3f519 100644 --- a/trunk/src/app/srs_app_ingest.hpp +++ b/trunk/src/app/srs_app_ingest.hpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST #include diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 80b51db86..76fbd99b6 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -41,12 +41,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST #include #endif #define SERVER_LISTEN_BACKLOG 512 -#define SRS_TIME_RESOLUTION_MS 500 +#define SRS_SYS_TIME_RESOLUTION_MS 500 SrsListener::SrsListener(SrsServer* server, SrsListenerType type) { @@ -175,7 +175,7 @@ SrsServer::SrsServer() #ifdef SRS_HTTP_SERVER http_stream_handler = NULL; #endif -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST ingester = NULL; #endif } @@ -209,7 +209,7 @@ SrsServer::~SrsServer() #ifdef SRS_HTTP_SERVER srs_freep(http_stream_handler); #endif -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST srs_freep(ingester); #endif } @@ -232,7 +232,7 @@ int SrsServer::initialize() srs_assert(!http_stream_handler); http_stream_handler = SrsHttpHandler::create_http_stream(); #endif -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST srs_assert(!ingester); ingester = new SrsIngester(); #endif @@ -377,7 +377,7 @@ int SrsServer::ingest() { int ret = ERROR_SUCCESS; -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST if ((ret = ingester->start()) != ERROR_SUCCESS) { srs_error("start ingest streams failed. ret=%d", ret); return ret; @@ -393,7 +393,7 @@ int SrsServer::cycle() // the deamon thread, update the time cache while (true) { - st_usleep(SRS_TIME_RESOLUTION_MS * 1000); + st_usleep(SRS_SYS_TIME_RESOLUTION_MS * 1000); srs_update_system_time_ms(); // for gperf heap checker, @@ -419,7 +419,7 @@ int SrsServer::cycle() } } -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST ingester->stop(); #endif diff --git a/trunk/src/app/srs_app_server.hpp b/trunk/src/app/srs_app_server.hpp index 6a44c678c..9956076eb 100644 --- a/trunk/src/app/srs_app_server.hpp +++ b/trunk/src/app/srs_app_server.hpp @@ -85,7 +85,7 @@ private: #ifdef SRS_HTTP_SERVER SrsHttpHandler* http_stream_handler; #endif -#ifdef SRS_INGEST +#ifdef SRS_RTMP_INGEST SrsIngester* ingester; #endif private: