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