Commit b59e03d0 authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: add segment chunk class

parent 8ee98d1a
...@@ -72,7 +72,7 @@ namespace dash ...@@ -72,7 +72,7 @@ namespace dash
void setBitrate (uint64_t bitrate); void setBitrate (uint64_t bitrate);
int getBitrate (); int getBitrate ();
virtual void onDownload () {} virtual void onDownload (void *, size_t) {}
private: private:
std::string url; std::string url;
...@@ -84,7 +84,7 @@ namespace dash ...@@ -84,7 +84,7 @@ namespace dash
int bitrate; int bitrate;
int port; int port;
bool isHostname; bool isHostname;
size_t length; uint64_t length;
uint64_t bytesRead; uint64_t bytesRead;
IHTTPConnection *connection; IHTTPConnection *connection;
}; };
......
...@@ -41,9 +41,9 @@ ISegment::ISegment(const ICanonicalUrl *parent): ...@@ -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) if (!chunk)
return NULL; return NULL;
...@@ -78,6 +78,17 @@ std::string ISegment::toString() const ...@@ -78,6 +78,17 @@ std::string ISegment::toString() const
return std::string(" Segment url=").append(getUrlSegment()); 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) : Segment::Segment(Representation *parent, bool isinit, bool tosplit) :
ISegment(parent), ISegment(parent),
parentRepresentation( parent ), parentRepresentation( parent ),
...@@ -122,7 +133,7 @@ std::string Segment::getUrlSegment() const ...@@ -122,7 +133,7 @@ std::string Segment::getUrlSegment() const
return ret; return ret;
} }
dash::http::Chunk* Segment::toChunk() const dash::http::Chunk* Segment::toChunk()
{ {
Chunk *chunk = ISegment::toChunk(); Chunk *chunk = ISegment::toChunk();
if (chunk) if (chunk)
......
...@@ -51,7 +51,7 @@ namespace dash ...@@ -51,7 +51,7 @@ namespace dash
*/ */
virtual bool isSingleShot () const; virtual bool isSingleShot () const;
virtual void done (); virtual void done ();
virtual dash::http::Chunk* toChunk () const; virtual dash::http::Chunk* toChunk ();
virtual void setByteRange (size_t start, size_t end); virtual void setByteRange (size_t start, size_t end);
virtual std::vector<ISegment*> subSegments () = 0; virtual std::vector<ISegment*> subSegments () = 0;
virtual std::string toString () const; virtual std::string toString () const;
...@@ -60,6 +60,16 @@ namespace dash ...@@ -60,6 +60,16 @@ namespace dash
protected: protected:
size_t startByte; size_t startByte;
size_t endByte; 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 class Segment : public ISegment
...@@ -70,7 +80,7 @@ namespace dash ...@@ -70,7 +80,7 @@ namespace dash
virtual void setSourceUrl( const std::string &url ); virtual void setSourceUrl( const std::string &url );
virtual bool needsSplit() const; virtual bool needsSplit() const;
virtual std::string getUrlSegment() const; /* impl */ virtual std::string getUrlSegment() const; /* impl */
virtual dash::http::Chunk* toChunk() const; virtual dash::http::Chunk* toChunk();
virtual std::vector<ISegment*> subSegments(); virtual std::vector<ISegment*> subSegments();
virtual std::string toString() const; virtual std::string toString() const;
virtual Representation* getRepresentation() const; virtual Representation* getRepresentation() const;
......
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