Commit f8e451e3 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: don't set playlist url as baseurl

We need playlist url as another extra level as some playlists have
the good idea to set baseurl to relative path :/
parent c20bdd8d
......@@ -60,6 +60,12 @@ void AbstractPlaylist::addBaseUrl(const std::string &url)
{
baseUrls.push_back(url);
}
void AbstractPlaylist::setPlaylistUrl(const std::string &url)
{
playlistUrl = url;
}
void AbstractPlaylist::addPeriod(BasePeriod *period)
{
periods.push_back(period);
......@@ -72,14 +78,15 @@ void AbstractPlaylist::setType(const std::string &type_)
Url AbstractPlaylist::getUrlSegment() const
{
Url ret;
if (!baseUrls.empty())
return Url(baseUrls.front());
else
{
std::stringstream ss;
ss << Helper::getDirectoryPath(stream->psz_url) << "/";
return Url(ss.str());
}
ret = Url(baseUrls.front());
if( !ret.hasScheme() && !playlistUrl.empty() )
ret.prepend( Url(playlistUrl) );
return ret;
}
vlc_object_t * AbstractPlaylist::getVLCObject() const
......
......@@ -45,6 +45,7 @@ namespace adaptative
void addPeriod (BasePeriod *period);
void addBaseUrl (const std::string &);
void setPlaylistUrl (const std::string &);
virtual Url getUrlSegment() const; /* impl */
vlc_object_t * getVLCObject() const;
......@@ -70,6 +71,7 @@ namespace adaptative
stream_t *stream;
std::vector<BasePeriod *> periods;
std::vector<std::string> baseUrls;
std::string playlistUrl;
std::string type;
};
}
......
......@@ -67,8 +67,7 @@ void IsoffMainParser::setMPDBaseUrl(Node *root)
for(size_t i = 0; i < baseUrls.size(); i++)
mpd->addBaseUrl(baseUrls.at(i)->getText());
if(baseUrls.empty())
mpd->addBaseUrl(Helper::getDirectoryPath(playlisturl).append("/"));
mpd->setPlaylistUrl( Helper::getDirectoryPath(playlisturl).append("/") );
}
MPD* IsoffMainParser::getMPD()
......
......@@ -319,11 +319,7 @@ M3U8 * Parser::parse(const std::string &playlisturl)
return NULL;
if(!playlisturl.empty())
{
size_t pos = playlisturl.find_last_of('/');
if(pos != std::string::npos)
playlist->addBaseUrl(playlisturl.substr(0, pos + 1));
}
playlist->setPlaylistUrl( Helper::getDirectoryPath(playlisturl).append("/") );
BasePeriod *period = new (std::nothrow) BasePeriod( playlist );
if(!period)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment