From 2b0c3375688cc7dd44a5e88eab3707aa26b300b2 Mon Sep 17 00:00:00 2001 From: Minh Ngo Date: Wed, 28 Aug 2013 16:13:24 +0300 Subject: Adding VLC version checking Change-Id: Iff3f91041a69c9a307de9fe82039a57b69309cd0 --- 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(-) create mode 100644 avmedia/source/vlc/wrapper/Common.cxx create mode 100644 avmedia/source/vlc/wrapper/Common.hxx (limited to 'avmedia') 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 +#include #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,9 +22,25 @@ 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 verComponents; + const std::string str(Common::Version()); + boost::split(verComponents, + str, + boost::is_any_of(".-")); + if (verComponents.size() < 3 + || boost::lexical_cast(verComponents[0]) < 2 + || (boost::lexical_cast(verComponents[1]) == 0 && boost::lexical_cast(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: -- cgit