Browse Source

demux: adaptive: use VLC plugin API to compose URIs

pull/141/head
Haochen Tong 4 years ago
committed by Jean-Baptiste Kempf
parent
commit
6d7d4a2db0
  1. 31
      modules/demux/adaptive/http/ConnectionParams.cpp

31
modules/demux/adaptive/http/ConnectionParams.cpp

@ -26,7 +26,6 @@
#include <vlc_url.h>
#include <ctype.h>
#include <algorithm>
#include <sstream>
using namespace adaptive::http;
@ -62,20 +61,26 @@ const std::string & ConnectionParams::getPath() const
void ConnectionParams::setPath(const std::string &path_)
{
path = path_;
vlc_url_t url_components{};
char *uri_str;
url_components.psz_protocol = const_cast<char *>(scheme.c_str());
url_components.psz_path = const_cast<char *>(path_.c_str());
url_components.i_port = 0;
if (!hostname.empty()) {
url_components.psz_host = const_cast<char *>(hostname.c_str());
if ((port != 80 && scheme != "http") ||
(port != 443 && scheme != "https"))
url_components.i_port = port;
}
std::ostringstream os;
os.imbue(std::locale("C"));
os << scheme << "://";
if(!hostname.empty())
{
os << hostname;
if( (port != 80 && scheme != "http") ||
(port != 443 && scheme != "https") )
os << ":" << port;
uri_str = vlc_uri_compose(&url_components);
if (uri_str != nullptr) {
path = path_;
uri.assign(uri_str);
}
os << path;
uri = os.str();
free(uri_str);
}
uint16_t ConnectionParams::getPort() const

Loading…
Cancel
Save