[vlc-commits] demux: adptative: unbreak playlist urls
Francois Cartegnie
git at videolan.org
Sun Jul 26 21:59:44 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jul 26 21:56:39 2015 +0200| [b78ea64b4c679bdc78af90c7d11f2603a2ca6297] | committer: Francois Cartegnie
demux: adptative: unbreak playlist urls
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b78ea64b4c679bdc78af90c7d11f2603a2ca6297
---
modules/demux/adaptative/adaptative.cpp | 9 +++++++--
modules/demux/adaptative/playlist/AbstractPlaylist.cpp | 1 -
modules/demux/dash/DASHManager.cpp | 4 +++-
modules/demux/dash/mpd/IsoffMainParser.cpp | 8 ++++++--
modules/demux/dash/mpd/IsoffMainParser.h | 3 ++-
modules/demux/dash/mpd/MPDFactory.cpp | 5 +++--
modules/demux/dash/mpd/MPDFactory.h | 3 ++-
7 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/modules/demux/adaptative/adaptative.cpp b/modules/demux/adaptative/adaptative.cpp
index 2820b26..de82b5a 100644
--- a/modules/demux/adaptative/adaptative.cpp
+++ b/modules/demux/adaptative/adaptative.cpp
@@ -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" );
diff --git a/modules/demux/adaptative/playlist/AbstractPlaylist.cpp b/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
index 6153b38..89ecbec 100644
--- a/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
+++ b/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
@@ -28,7 +28,6 @@
#include "SegmentTimeline.h"
#include <vlc_common.h>
#include <vlc_stream.h>
-#include <sstream>
using namespace adaptative::playlist;
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index dbde53e..207ec4f 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -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);
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 5c14e0c..aeec8bb 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -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()
diff --git a/modules/demux/dash/mpd/IsoffMainParser.h b/modules/demux/dash/mpd/IsoffMainParser.h
index e634630..ad1b385 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.h
+++ b/modules/demux/dash/mpd/IsoffMainParser.h
@@ -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
diff --git a/modules/demux/dash/mpd/MPDFactory.cpp b/modules/demux/dash/mpd/MPDFactory.cpp
index 1829feb..9fc495d 100644
--- a/modules/demux/dash/mpd/MPDFactory.cpp
+++ b/modules/demux/dash/mpd/MPDFactory.cpp
@@ -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;
}
diff --git a/modules/demux/dash/mpd/MPDFactory.h b/modules/demux/dash/mpd/MPDFactory.h
index e654178..ad3d16f 100644
--- a/modules/demux/dash/mpd/MPDFactory.h
+++ b/modules/demux/dash/mpd/MPDFactory.h
@@ -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);
};
}
}
More information about the vlc-commits
mailing list