Commit b78ea64b authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adptative: unbreak playlist urls

parent 1965d962
......@@ -114,6 +114,10 @@ static int Open(vlc_object_t *p_obj)
PlaylistManager *p_manager = NULL;
int logic = var_InheritInteger(p_obj, "adaptative-logic");
std::string playlisturl(p_demux->psz_access);
playlisturl.append("://");
playlisturl.append(p_demux->psz_location);
if(b_mimematched || DASHManager::isDASH(p_demux->s))
{
//Build a XML tree
......@@ -125,7 +129,8 @@ static int Open(vlc_object_t *p_obj)
}
//Begin the actual MPD parsing:
MPD *p_playlist = MPDFactory::create(parser.getRootNode(), p_demux->s, parser.getProfile());
MPD *p_playlist = MPDFactory::create(parser.getRootNode(), p_demux->s,
playlisturl, parser.getProfile());
if(p_playlist == NULL)
{
msg_Err( p_demux, "Cannot create/unknown MPD for profile");
......@@ -139,7 +144,7 @@ static int Open(vlc_object_t *p_obj)
else if(HLSManager::isHTTPLiveStreaming(p_demux->s))
{
Parser parser(p_demux->s);
M3U8 *p_playlist = parser.parse(std::string());
M3U8 *p_playlist = parser.parse(playlisturl);
if(!p_playlist)
{
msg_Err( p_demux, "Could not parse MPD" );
......
......@@ -28,7 +28,6 @@
#include "SegmentTimeline.h"
#include <vlc_common.h>
#include <vlc_stream.h>
#include <sstream>
using namespace adaptative::playlist;
......
......@@ -119,7 +119,9 @@ bool DASHManager::updatePlaylist()
minsegmentTime = segmentTime;
}
MPD *newmpd = MPDFactory::create(parser.getRootNode(), mpdstream, parser.getProfile());
MPD *newmpd = MPDFactory::create(parser.getRootNode(), mpdstream,
Helper::getDirectoryPath(url).append("/"),
parser.getProfile());
if(newmpd)
{
playlist->mergeWith(newmpd, minsegmentTime);
......
......@@ -39,20 +39,21 @@
#include "ProgramInformation.h"
#include "DASHSegment.h"
#include "../xml/DOMHelper.h"
#include "../adaptative/tools/Helper.h"
#include <vlc_strings.h>
#include <vlc_stream.h>
#include <cstdio>
#include <sstream>
using namespace dash::mpd;
using namespace dash::xml;
using namespace adaptative::playlist;
IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream)
IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream, std::string & streambaseurl_)
{
root = root_;
mpd = NULL;
p_stream = stream;
playlisturl = streambaseurl_;
}
IsoffMainParser::~IsoffMainParser ()
......@@ -65,6 +66,9 @@ 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* IsoffMainParser::getMPD()
......
......@@ -64,7 +64,7 @@ namespace dash
class IsoffMainParser
{
public:
IsoffMainParser (xml::Node *root, stream_t *p_stream);
IsoffMainParser (xml::Node *root, stream_t *p_stream, std::string &);
virtual ~IsoffMainParser ();
bool parse (Profile profile);
......@@ -87,6 +87,7 @@ namespace dash
xml::Node *root;
MPD *mpd;
stream_t *p_stream;
std::string playlisturl;
};
class IsoTime
......
......@@ -32,7 +32,8 @@
using namespace dash::xml;
using namespace dash::mpd;
MPD* MPDFactory::create(Node *root, stream_t *p_stream, Profile profile)
MPD* MPDFactory::create(Node *root, stream_t *p_stream,
std::string & playlisturl, Profile profile)
{
IsoffMainParser *parser = NULL;
......@@ -41,7 +42,7 @@ MPD* MPDFactory::create(Node *root, stream_t *p_stream, Profile profile)
case Profile::Unknown:
break;
default:
parser = new (std::nothrow) IsoffMainParser(root, p_stream);
parser = new (std::nothrow) IsoffMainParser(root, p_stream, playlisturl);
break;
}
......
......@@ -39,7 +39,8 @@ namespace dash
class MPDFactory
{
public:
static MPD* create(xml::Node *root, stream_t *p_stream, Profile profile);
static MPD* create(xml::Node *root, stream_t *p_stream,
std::string &, Profile profile);
};
}
}
......
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