[vlc-commits] stream_filter: dash: add segment chunk class

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:49 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Nov 23 18:44:56 2014 +0100| [b59e03d0a272ce0fcca94364910189b867ad29c7] | committer: Francois Cartegnie

stream_filter: dash: add segment chunk class

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

 modules/stream_filter/dash/http/Chunk.h    |    4 ++--
 modules/stream_filter/dash/mpd/Segment.cpp |   17 ++++++++++++++---
 modules/stream_filter/dash/mpd/Segment.h   |   14 ++++++++++++--
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/modules/stream_filter/dash/http/Chunk.h b/modules/stream_filter/dash/http/Chunk.h
index 22ee70d..8853adf 100644
--- a/modules/stream_filter/dash/http/Chunk.h
+++ b/modules/stream_filter/dash/http/Chunk.h
@@ -72,7 +72,7 @@ namespace dash
                 void                setBitrate      (uint64_t bitrate);
                 int                 getBitrate      ();
 
-                virtual void        onDownload      () {}
+                virtual void        onDownload      (void *, size_t) {}
 
             private:
                 std::string                 url;
@@ -84,7 +84,7 @@ namespace dash
                 int                         bitrate;
                 int                         port;
                 bool                        isHostname;
-                size_t                      length;
+                uint64_t                    length;
                 uint64_t                    bytesRead;
                 IHTTPConnection             *connection;
         };
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 93d87b2..24cf130 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -41,9 +41,9 @@ ISegment::ISegment(const ICanonicalUrl *parent):
 
 }
 
-dash::http::Chunk* ISegment::toChunk() const
+dash::http::Chunk* ISegment::toChunk()
 {
-    Chunk *chunk = new Chunk();
+    Chunk *chunk = new SegmentChunk(this);
     if (!chunk)
         return NULL;
 
@@ -78,6 +78,17 @@ std::string ISegment::toString() const
     return std::string("    Segment url=").append(getUrlSegment());
 }
 
+ISegment::SegmentChunk::SegmentChunk(ISegment *segment_) :
+    Chunk()
+{
+    segment = segment_;
+}
+
+void ISegment::SegmentChunk::onDownload(void *, size_t)
+{
+
+}
+
 Segment::Segment(Representation *parent, bool isinit, bool tosplit) :
         ISegment(parent),
         parentRepresentation( parent ),
@@ -122,7 +133,7 @@ std::string Segment::getUrlSegment() const
     return ret;
 }
 
-dash::http::Chunk* Segment::toChunk() const
+dash::http::Chunk* Segment::toChunk()
 {
     Chunk *chunk = ISegment::toChunk();
     if (chunk)
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index 29edae9..404471c 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -51,7 +51,7 @@ namespace dash
                  */
                 virtual bool                            isSingleShot    () const;
                 virtual void                            done            ();
-                virtual dash::http::Chunk*              toChunk         () const;
+                virtual dash::http::Chunk*              toChunk         ();
                 virtual void                            setByteRange    (size_t start, size_t end);
                 virtual std::vector<ISegment*>          subSegments     () = 0;
                 virtual std::string                     toString        () const;
@@ -60,6 +60,16 @@ namespace dash
             protected:
                 size_t                  startByte;
                 size_t                  endByte;
+
+                class SegmentChunk : public dash::http::Chunk
+                {
+                    public:
+                        SegmentChunk(ISegment *segment);
+                        virtual void onDownload(void *, size_t);
+
+                    private:
+                        ISegment *segment;
+                };
         };
 
         class Segment : public ISegment
@@ -70,7 +80,7 @@ namespace dash
                 virtual void setSourceUrl( const std::string &url );
                 virtual bool needsSplit() const;
                 virtual std::string getUrlSegment() const; /* impl */
-                virtual dash::http::Chunk* toChunk() const;
+                virtual dash::http::Chunk* toChunk();
                 virtual std::vector<ISegment*> subSegments();
                 virtual std::string toString() const;
                 virtual Representation* getRepresentation() const;



More information about the vlc-commits mailing list