[vlc-commits] demux: adaptive: don't fill tokens from non templates
Francois Cartegnie
git at videolan.org
Fri May 24 23:43:17 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 24 15:28:55 2019 +0200| [ec82072b156d7a094568d92e94f9f28242fe78a6] | committer: Francois Cartegnie
demux: adaptive: don't fill tokens from non templates
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec82072b156d7a094568d92e94f9f28242fe78a6
---
modules/demux/adaptive/playlist/SegmentInformation.hpp | 1 +
modules/demux/adaptive/playlist/SegmentTemplate.cpp | 14 +++++++++-----
modules/demux/adaptive/playlist/SegmentTemplate.h | 3 ++-
modules/demux/adaptive/playlist/Url.cpp | 2 +-
modules/demux/adaptive/playlist/Url.hpp | 6 +++---
modules/demux/dash/mpd/Representation.cpp | 2 ++
modules/demux/smooth/playlist/Representation.cpp | 3 +++
7 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.hpp b/modules/demux/adaptive/playlist/SegmentInformation.hpp
index 5eb12183b5..2dbedbf6f8 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.hpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.hpp
@@ -35,6 +35,7 @@ namespace adaptive
class SegmentList;
class SegmentTimeline;
class SegmentTemplate;
+ class MediaSegmentTemplate;
class AbstractPlaylist;
class ISegment;
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index c20e5d1cc9..c33151bc8c 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -36,6 +36,15 @@ BaseSegmentTemplate::BaseSegmentTemplate( ICanonicalUrl *parent ) :
{
}
+BaseSegmentTemplate::~BaseSegmentTemplate()
+{
+
+}
+
+void BaseSegmentTemplate::setSourceUrl(const std::string &url)
+{
+ sourceUrl = Url(Url::Component(url, this));
+}
MediaSegmentTemplate::MediaSegmentTemplate( SegmentInformation *parent ) :
BaseSegmentTemplate( parent ),
@@ -172,11 +181,6 @@ uint64_t MediaSegmentTemplate::getSequenceNumber() const
return inheritStartNumber();
}
-void MediaSegmentTemplate::setSourceUrl(const std::string &url)
-{
- sourceUrl = Url(Url::Component(url, this));
-}
-
void MediaSegmentTemplate::setStartNumber( uint64_t v )
{
startNumber = v;
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.h b/modules/demux/adaptive/playlist/SegmentTemplate.h
index 974bc41f66..6fb669a179 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.h
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.h
@@ -40,6 +40,8 @@ namespace adaptive
{
public:
BaseSegmentTemplate( ICanonicalUrl * = NULL );
+ virtual ~BaseSegmentTemplate();
+ virtual void setSourceUrl( const std::string &url ); /* reimpl */
};
class MediaSegmentTemplate : public BaseSegmentTemplate,
@@ -49,7 +51,6 @@ namespace adaptive
public:
MediaSegmentTemplate( SegmentInformation * = NULL );
virtual ~MediaSegmentTemplate();
- virtual void setSourceUrl( const std::string &url ); /* reimpl */
void setStartNumber( uint64_t );
void setSegmentTimeline( SegmentTimeline * );
void mergeWith( MediaSegmentTemplate *, vlc_tick_t );
diff --git a/modules/demux/adaptive/playlist/Url.cpp b/modules/demux/adaptive/playlist/Url.cpp
index fd9f0d203e..bd20701e37 100644
--- a/modules/demux/adaptive/playlist/Url.cpp
+++ b/modules/demux/adaptive/playlist/Url.cpp
@@ -137,7 +137,7 @@ std::string Url::toString(size_t index, const BaseRepresentation *rep) const
return ret;
}
-Url::Component::Component(const std::string & str, const MediaSegmentTemplate *templ_)
+Url::Component::Component(const std::string & str, const BaseSegmentTemplate *templ_)
: component(str), templ(templ_), b_scheme(false), b_dir(false), b_absolute(false)
{
if(!component.empty())
diff --git a/modules/demux/adaptive/playlist/Url.hpp b/modules/demux/adaptive/playlist/Url.hpp
index 06d8dda91f..6650eff0e0 100644
--- a/modules/demux/adaptive/playlist/Url.hpp
+++ b/modules/demux/adaptive/playlist/Url.hpp
@@ -28,7 +28,7 @@ namespace adaptive
{
namespace playlist
{
- class MediaSegmentTemplate;
+ class BaseSegmentTemplate;
class BaseRepresentation;
class Url
@@ -38,11 +38,11 @@ namespace adaptive
{
friend class Url;
public:
- Component(const std::string &, const MediaSegmentTemplate * = NULL);
+ Component(const std::string &, const BaseSegmentTemplate * = NULL);
protected:
std::string component;
- const MediaSegmentTemplate *templ;
+ const BaseSegmentTemplate *templ;
private:
bool b_scheme;
diff --git a/modules/demux/dash/mpd/Representation.cpp b/modules/demux/dash/mpd/Representation.cpp
index a37d911c2c..7bf2a39f0e 100644
--- a/modules/demux/dash/mpd/Representation.cpp
+++ b/modules/demux/dash/mpd/Representation.cpp
@@ -57,6 +57,8 @@ std::string Representation::contextualize(size_t number, const std::string &comp
const BaseSegmentTemplate *basetempl) const
{
std::string str(component);
+ if(!basetempl)
+ return str;
const MediaSegmentTemplate *templ = dynamic_cast<const MediaSegmentTemplate *>(basetempl);
diff --git a/modules/demux/smooth/playlist/Representation.cpp b/modules/demux/smooth/playlist/Representation.cpp
index 7a14ebc115..cbae08ed56 100644
--- a/modules/demux/smooth/playlist/Representation.cpp
+++ b/modules/demux/smooth/playlist/Representation.cpp
@@ -49,6 +49,9 @@ std::string Representation::contextualize(size_t number, const std::string &comp
std::string ret(component);
size_t pos;
+ if(!basetempl)
+ return ret;
+
const MediaSegmentTemplate *templ = dynamic_cast<const MediaSegmentTemplate *>(basetempl);
if(templ)
More information about the vlc-commits
mailing list