[vlc-commits] [Git][videolan/vlc][master] demux: adaptive: use VLC plugin API to compose URIs
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Dec 11 16:01:19 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
6d7d4a2d by Haochen Tong at 2022-12-11T15:49:52+00:00
demux: adaptive: use VLC plugin API to compose URIs
- - - - -
1 changed file:
- modules/demux/adaptive/http/ConnectionParams.cpp
Changes:
=====================================
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
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6d7d4a2db0fefc3536f91b6bfcaf5f4e787d6487
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6d7d4a2db0fefc3536f91b6bfcaf5f4e787d6487
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list