[vlc-commits] demux: adaptative: add generic ID

Francois Cartegnie git at videolan.org
Thu Aug 6 17:30:20 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 31 00:30:21 2015 +0200| [508d7a81a978490d0dd9780a2b29381a3c6fc4ad] | committer: Francois Cartegnie

demux: adaptative: add generic ID

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

 modules/demux/Makefile.am                |    2 ++
 modules/demux/adaptative/playlist/ID.cpp |   57 ++++++++++++++++++++++++++++++
 modules/demux/adaptative/playlist/ID.hpp |   48 +++++++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index d85bdd3..0d6b3b4 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -256,6 +256,8 @@ libadaptative_plugin_la_SOURCES = \
     demux/adaptative/playlist/CommonAttributesElements.cpp \
     demux/adaptative/playlist/CommonAttributesElements.h \
     demux/adaptative/playlist/ICanonicalUrl.hpp \
+    demux/adaptative/playlist/ID.hpp \
+    demux/adaptative/playlist/ID.cpp \
     demux/adaptative/playlist/Inheritables.hpp \
     demux/adaptative/playlist/Inheritables.cpp \
     demux/adaptative/playlist/Segment.cpp \
diff --git a/modules/demux/adaptative/playlist/ID.cpp b/modules/demux/adaptative/playlist/ID.cpp
new file mode 100644
index 0000000..cf4b9e9
--- /dev/null
+++ b/modules/demux/adaptative/playlist/ID.cpp
@@ -0,0 +1,57 @@
+/*
+ * ID.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 "ID.hpp"
+#include <sstream>
+
+using namespace adaptative::playlist;
+
+int64_t ID::nextid = 0;
+
+ID::ID()
+{
+    id = nextid++;
+}
+
+ID::ID(int64_t i_id)
+{
+    id = i_id;
+}
+
+ID::~ID()
+{
+
+}
+
+bool ID::operator==(const ID &other) const
+{
+    return id == other.id;
+}
+
+std::string ID::str() const
+{
+    std::stringstream ss;
+    ss << id;
+    return ss.str();
+}
+
+int64_t ID::toInt() const
+{
+    return id;
+}
diff --git a/modules/demux/adaptative/playlist/ID.hpp b/modules/demux/adaptative/playlist/ID.hpp
new file mode 100644
index 0000000..080b869
--- /dev/null
+++ b/modules/demux/adaptative/playlist/ID.hpp
@@ -0,0 +1,48 @@
+/*
+ * ID.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 ID_HPP
+#define ID_HPP
+
+#include <string>
+
+namespace adaptative
+{
+    namespace playlist
+    {
+
+        class ID
+        {
+            public:
+                ID();
+                ID(int64_t);
+                virtual ~ID();
+                virtual bool operator==(const ID &) const;
+                virtual std::string str() const;
+                virtual int64_t toInt() const;
+
+            protected:
+                int64_t id;
+                static int64_t nextid;
+        };
+
+    }
+}
+
+#endif // ID_HPP



More information about the vlc-commits mailing list