Commit a34ae180 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: add http bytesrange class

parent b656202b
...@@ -292,6 +292,8 @@ libadaptative_plugin_la_SOURCES = \ ...@@ -292,6 +292,8 @@ libadaptative_plugin_la_SOURCES = \
demux/adaptative/logic/RateBasedAdaptationLogic.cpp \ demux/adaptative/logic/RateBasedAdaptationLogic.cpp \
demux/adaptative/logic/Representationselectors.hpp \ demux/adaptative/logic/Representationselectors.hpp \
demux/adaptative/logic/Representationselectors.cpp \ demux/adaptative/logic/Representationselectors.cpp \
demux/adaptative/http/BytesRange.cpp \
demux/adaptative/http/BytesRange.hpp \
demux/adaptative/http/Chunk.cpp \ demux/adaptative/http/Chunk.cpp \
demux/adaptative/http/Chunk.h \ demux/adaptative/http/Chunk.h \
demux/adaptative/http/HTTPConnection.cpp \ demux/adaptative/http/HTTPConnection.cpp \
......
/*
* BytesRange.cpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN Authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "BytesRange.hpp"
using namespace adaptative::http;
BytesRange::BytesRange()
{
bytesStart = 2;
bytesEnd = 1;
}
BytesRange::BytesRange(size_t start, size_t end)
{
bytesStart = start;
bytesEnd = end;
}
bool BytesRange::isValid() const
{
if(bytesEnd < bytesStart)
return bytesEnd == 0;
return true;
}
size_t BytesRange::getStartByte() const
{
return bytesStart;
}
size_t BytesRange::getEndByte() const
{
return bytesEnd;
}
/*
* BytesRange.hpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN Authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef BYTESRANGE_HPP
#define BYTESRANGE_HPP
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
namespace adaptative
{
namespace http
{
class BytesRange
{
public:
BytesRange();
BytesRange(size_t start, size_t end);
bool isValid() const;
size_t getStartByte() const;
size_t getEndByte() const;
private:
size_t bytesStart;
size_t bytesEnd;
};
}
}
#endif // BYTESRANGE_HPP
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