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

use string for const char*

This commit is contained in:
winlin 2015-10-13 16:42:49 +08:00
parent d9f991ed2f
commit 908365a61a
3 changed files with 20 additions and 20 deletions

View file

@ -1109,19 +1109,19 @@ int SrsHttpUri::initialize(string _url)
return ret; return ret;
} }
const char* SrsHttpUri::get_url() string SrsHttpUri::get_url()
{ {
return url.data(); return url;
} }
const char* SrsHttpUri::get_schema() string SrsHttpUri::get_schema()
{ {
return schema.data(); return schema;
} }
const char* SrsHttpUri::get_host() string SrsHttpUri::get_host()
{ {
return host.data(); return host;
} }
int SrsHttpUri::get_port() int SrsHttpUri::get_port()
@ -1129,14 +1129,14 @@ int SrsHttpUri::get_port()
return port; return port;
} }
const char* SrsHttpUri::get_path() string SrsHttpUri::get_path()
{ {
return path.data(); return path;
} }
const char* SrsHttpUri::get_query() string SrsHttpUri::get_query()
{ {
return query.data(); return query;
} }
string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field) string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field)

View file

@ -369,12 +369,12 @@ public:
*/ */
virtual int initialize(std::string _url); virtual int initialize(std::string _url);
public: public:
virtual const char* get_url(); virtual std::string get_url();
virtual const char* get_schema(); virtual std::string get_schema();
virtual const char* get_host(); virtual std::string get_host();
virtual int get_port(); virtual int get_port();
virtual const char* get_path(); virtual std::string get_path();
virtual const char* get_query(); virtual std::string get_query();
private: private:
/** /**
* get the parsed url field. * get the parsed url field.

View file

@ -378,7 +378,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration)
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
SrsHttpClient client; SrsHttpClient client;
srs_trace("parse input hls %s", url->get_url()); srs_trace("parse input hls %s", url->get_url().c_str());
if ((ret = client.initialize(url->get_host(), url->get_port())) != ERROR_SUCCESS) { if ((ret = client.initialize(url->get_host(), url->get_port())) != ERROR_SUCCESS) {
srs_error("connect to server failed. ret=%d", ret); srs_error("connect to server failed. ret=%d", ret);
@ -387,7 +387,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration)
ISrsHttpMessage* msg = NULL; ISrsHttpMessage* msg = NULL;
if ((ret = client.get(url->get_path(), "", &msg)) != ERROR_SUCCESS) { if ((ret = client.get(url->get_path(), "", &msg)) != ERROR_SUCCESS) {
srs_error("HTTP GET %s failed. ret=%d", url->get_url(), ret); srs_error("HTTP GET %s failed. ret=%d", url->get_url().c_str(), ret);
return ret; return ret;
} }
@ -609,7 +609,7 @@ int SrsIngestSrsInput::SrsTsPiece::fetch(string m3u8)
ISrsHttpMessage* msg = NULL; ISrsHttpMessage* msg = NULL;
if ((ret = client.get(uri.get_path(), "", &msg)) != ERROR_SUCCESS) { if ((ret = client.get(uri.get_path(), "", &msg)) != ERROR_SUCCESS) {
srs_error("HTTP GET %s failed. ret=%d", uri.get_url(), ret); srs_error("HTTP GET %s failed. ret=%d", uri.get_url().c_str(), ret);
return ret; return ret;
} }
@ -1215,7 +1215,7 @@ int SrsIngestSrsOutput::connect()
return ret; return ret;
} }
srs_trace("connect output=%s", out_rtmp->get_url()); srs_trace("connect output=%s", out_rtmp->get_url().c_str());
// parse uri // parse uri
if (!req) { if (!req) {
@ -1322,7 +1322,7 @@ int SrsIngestSrsOutput::connect_app(string ep_server, int ep_port)
void SrsIngestSrsOutput::close() void SrsIngestSrsOutput::close()
{ {
srs_trace("close output=%s", out_rtmp->get_url()); srs_trace("close output=%s", out_rtmp->get_url().c_str());
h264_sps_pps_sent = false; h264_sps_pps_sent = false;
srs_freep(client); srs_freep(client);