summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-08-28 16:13:24 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-08-28 16:19:27 +0300
commit2b0c3375688cc7dd44a5e88eab3707aa26b300b2 (patch)
treee13653b776e64a7263db393960a3b61d844703c6 /avmedia
parent76fe24cf121025ddceb18f3b522d373f7f0256f7 (diff)
Adding VLC version checking
Change-Id: Iff3f91041a69c9a307de9fe82039a57b69309cd0
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/Library_avmediavlc.mk1
-rw-r--r--avmedia/source/vlc/vlcmanager.cxx21
-rw-r--r--avmedia/source/vlc/wrapper/Common.cxx33
-rw-r--r--avmedia/source/vlc/wrapper/Common.hxx24
-rw-r--r--avmedia/source/vlc/wrapper/Instance.hxx2
5 files changed, 78 insertions, 3 deletions
diff --git a/avmedia/Library_avmediavlc.mk b/avmedia/Library_avmediavlc.mk
index 832e746558f6..e7075a15522e 100644
--- a/avmedia/Library_avmediavlc.mk
+++ b/avmedia/Library_avmediavlc.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_add_exception_objects,avmediavlc,\
avmedia/source/vlc/wrapper/EventManager \
avmedia/source/vlc/wrapper/EventHandler \
avmedia/source/vlc/wrapper/ThreadsafeQueue \
+ avmedia/source/vlc/wrapper/Common \
))
# vim: set noet sw=4 ts=4:
diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx
index 5565f5afa4b5..a028d74ebc8a 100644
--- a/avmedia/source/vlc/vlcmanager.cxx
+++ b/avmedia/source/vlc/vlcmanager.cxx
@@ -1,9 +1,12 @@
+#include <boost/algorithm/string.hpp>
+#include <boost/lexical_cast.hpp>
#include "vlcmanager.hxx"
#include "vlcplayer.hxx"
#include "wrapper/Instance.hxx"
#include "wrapper/EventManager.hxx"
#include "wrapper/Media.hxx"
#include "wrapper/Player.hxx"
+#include "wrapper/Common.hxx"
using namespace ::com::sun::star;
@@ -19,10 +22,26 @@ Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr )
{
using namespace VLC;
static bool success = Instance::LoadSymbols() && EventManager::LoadSymbols()
- && Media::LoadSymbols() && Player::LoadSymbols();
+ && Media::LoadSymbols() && Player::LoadSymbols() && Common::LoadSymbols();
m_is_vlc_found = success;
if (m_is_vlc_found)
+ {
+ //Check VLC version
+ std::vector<std::string> verComponents;
+ const std::string str(Common::Version());
+ boost::split(verComponents,
+ str,
+ boost::is_any_of(".-"));
+ if (verComponents.size() < 3
+ || boost::lexical_cast<int>(verComponents[0]) < 2
+ || (boost::lexical_cast<int>(verComponents[1]) == 0 && boost::lexical_cast<int>(verComponents[2]) < 8))
+ {
+ m_is_vlc_found = false;
+ }
+ }
+
+ if (m_is_vlc_found)
mEventHandler->launch();
}
diff --git a/avmedia/source/vlc/wrapper/Common.cxx b/avmedia/source/vlc/wrapper/Common.cxx
new file mode 100644
index 000000000000..456ff3c078da
--- /dev/null
+++ b/avmedia/source/vlc/wrapper/Common.cxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include "Common.hxx"
+#include "SymbolLoader.hxx"
+
+namespace VLC
+{
+namespace
+{
+ const char* (*libvlc_get_version)(void);
+}
+
+bool Common::LoadSymbols()
+{
+ ApiMap VLC_COMMON_API[] =
+ {
+ SYM_MAP( libvlc_get_version )
+ };
+
+ return InitApiMap( VLC_COMMON_API );
+}
+
+const char* Common::Version()
+{
+ return libvlc_get_version();
+}
+} \ No newline at end of file
diff --git a/avmedia/source/vlc/wrapper/Common.hxx b/avmedia/source/vlc/wrapper/Common.hxx
new file mode 100644
index 000000000000..7a7ea8442e44
--- /dev/null
+++ b/avmedia/source/vlc/wrapper/Common.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _WRAPPER_COMMON_HXX
+#define _WRAPPER_COMMON_HXX
+
+namespace VLC
+{
+ class Common
+ {
+ public:
+ static bool LoadSymbols();
+ static const char* Version();
+ };
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/avmedia/source/vlc/wrapper/Instance.hxx b/avmedia/source/vlc/wrapper/Instance.hxx
index cbb6f4fa6bb0..9e6577ea2cc2 100644
--- a/avmedia/source/vlc/wrapper/Instance.hxx
+++ b/avmedia/source/vlc/wrapper/Instance.hxx
@@ -14,8 +14,6 @@ struct libvlc_instance_t;
namespace VLC
{
-
-
class Instance
{
public: