]> git.sesse.net Git - vlc/commitdiff
stream_filter: dash: add segment chunk class
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 23 Nov 2014 17:44:56 +0000 (18:44 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 18 Dec 2014 20:23:49 +0000 (21:23 +0100)
modules/stream_filter/dash/http/Chunk.h
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.h

index 22ee70d709ae3d983a65381c6e54f7752379a5c2..8853adf27d15e84d6af9f900d4470baf168cceff 100644 (file)
@@ -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;
         };
index 93d87b2507e8a1e8e18fa16888789789f8a66582..24cf130451ba5dfdb46c741cbdbb3427220a55b6 100644 (file)
@@ -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)
index 29edae96b5f2edac703d833c31137c94f04ede49..404471c083327cd565f61b88a8fb13a72141d34b 100644 (file)
@@ -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;