vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Thu Jan 5 12:20:47 2012 +0100| [eaf97ac67a41dff33a611941d565e0f1189c7743] | committer: Jean-Baptiste Kempf
dash: Handle relative URL Signed-off-by: Jean-Baptiste Kempf <[email protected]> (cherry picked from commit a90c1374304a712b6329015132d3ce3956a6ea1f) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=eaf97ac67a41dff33a611941d565e0f1189c7743 --- modules/stream_filter/dash/mpd/BasicCMParser.cpp | 19 ++++++++++++++++--- modules/stream_filter/dash/mpd/BasicCMParser.h | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp index 9b5f0f2..708b577 100644 --- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp +++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp @@ -42,11 +42,19 @@ using namespace dash::xml; BasicCMParser::BasicCMParser( Node *root, stream_t *p_stream ) : root( root ), - mpd( NULL ) + mpd( NULL ), + p_stream( p_stream ) { this->url = p_stream->psz_access; this->url += "://"; - this->url += p_stream->psz_path; + //Only append without the mpd file. + std::string path = p_stream->psz_path; + size_t it = path.find_last_of( '/', path.length() - 1 ); + if ( it != std::string::npos ) + this->url.append( path, 0, it ); + else + this->url += p_stream->psz_path; + this->url += '/'; } BasicCMParser::~BasicCMParser () @@ -374,7 +382,12 @@ bool BasicCMParser::parseSegment(Segment *seg, const std::map<std::string, std:: //FIXME: When not present, the sourceUrl attribute should be computed //using BaseURL and the range attribute. if ( it != attr.end() ) - seg->setSourceUrl( it->second ); + { + std::string url = it->second; + if ( url.find( this->p_stream->psz_access ) != 0 ) //Relative url + url = this->url + url; + seg->setSourceUrl( url ); + } return true; } diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.h b/modules/stream_filter/dash/mpd/BasicCMParser.h index e76f577..07de212 100644 --- a/modules/stream_filter/dash/mpd/BasicCMParser.h +++ b/modules/stream_filter/dash/mpd/BasicCMParser.h @@ -80,6 +80,7 @@ namespace dash dash::xml::Node *root; MPD *mpd; std::string url; + stream_t *p_stream; }; } } _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
