winlin

refine the config consts

@@ -1288,12 +1288,12 @@ int SrsConfig::get_pithy_print_publish() @@ -1288,12 +1288,12 @@ int SrsConfig::get_pithy_print_publish()
1288 { 1288 {
1289 SrsConfDirective* pithy = root->get("pithy_print"); 1289 SrsConfDirective* pithy = root->get("pithy_print");
1290 if (!pithy) { 1290 if (!pithy) {
1291 - return SRS_STAGE_PUBLISH_USER_INTERVAL_MS; 1291 + return SRS_CONF_DEFAULT_STAGE_PUBLISH_USER_INTERVAL_MS;
1292 } 1292 }
1293 1293
1294 pithy = pithy->get("publish"); 1294 pithy = pithy->get("publish");
1295 if (!pithy) { 1295 if (!pithy) {
1296 - return SRS_STAGE_PUBLISH_USER_INTERVAL_MS; 1296 + return SRS_CONF_DEFAULT_STAGE_PUBLISH_USER_INTERVAL_MS;
1297 } 1297 }
1298 1298
1299 return ::atoi(pithy->arg0().c_str()); 1299 return ::atoi(pithy->arg0().c_str());
@@ -1303,12 +1303,12 @@ int SrsConfig::get_pithy_print_forwarder() @@ -1303,12 +1303,12 @@ int SrsConfig::get_pithy_print_forwarder()
1303 { 1303 {
1304 SrsConfDirective* pithy = root->get("pithy_print"); 1304 SrsConfDirective* pithy = root->get("pithy_print");
1305 if (!pithy) { 1305 if (!pithy) {
1306 - return SRS_STAGE_FORWARDER_INTERVAL_MS; 1306 + return SRS_CONF_DEFAULT_STAGE_FORWARDER_INTERVAL_MS;
1307 } 1307 }
1308 1308
1309 pithy = pithy->get("forwarder"); 1309 pithy = pithy->get("forwarder");
1310 if (!pithy) { 1310 if (!pithy) {
1311 - return SRS_STAGE_FORWARDER_INTERVAL_MS; 1311 + return SRS_CONF_DEFAULT_STAGE_FORWARDER_INTERVAL_MS;
1312 } 1312 }
1313 1313
1314 return ::atoi(pithy->arg0().c_str()); 1314 return ::atoi(pithy->arg0().c_str());
@@ -1318,12 +1318,12 @@ int SrsConfig::get_pithy_print_encoder() @@ -1318,12 +1318,12 @@ int SrsConfig::get_pithy_print_encoder()
1318 { 1318 {
1319 SrsConfDirective* pithy = root->get("pithy_print"); 1319 SrsConfDirective* pithy = root->get("pithy_print");
1320 if (!pithy) { 1320 if (!pithy) {
1321 - return SRS_STAGE_ENCODER_INTERVAL_MS; 1321 + return SRS_CONF_DEFAULT_STAGE_ENCODER_INTERVAL_MS;
1322 } 1322 }
1323 1323
1324 pithy = pithy->get("encoder"); 1324 pithy = pithy->get("encoder");
1325 if (!pithy) { 1325 if (!pithy) {
1326 - return SRS_STAGE_ENCODER_INTERVAL_MS; 1326 + return SRS_CONF_DEFAULT_STAGE_ENCODER_INTERVAL_MS;
1327 } 1327 }
1328 1328
1329 return ::atoi(pithy->arg0().c_str()); 1329 return ::atoi(pithy->arg0().c_str());
@@ -1333,12 +1333,12 @@ int SrsConfig::get_pithy_print_ingester() @@ -1333,12 +1333,12 @@ int SrsConfig::get_pithy_print_ingester()
1333 { 1333 {
1334 SrsConfDirective* pithy = root->get("pithy_print"); 1334 SrsConfDirective* pithy = root->get("pithy_print");
1335 if (!pithy) { 1335 if (!pithy) {
1336 - return SRS_STAGE_INGESTER_INTERVAL_MS; 1336 + return SRS_CONF_DEFAULT_STAGE_INGESTER_INTERVAL_MS;
1337 } 1337 }
1338 1338
1339 pithy = pithy->get("ingester"); 1339 pithy = pithy->get("ingester");
1340 if (!pithy) { 1340 if (!pithy) {
1341 - return SRS_STAGE_INGESTER_INTERVAL_MS; 1341 + return SRS_CONF_DEFAULT_STAGE_INGESTER_INTERVAL_MS;
1342 } 1342 }
1343 1343
1344 return ::atoi(pithy->arg0().c_str()); 1344 return ::atoi(pithy->arg0().c_str());
@@ -1348,12 +1348,12 @@ int SrsConfig::get_pithy_print_hls() @@ -1348,12 +1348,12 @@ int SrsConfig::get_pithy_print_hls()
1348 { 1348 {
1349 SrsConfDirective* pithy = root->get("pithy_print"); 1349 SrsConfDirective* pithy = root->get("pithy_print");
1350 if (!pithy) { 1350 if (!pithy) {
1351 - return SRS_STAGE_HLS_INTERVAL_MS; 1351 + return SRS_CONF_DEFAULT_STAGE_HLS_INTERVAL_MS;
1352 } 1352 }
1353 1353
1354 pithy = pithy->get("hls"); 1354 pithy = pithy->get("hls");
1355 if (!pithy) { 1355 if (!pithy) {
1356 - return SRS_STAGE_HLS_INTERVAL_MS; 1356 + return SRS_CONF_DEFAULT_STAGE_HLS_INTERVAL_MS;
1357 } 1357 }
1358 1358
1359 return ::atoi(pithy->arg0().c_str()); 1359 return ::atoi(pithy->arg0().c_str());
@@ -1363,12 +1363,12 @@ int SrsConfig::get_pithy_print_play() @@ -1363,12 +1363,12 @@ int SrsConfig::get_pithy_print_play()
1363 { 1363 {
1364 SrsConfDirective* pithy = root->get("pithy_print"); 1364 SrsConfDirective* pithy = root->get("pithy_print");
1365 if (!pithy) { 1365 if (!pithy) {
1366 - return SRS_STAGE_PLAY_USER_INTERVAL_MS; 1366 + return SRS_CONF_DEFAULT_STAGE_PLAY_USER_INTERVAL_MS;
1367 } 1367 }
1368 1368
1369 pithy = pithy->get("play"); 1369 pithy = pithy->get("play");
1370 if (!pithy) { 1370 if (!pithy) {
1371 - return SRS_STAGE_PLAY_USER_INTERVAL_MS; 1371 + return SRS_CONF_DEFAULT_STAGE_PLAY_USER_INTERVAL_MS;
1372 } 1372 }
1373 1373
1374 return ::atoi(pithy->arg0().c_str()); 1374 return ::atoi(pithy->arg0().c_str());
@@ -1378,12 +1378,12 @@ int SrsConfig::get_pithy_print_edge() @@ -1378,12 +1378,12 @@ int SrsConfig::get_pithy_print_edge()
1378 { 1378 {
1379 SrsConfDirective* pithy = root->get("pithy_print"); 1379 SrsConfDirective* pithy = root->get("pithy_print");
1380 if (!pithy) { 1380 if (!pithy) {
1381 - return SRS_STAGE_EDGE_INTERVAL_MS; 1381 + return SRS_CONF_DEFAULT_STAGE_EDGE_INTERVAL_MS;
1382 } 1382 }
1383 1383
1384 pithy = pithy->get("edge"); 1384 pithy = pithy->get("edge");
1385 if (!pithy) { 1385 if (!pithy) {
1386 - return SRS_STAGE_EDGE_INTERVAL_MS; 1386 + return SRS_CONF_DEFAULT_STAGE_EDGE_INTERVAL_MS;
1387 } 1387 }
1388 1388
1389 return ::atoi(pithy->arg0().c_str()); 1389 return ::atoi(pithy->arg0().c_str());
@@ -2311,13 +2311,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest) @@ -2311,13 +2311,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest)
2311 SrsConfDirective* conf = ingest->get("input"); 2311 SrsConfDirective* conf = ingest->get("input");
2312 2312
2313 if (!conf) { 2313 if (!conf) {
2314 - return SRS_AUTO_INGEST_TYPE_FILE; 2314 + return SRS_CONF_DEFAULT_INGEST_TYPE_FILE;
2315 } 2315 }
2316 2316
2317 conf = conf->get("type"); 2317 conf = conf->get("type");
2318 2318
2319 if (!conf) { 2319 if (!conf) {
2320 - return SRS_AUTO_INGEST_TYPE_FILE; 2320 + return SRS_CONF_DEFAULT_INGEST_TYPE_FILE;
2321 } 2321 }
2322 2322
2323 return conf->arg0(); 2323 return conf->arg0();
@@ -77,16 +77,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -77,16 +77,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
77 #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0 77 #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0
78 #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false 78 #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false
79 79
80 -#define SRS_STAGE_PLAY_USER_INTERVAL_MS 10000  
81 -#define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 10000  
82 -#define SRS_STAGE_FORWARDER_INTERVAL_MS 10000  
83 -#define SRS_STAGE_ENCODER_INTERVAL_MS 10000  
84 -#define SRS_STAGE_INGESTER_INTERVAL_MS 10000  
85 -#define SRS_STAGE_HLS_INTERVAL_MS 10000  
86 -#define SRS_STAGE_EDGE_INTERVAL_MS 10000 80 +#define SRS_CONF_DEFAULT_STAGE_PLAY_USER_INTERVAL_MS 10000
  81 +#define SRS_CONF_DEFAULT_STAGE_PUBLISH_USER_INTERVAL_MS 10000
  82 +#define SRS_CONF_DEFAULT_STAGE_FORWARDER_INTERVAL_MS 10000
  83 +#define SRS_CONF_DEFAULT_STAGE_ENCODER_INTERVAL_MS 10000
  84 +#define SRS_CONF_DEFAULT_STAGE_INGESTER_INTERVAL_MS 10000
  85 +#define SRS_CONF_DEFAULT_STAGE_HLS_INTERVAL_MS 10000
  86 +#define SRS_CONF_DEFAULT_STAGE_EDGE_INTERVAL_MS 10000
87 87
88 -#define SRS_AUTO_INGEST_TYPE_FILE "file"  
89 -#define SRS_AUTO_INGEST_TYPE_STREAM "stream" 88 +#define SRS_CONF_DEFAULT_INGEST_TYPE_FILE "file"
  89 +#define SRS_CONF_DEFAULT_INGEST_TYPE_STREAM "stream"
90 90
91 #define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv" 91 #define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv"
92 #define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv" 92 #define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv"
@@ -284,7 +284,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S @@ -284,7 +284,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
284 return ret; 284 return ret;
285 } 285 }
286 286
287 - if (input_type == SRS_AUTO_INGEST_TYPE_FILE) { 287 + if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_FILE) {
288 std::string input_url = _srs_config->get_ingest_input_url(ingest); 288 std::string input_url = _srs_config->get_ingest_input_url(ingest);
289 if (input_url.empty()) { 289 if (input_url.empty()) {
290 ret = ERROR_ENCODER_NO_INPUT; 290 ret = ERROR_ENCODER_NO_INPUT;
@@ -298,7 +298,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S @@ -298,7 +298,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
298 if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { 298 if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) {
299 return ret; 299 return ret;
300 } 300 }
301 - } else if (input_type == SRS_AUTO_INGEST_TYPE_STREAM) { 301 + } else if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_STREAM) {
302 std::string input_url = _srs_config->get_ingest_input_url(ingest); 302 std::string input_url = _srs_config->get_ingest_input_url(ingest);
303 if (input_url.empty()) { 303 if (input_url.empty()) {
304 ret = ERROR_ENCODER_NO_INPUT; 304 ret = ERROR_ENCODER_NO_INPUT;
@@ -109,31 +109,31 @@ VOID TEST(ConfigTest, CheckMacros) @@ -109,31 +109,31 @@ VOID TEST(ConfigTest, CheckMacros)
109 #ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES 109 #ifndef SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES
110 EXPECT_TRUE(false); 110 EXPECT_TRUE(false);
111 #endif 111 #endif
112 -#ifndef SRS_STAGE_PLAY_USER_INTERVAL_MS 112 +#ifndef SRS_CONF_DEFAULT_STAGE_PLAY_USER_INTERVAL_MS
113 EXPECT_TRUE(false); 113 EXPECT_TRUE(false);
114 #endif 114 #endif
115 -#ifndef SRS_STAGE_PUBLISH_USER_INTERVAL_MS 115 +#ifndef SRS_CONF_DEFAULT_STAGE_PUBLISH_USER_INTERVAL_MS
116 EXPECT_TRUE(false); 116 EXPECT_TRUE(false);
117 #endif 117 #endif
118 -#ifndef SRS_STAGE_FORWARDER_INTERVAL_MS 118 +#ifndef SRS_CONF_DEFAULT_STAGE_FORWARDER_INTERVAL_MS
119 EXPECT_TRUE(false); 119 EXPECT_TRUE(false);
120 #endif 120 #endif
121 -#ifndef SRS_STAGE_ENCODER_INTERVAL_MS 121 +#ifndef SRS_CONF_DEFAULT_STAGE_ENCODER_INTERVAL_MS
122 EXPECT_TRUE(false); 122 EXPECT_TRUE(false);
123 #endif 123 #endif
124 -#ifndef SRS_STAGE_INGESTER_INTERVAL_MS 124 +#ifndef SRS_CONF_DEFAULT_STAGE_INGESTER_INTERVAL_MS
125 EXPECT_TRUE(false); 125 EXPECT_TRUE(false);
126 #endif 126 #endif
127 -#ifndef SRS_STAGE_HLS_INTERVAL_MS 127 +#ifndef SRS_CONF_DEFAULT_STAGE_HLS_INTERVAL_MS
128 EXPECT_TRUE(false); 128 EXPECT_TRUE(false);
129 #endif 129 #endif
130 -#ifndef SRS_STAGE_EDGE_INTERVAL_MS 130 +#ifndef SRS_CONF_DEFAULT_STAGE_EDGE_INTERVAL_MS
131 EXPECT_TRUE(false); 131 EXPECT_TRUE(false);
132 #endif 132 #endif
133 -#ifndef SRS_AUTO_INGEST_TYPE_FILE 133 +#ifndef SRS_CONF_DEFAULT_INGEST_TYPE_FILE
134 EXPECT_TRUE(false); 134 EXPECT_TRUE(false);
135 #endif 135 #endif
136 -#ifndef SRS_AUTO_INGEST_TYPE_STREAM 136 +#ifndef SRS_CONF_DEFAULT_INGEST_TYPE_STREAM
137 EXPECT_TRUE(false); 137 EXPECT_TRUE(false);
138 #endif 138 #endif
139 #ifndef SRS_CONF_DEFAULT_TRANSCODE_IFORMAT 139 #ifndef SRS_CONF_DEFAULT_TRANSCODE_IFORMAT