Skip to content
Snippets Groups Projects
Commit 6d7d4a2d authored by hexchain's avatar hexchain Committed by Jean-Baptiste Kempf
Browse files

demux: adaptive: use VLC plugin API to compose URIs

parent d7693339
No related branches found
No related tags found
Loading
Pipeline #292046 passed with stage
in 16 minutes and 40 seconds
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment