Commit a3195dae authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: adaptative: fix scheme handling in segments

parent 77c4f92c
......@@ -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)
......
......@@ -104,7 +104,7 @@ namespace adaptative
protected:
std::vector<SubSegment *> subsegments;
std::string sourceUrl;
Url sourceUrl;
int size;
};
......
......@@ -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)
{
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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 &);
......
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