[vlc-commits] demux: adaptative: fix scheme handling in segments
Francois Cartegnie
git at videolan.org
Wed Jun 10 18:58:06 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 10 14:34:47 2015 +0200| [a3195dae034a742d2cf38e7fe69158bc0b492749] | committer: Francois Cartegnie
demux: adaptative: fix scheme handling in segments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3195dae034a742d2cf38e7fe69158bc0b492749
---
modules/demux/adaptative/playlist/Segment.cpp | 17 ++++++++++++-----
modules/demux/adaptative/playlist/Segment.h | 2 +-
modules/demux/adaptative/playlist/SegmentTemplate.cpp | 17 +++++------------
modules/demux/adaptative/playlist/SegmentTemplate.h | 2 +-
modules/demux/adaptative/playlist/Url.cpp | 5 +++++
modules/demux/adaptative/playlist/Url.hpp | 1 +
6 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index f32003c..5b738d5 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -182,7 +182,7 @@ Segment::~Segment()
void Segment::setSourceUrl ( const std::string &url )
{
if ( url.empty() == false )
- this->sourceUrl = url;
+ this->sourceUrl = Url(url);
}
void Segment::debug(vlc_object_t *obj, int indent) const
@@ -204,10 +204,17 @@ void Segment::debug(vlc_object_t *obj, int indent) const
Url Segment::getUrlSegment() const
{
- Url ret = getParentUrlSegment();
- if (!sourceUrl.empty())
- ret.append(sourceUrl);
- return ret;
+ if(sourceUrl.hasScheme())
+ {
+ return sourceUrl;
+ }
+ else
+ {
+ Url ret = getParentUrlSegment();
+ if (!sourceUrl.empty())
+ ret.append(sourceUrl);
+ return ret;
+ }
}
Chunk* Segment::toChunk(size_t index, BaseRepresentation *ctxrep)
diff --git a/modules/demux/adaptative/playlist/Segment.h b/modules/demux/adaptative/playlist/Segment.h
index 7b22214..92c7e39 100644
--- a/modules/demux/adaptative/playlist/Segment.h
+++ b/modules/demux/adaptative/playlist/Segment.h
@@ -104,7 +104,7 @@ namespace adaptative
protected:
std::vector<SubSegment *> subsegments;
- std::string sourceUrl;
+ Url sourceUrl;
int size;
};
diff --git a/modules/demux/adaptative/playlist/SegmentTemplate.cpp b/modules/demux/adaptative/playlist/SegmentTemplate.cpp
index e7ae4d0..210e873 100644
--- a/modules/demux/adaptative/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTemplate.cpp
@@ -35,18 +35,6 @@ BaseSegmentTemplate::BaseSegmentTemplate( ICanonicalUrl *parent ) :
{
}
-Url BaseSegmentTemplate::getUrlSegment() const
-{
- Url ret = getParentUrlSegment();
- if (!sourceUrl.empty())
- {
- ret.append(Url::Component(
- sourceUrl,
- dynamic_cast<const MediaSegmentTemplate *>(this)) /* casts to NULL if != */
- );
- }
- return ret;
-}
MediaSegmentTemplate::MediaSegmentTemplate( SegmentInformation *parent ) :
BaseSegmentTemplate( parent ), Timelineable(), TimescaleAble( parent )
@@ -67,6 +55,11 @@ void MediaSegmentTemplate::mergeWith(MediaSegmentTemplate *updated, mtime_t prun
}
}
+void MediaSegmentTemplate::setSourceUrl(const std::string &url)
+{
+ sourceUrl = Url(Url::Component(url, this));
+}
+
InitSegmentTemplate::InitSegmentTemplate( ICanonicalUrl *parent ) :
BaseSegmentTemplate(parent)
{
diff --git a/modules/demux/adaptative/playlist/SegmentTemplate.h b/modules/demux/adaptative/playlist/SegmentTemplate.h
index 5f4d6e3..5c8ef64 100644
--- a/modules/demux/adaptative/playlist/SegmentTemplate.h
+++ b/modules/demux/adaptative/playlist/SegmentTemplate.h
@@ -40,7 +40,6 @@ namespace adaptative
{
public:
BaseSegmentTemplate( ICanonicalUrl * = NULL );
- virtual Url getUrlSegment() const; /* reimpl */
};
class MediaSegmentTemplate : public BaseSegmentTemplate,
@@ -50,6 +49,7 @@ namespace adaptative
{
public:
MediaSegmentTemplate( SegmentInformation * = NULL );
+ virtual void setSourceUrl( const std::string &url ); /* reimpl */
void mergeWith( MediaSegmentTemplate *, mtime_t );
Property<size_t> startNumber;
};
diff --git a/modules/demux/adaptative/playlist/Url.cpp b/modules/demux/adaptative/playlist/Url.cpp
index acc64c9..b3352dd 100644
--- a/modules/demux/adaptative/playlist/Url.cpp
+++ b/modules/demux/adaptative/playlist/Url.cpp
@@ -45,6 +45,11 @@ bool Url::hasScheme() const
return components[0].b_scheme;
}
+bool Url::empty() const
+{
+ return components.empty();
+}
+
Url & Url::prepend(const Component & comp)
{
components.insert(components.begin(), comp);
diff --git a/modules/demux/adaptative/playlist/Url.hpp b/modules/demux/adaptative/playlist/Url.hpp
index e40ccf9..4c349ba 100644
--- a/modules/demux/adaptative/playlist/Url.hpp
+++ b/modules/demux/adaptative/playlist/Url.hpp
@@ -57,6 +57,7 @@ namespace adaptative
Url(const Component &);
explicit Url(const std::string &);
bool hasScheme() const;
+ bool empty() const;
Url & prepend(const Component &);
Url & append(const Component &);
Url & append(const Url &);
More information about the vlc-commits
mailing list