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
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;
};
......
......@@ -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)
......
......@@ -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;
......
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