[Libreoffice-commits] core.git: avmedia/Library_avmediavlc.mk avmedia/source

Minh Ngo nlminhtl at gmail.com
Wed Aug 28 06:20:04 PDT 2013


 avmedia/Library_avmediavlc.mk           |    1 
 avmedia/source/vlc/vlcmanager.cxx       |   21 +++++++++++++++++++-
 avmedia/source/vlc/wrapper/Common.cxx   |   33 ++++++++++++++++++++++++++++++++
 avmedia/source/vlc/wrapper/Common.hxx   |   24 +++++++++++++++++++++++
 avmedia/source/vlc/wrapper/Instance.hxx |    2 -
 5 files changed, 78 insertions(+), 3 deletions(-)

New commits:
commit 2b0c3375688cc7dd44a5e88eab3707aa26b300b2
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Wed Aug 28 16:13:24 2013 +0300

    Adding VLC version checking
    
    Change-Id: Iff3f91041a69c9a307de9fe82039a57b69309cd0

diff --git a/avmedia/Library_avmediavlc.mk b/avmedia/Library_avmediavlc.mk
index 832e746..e7075a1 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 5565f5a..a028d74 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 0000000..456ff3c
--- /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 0000000..7a7ea844
--- /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 cbb6f4f..9e6577e 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:


More information about the Libreoffice-commits mailing list