[vlc-commits] demux: adaptative: add http bytesrange class

Francois Cartegnie git at videolan.org
Tue Oct 27 19:13:52 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 16 19:15:31 2015 +0200| [a34ae180610b34899303b44b33c48af42c884714] | committer: Francois Cartegnie

demux: adaptative: add http bytesrange class

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a34ae180610b34899303b44b33c48af42c884714
---

 modules/demux/Makefile.am                    |    2 +
 modules/demux/adaptative/http/BytesRange.cpp |   51 ++++++++++++++++++++++++++
 modules/demux/adaptative/http/BytesRange.hpp |   49 +++++++++++++++++++++++++
 3 files changed, 102 insertions(+)

diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 22e1bab..5ea22b2 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -292,6 +292,8 @@ libadaptative_plugin_la_SOURCES = \
     demux/adaptative/logic/RateBasedAdaptationLogic.cpp \
     demux/adaptative/logic/Representationselectors.hpp \
     demux/adaptative/logic/Representationselectors.cpp \
+    demux/adaptative/http/BytesRange.cpp \
+    demux/adaptative/http/BytesRange.hpp \
     demux/adaptative/http/Chunk.cpp \
     demux/adaptative/http/Chunk.h \
     demux/adaptative/http/HTTPConnection.cpp \
diff --git a/modules/demux/adaptative/http/BytesRange.cpp b/modules/demux/adaptative/http/BytesRange.cpp
new file mode 100644
index 0000000..13cc7cd
--- /dev/null
+++ b/modules/demux/adaptative/http/BytesRange.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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;
+}
diff --git a/modules/demux/adaptative/http/BytesRange.hpp b/modules/demux/adaptative/http/BytesRange.hpp
new file mode 100644
index 0000000..b4b58fc
--- /dev/null
+++ b/modules/demux/adaptative/http/BytesRange.hpp
@@ -0,0 +1,49 @@
+/*
+ * 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



More information about the vlc-commits mailing list