Chunk::Chunk () :
startByte (0),
endByte (0),
- hasByteRange (false),
port (0),
isHostname (false),
length (0),
{
}
-int Chunk::getEndByte () const
+size_t Chunk::getEndByte () const
{
return endByte;
}
-int Chunk::getStartByte () const
+size_t Chunk::getStartByte () const
{
return startByte;
}
{
return url;
}
-void Chunk::setEndByte (int endByte)
+void Chunk::setEndByte (size_t endByte)
{
this->endByte = endByte;
}
-void Chunk::setStartByte (int startByte)
+void Chunk::setStartByte (size_t startByte)
{
this->startByte = startByte;
}
{
this->optionalUrls.push_back(url);
}
-bool Chunk::useByteRange ()
+bool Chunk::usesByteRange () const
{
- return this->hasByteRange;
-}
-void Chunk::setUseByteRange (bool value)
-{
- this->hasByteRange = value;
+ return (startByte != endByte);
}
+
void Chunk::setBitrate (uint64_t bitrate)
{
this->bitrate = bitrate;
public:
Chunk ();
- int getEndByte () const;
- int getStartByte () const;
+ size_t getEndByte () const;
+ size_t getStartByte () const;
const std::string& getUrl () const;
bool hasHostname () const;
const std::string& getHostname () const;
void setConnection (IHTTPConnection *connection);
void setBytesRead (uint64_t bytes);
void setLength (uint64_t length);
- void setEndByte (int endByte);
- void setStartByte (int startByte);
+ void setEndByte (size_t endByte);
+ void setStartByte (size_t startByte);
void setUrl (const std::string& url);
void addOptionalUrl (const std::string& url);
- bool useByteRange ();
- void setUseByteRange (bool value);
+ bool usesByteRange () const;
void setBitrate (uint64_t bitrate);
int getBitrate ();
std::string path;
std::string hostname;
std::vector<std::string> optionalUrls;
- int startByte;
- int endByte;
- bool hasByteRange;
+ size_t startByte;
+ size_t endByte;
int bitrate;
int port;
bool isHostname;
{
std::string request;
- if(!chunk->useByteRange())
+ if(!chunk->usesByteRange())
{
request = "GET " + chunk->getPath() + " HTTP/1.1" + "\r\n" +
"Host: " + chunk->getHostname() + "\r\n" +
std::string PersistentConnection::prepareRequest (Chunk *chunk)
{
std::string request;
- if(!chunk->useByteRange())
+ if(!chunk->usesByteRange())
{
request = "GET " + chunk->getPath() + " HTTP/1.1" + "\r\n" +
"Host: " + chunk->getHostname() + "\r\n\r\n";
Segment::Segment(const Representation *parent, bool isinit) :
ICanonicalUrl( parent ),
- startByte (-1),
- endByte (-1),
+ startByte (0),
+ endByte (0),
parentRepresentation( parent ),
init( isinit )
{
{
Chunk *chunk = new Chunk();
- if(this->startByte != -1 && this->endByte != -1)
+ if(startByte != endByte)
{
- chunk->setUseByteRange(true);
- chunk->setStartByte(this->startByte);
- chunk->setEndByte(this->endByte);
+ chunk->setStartByte(startByte);
+ chunk->setEndByte(endByte);
}
chunk->setUrl( getUrlSegment() );
protected:
std::string sourceUrl;
- int startByte;
- int endByte;
+ size_t startByte;
+ size_t endByte;
const Representation* parentRepresentation;
int size;
bool init;