[vlc-commits] demux: adaptive: don't fill tokens from non templates

Francois Cartegnie git at videolan.org
Mon Mar 30 16:15:53 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 24 15:28:55 2019 +0200| [b447ea2d427c9fd8101bcff326b6be40a42081e8] | committer: Francois Cartegnie

demux: adaptive: don't fill tokens from non templates

(cherry picked from commit ec82072b156d7a094568d92e94f9f28242fe78a6)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b447ea2d427c9fd8101bcff326b6be40a42081e8
---

 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 ea9282de7a..7d8a6a37dc 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 e9c657e644..43a000e826 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -37,6 +37,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 ),
@@ -173,11 +182,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 1b6ecc8847..9bf355694c 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.h
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.h
@@ -41,6 +41,8 @@ namespace adaptive
         {
             public:
                 BaseSegmentTemplate( ICanonicalUrl * = NULL );
+                virtual ~BaseSegmentTemplate();
+                virtual void setSourceUrl( const std::string &url ); /* reimpl */
         };
 
         class MediaSegmentTemplate : public BaseSegmentTemplate,
@@ -50,7 +52,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 *, mtime_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 7dd3592ba2..0310da2940 100644
--- a/modules/demux/dash/mpd/Representation.cpp
+++ b/modules/demux/dash/mpd/Representation.cpp
@@ -93,6 +93,8 @@ 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);
 
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