Adding VLC version checking

Change-Id: Iff3f91041a69c9a307de9fe82039a57b69309cd0
This commit is contained in:
Minh Ngo
2013-08-28 16:13:24 +03:00
parent 76fe24cf12
commit 2b0c337568
5 changed files with 78 additions and 3 deletions

View File

@@ -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:

View File

@@ -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,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<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();
}

View File

@@ -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();
}
}

View File

@@ -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: */

View File

@@ -14,8 +14,6 @@ struct libvlc_instance_t;
namespace VLC
{
class Instance
{
public: