[vlc-commits] dash: added path helpers
Christopher Mueller
git at videolan.org
Mon Feb 20 18:54:08 CET 2012
vlc | branch: master | Christopher Mueller <christopher.mueller at itec.aau.at> | Mon Feb 20 13:49:24 2012 +0100| [575ef3b3a6e5b6b9a4b7df644af6f6c12cdaa42a] | committer: Hugo Beauzée-Luyssen
dash: added path helpers
Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=575ef3b3a6e5b6b9a4b7df644af6f6c12cdaa42a
---
modules/stream_filter/dash/Helper.cpp | 47 +++++++++++++++++++++++++++++++++
modules/stream_filter/dash/Helper.h | 40 ++++++++++++++++++++++++++++
modules/stream_filter/dash/Modules.am | 2 +
3 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/modules/stream_filter/dash/Helper.cpp b/modules/stream_filter/dash/Helper.cpp
new file mode 100644
index 0000000..ebc0665
--- /dev/null
+++ b/modules/stream_filter/dash/Helper.cpp
@@ -0,0 +1,47 @@
+/*
+ * Helper.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2012 Klagenfurt University
+ *
+ * Created on: Feb 20, 2012
+ * Authors: Christopher Mueller <christopher.mueller at itec.uni-klu.ac.at>
+ * Christian Timmerer <christian.timmerer at itec.uni-klu.ac.at>
+ *
+ * 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 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 "Helper.h"
+
+using namespace dash;
+
+std::string Helper::combinePaths (const std::string &path1, const std::string &path2)
+{
+ char path1Last = path1.at(path1.size() - 1);
+ char path2First = path2.at(0);
+
+ if(path1Last == '/' && path2First == '/')
+ return path1 + path2.substr(1, path2.size());
+
+ if(path1Last != '/' && path2First != '/')
+ return path1 + "/" + path2;
+
+ return path1 + path2;
+}
+std::string Helper::getDirectoryPath (const std::string &path)
+{
+ int pos = path.find_last_of('/');
+
+ return path.substr(0, pos);
+}
diff --git a/modules/stream_filter/dash/Helper.h b/modules/stream_filter/dash/Helper.h
new file mode 100644
index 0000000..fd5e9c0
--- /dev/null
+++ b/modules/stream_filter/dash/Helper.h
@@ -0,0 +1,40 @@
+/*
+ * Helper.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2012 Klagenfurt University
+ *
+ * Created on: Feb 20, 2012
+ * Authors: Christopher Mueller <christopher.mueller at itec.uni-klu.ac.at>
+ * Christian Timmerer <christian.timmerer at itec.uni-klu.ac.at>
+ *
+ * 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 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 HELPER_H_
+#define HELPER_H_
+
+#include <string>
+
+namespace dash
+{
+ class Helper
+ {
+ public:
+ static std::string combinePaths (const std::string &path1, const std::string &path2);
+ static std::string getDirectoryPath (const std::string &path);
+ };
+}
+
+#endif /* HELPER_H_ */
diff --git a/modules/stream_filter/dash/Modules.am b/modules/stream_filter/dash/Modules.am
index 749dc52..9f9b2e0 100644
--- a/modules/stream_filter/dash/Modules.am
+++ b/modules/stream_filter/dash/Modules.am
@@ -80,5 +80,7 @@ SOURCES_stream_filter_dash = \
DASHDownloader.h \
DASHManager.cpp \
DASHManager.h \
+ Helper.cpp \
+ Helper.h \
$(NULL)
libvlc_LTLIBRARIES += libstream_filter_dash_plugin.la
More information about the vlc-commits
mailing list