winlin

use string for const char*

@@ -1109,19 +1109,19 @@ int SrsHttpUri::initialize(string _url) @@ -1109,19 +1109,19 @@ int SrsHttpUri::initialize(string _url)
1109 return ret; 1109 return ret;
1110 } 1110 }
1111 1111
1112 -const char* SrsHttpUri::get_url() 1112 +string SrsHttpUri::get_url()
1113 { 1113 {
1114 - return url.data(); 1114 + return url;
1115 } 1115 }
1116 1116
1117 -const char* SrsHttpUri::get_schema() 1117 +string SrsHttpUri::get_schema()
1118 { 1118 {
1119 - return schema.data(); 1119 + return schema;
1120 } 1120 }
1121 1121
1122 -const char* SrsHttpUri::get_host() 1122 +string SrsHttpUri::get_host()
1123 { 1123 {
1124 - return host.data(); 1124 + return host;
1125 } 1125 }
1126 1126
1127 int SrsHttpUri::get_port() 1127 int SrsHttpUri::get_port()
@@ -1129,14 +1129,14 @@ int SrsHttpUri::get_port() @@ -1129,14 +1129,14 @@ int SrsHttpUri::get_port()
1129 return port; 1129 return port;
1130 } 1130 }
1131 1131
1132 -const char* SrsHttpUri::get_path() 1132 +string SrsHttpUri::get_path()
1133 { 1133 {
1134 - return path.data(); 1134 + return path;
1135 } 1135 }
1136 1136
1137 -const char* SrsHttpUri::get_query() 1137 +string SrsHttpUri::get_query()
1138 { 1138 {
1139 - return query.data(); 1139 + return query;
1140 } 1140 }
1141 1141
1142 string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field) 1142 string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field)
@@ -369,12 +369,12 @@ public: @@ -369,12 +369,12 @@ public:
369 */ 369 */
370 virtual int initialize(std::string _url); 370 virtual int initialize(std::string _url);
371 public: 371 public:
372 - virtual const char* get_url();  
373 - virtual const char* get_schema();  
374 - virtual const char* get_host(); 372 + virtual std::string get_url();
  373 + virtual std::string get_schema();
  374 + virtual std::string get_host();
375 virtual int get_port(); 375 virtual int get_port();
376 - virtual const char* get_path();  
377 - virtual const char* get_query(); 376 + virtual std::string get_path();
  377 + virtual std::string get_query();
378 private: 378 private:
379 /** 379 /**
380 * get the parsed url field. 380 * get the parsed url field.
@@ -378,7 +378,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration) @@ -378,7 +378,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration)
378 int ret = ERROR_SUCCESS; 378 int ret = ERROR_SUCCESS;
379 379
380 SrsHttpClient client; 380 SrsHttpClient client;
381 - srs_trace("parse input hls %s", url->get_url()); 381 + srs_trace("parse input hls %s", url->get_url().c_str());
382 382
383 if ((ret = client.initialize(url->get_host(), url->get_port())) != ERROR_SUCCESS) { 383 if ((ret = client.initialize(url->get_host(), url->get_port())) != ERROR_SUCCESS) {
384 srs_error("connect to server failed. ret=%d", ret); 384 srs_error("connect to server failed. ret=%d", ret);
@@ -387,7 +387,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration) @@ -387,7 +387,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration)
387 387
388 ISrsHttpMessage* msg = NULL; 388 ISrsHttpMessage* msg = NULL;
389 if ((ret = client.get(url->get_path(), "", &msg)) != ERROR_SUCCESS) { 389 if ((ret = client.get(url->get_path(), "", &msg)) != ERROR_SUCCESS) {
390 - srs_error("HTTP GET %s failed. ret=%d", url->get_url(), ret); 390 + srs_error("HTTP GET %s failed. ret=%d", url->get_url().c_str(), ret);
391 return ret; 391 return ret;
392 } 392 }
393 393
@@ -609,7 +609,7 @@ int SrsIngestSrsInput::SrsTsPiece::fetch(string m3u8) @@ -609,7 +609,7 @@ int SrsIngestSrsInput::SrsTsPiece::fetch(string m3u8)
609 609
610 ISrsHttpMessage* msg = NULL; 610 ISrsHttpMessage* msg = NULL;
611 if ((ret = client.get(uri.get_path(), "", &msg)) != ERROR_SUCCESS) { 611 if ((ret = client.get(uri.get_path(), "", &msg)) != ERROR_SUCCESS) {
612 - srs_error("HTTP GET %s failed. ret=%d", uri.get_url(), ret); 612 + srs_error("HTTP GET %s failed. ret=%d", uri.get_url().c_str(), ret);
613 return ret; 613 return ret;
614 } 614 }
615 615
@@ -1215,7 +1215,7 @@ int SrsIngestSrsOutput::connect() @@ -1215,7 +1215,7 @@ int SrsIngestSrsOutput::connect()
1215 return ret; 1215 return ret;
1216 } 1216 }
1217 1217
1218 - srs_trace("connect output=%s", out_rtmp->get_url()); 1218 + srs_trace("connect output=%s", out_rtmp->get_url().c_str());
1219 1219
1220 // parse uri 1220 // parse uri
1221 if (!req) { 1221 if (!req) {
@@ -1322,7 +1322,7 @@ int SrsIngestSrsOutput::connect_app(string ep_server, int ep_port) @@ -1322,7 +1322,7 @@ int SrsIngestSrsOutput::connect_app(string ep_server, int ep_port)
1322 1322
1323 void SrsIngestSrsOutput::close() 1323 void SrsIngestSrsOutput::close()
1324 { 1324 {
1325 - srs_trace("close output=%s", out_rtmp->get_url()); 1325 + srs_trace("close output=%s", out_rtmp->get_url().c_str());
1326 h264_sps_pps_sent = false; 1326 h264_sps_pps_sent = false;
1327 1327
1328 srs_freep(client); 1328 srs_freep(client);