Commit e755c3e4 authored by Ghislain MARY's avatar Ghislain MARY

Add linphonerc-factory file.

parent 0680d6d9
...@@ -185,7 +185,7 @@ if(WIN32) ...@@ -185,7 +185,7 @@ if(WIN32)
PATTERN "bin/*_tester.exe" EXCLUDE PATTERN "bin/*_tester.exe" EXCLUDE
PATTERN "bin/openh264.dll" EXCLUDE PATTERN "bin/openh264.dll" EXCLUDE
PATTERN "include" EXCLUDE PATTERN "include" EXCLUDE
PATTERN "lib/mediastreamer" EXCLUDE PATTERN "lib/mediastreamer/plugins/*openh264.*" EXCLUDE
PATTERN "lib/pkgconfig" EXCLUDE PATTERN "lib/pkgconfig" EXCLUDE
PATTERN "lib/*.a" EXCLUDE PATTERN "lib/*.a" EXCLUDE
PATTERN "lib/*.def" EXCLUDE PATTERN "lib/*.def" EXCLUDE
...@@ -206,10 +206,9 @@ if(WIN32) ...@@ -206,10 +206,9 @@ if(WIN32)
COMPONENT "msopenh264" COMPONENT "msopenh264"
FILES_MATCHING PATTERN "b*zip2.*" FILES_MATCHING PATTERN "b*zip2.*"
) )
install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/lib/mediastreamer/plugins/" install(FILES "${LINPHONE_OUTPUT_DIR}/lib/mediastreamer/plugins/libmsopenh264.dll"
DESTINATION "lib/mediastreamer/plugins" DESTINATION "lib/mediastreamer/plugins"
COMPONENT "msopenh264" COMPONENT "msopenh264"
FILES_MATCHING PATTERN "libmsopenh264.*"
) )
endif() endif()
...@@ -233,16 +232,13 @@ elseif(APPLE) ...@@ -233,16 +232,13 @@ elseif(APPLE)
install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/share/images" DESTINATION "Linphone.app/Contents/Resources/share" USE_SOURCE_PERMISSIONS) install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/share/images" DESTINATION "Linphone.app/Contents/Resources/share" USE_SOURCE_PERMISSIONS)
install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/share/sounds" DESTINATION "Linphone.app/Contents/Resources/share" USE_SOURCE_PERMISSIONS) install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/share/sounds" DESTINATION "Linphone.app/Contents/Resources/share" USE_SOURCE_PERMISSIONS)
install(FILES "${LINPHONE_OUTPUT_DIR}/share/Linphone/rootca.pem" DESTINATION "Linphone.app/Contents/Resources/share/linphone") install(FILES "${LINPHONE_OUTPUT_DIR}/share/Linphone/rootca.pem" DESTINATION "Linphone.app/Contents/Resources/share/linphone")
install(FILES "${LINPHONE_OUTPUT_DIR}/share/Linphone/linphonerc-factory" DESTINATION "Linphone.app/Contents/Resources/share/linphone")
configure_file("MacPackaging.cmake.in" "MacPackaging.cmake" @ONLY) configure_file("MacPackaging.cmake.in" "MacPackaging.cmake" @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/MacPackaging.cmake") install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/MacPackaging.cmake")
endif() endif()
if(MSVC) if(MSVC)
install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/lib/mediastreamer/plugins/"
DESTINATION "lib/mediastreamer/plugins"
FILES_MATCHING PATTERN "libmswasapi.dll"
)
string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" MSVC_VERSION "${CMAKE_GENERATOR}") string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" MSVC_VERSION "${CMAKE_GENERATOR}")
find_file(MSVCP_LIB "msvcp${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32") find_file(MSVCP_LIB "msvcp${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32")
find_file(UCRTBASE_LIB "ucrtbase.dll" PATHS "C:/Windows/System32") find_file(UCRTBASE_LIB "ucrtbase.dll" PATHS "C:/Windows/System32")
......
...@@ -204,6 +204,13 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ...@@ -204,6 +204,13 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/../.git/hooks/pre-commit" "${CMAKE_CURRENT_SOURCE_DIR}/../.git/hooks/pre-commit"
) )
# ------------------------------------------------------------------------------
# Create config.h file
# ------------------------------------------------------------------------------
set(MSPLUGINS_DIR "${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h")
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Build. # Build.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -254,3 +261,7 @@ install(TARGETS ${TARGET_NAME} ...@@ -254,3 +261,7 @@ install(TARGETS ${TARGET_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
install(FILES "assets/linphonerc-factory"
DESTINATION "${CMAKE_INSTALL_DATADIR}/linphone"
)
/***************************************************************************
* config.h.cmake
* Copyright (C) 2017 Belledonne Communications, Grenoble France
*
****************************************************************************
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 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.
*
****************************************************************************/
#cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QStandardPaths> #include <QStandardPaths>
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
#include "../../utils.hpp" #include "../../utils.hpp"
#include "Paths.hpp" #include "Paths.hpp"
#include "config.h"
#define PATH_AVATARS "/avatars/" #define PATH_AVATARS "/avatars/"
#define PATH_CAPTURES "/captures/" #define PATH_CAPTURES "/captures/"
...@@ -37,6 +39,7 @@ ...@@ -37,6 +39,7 @@
#define PATH_CALL_HISTORY_LIST "/call-history.db" #define PATH_CALL_HISTORY_LIST "/call-history.db"
#define PATH_CONFIG "/linphonerc" #define PATH_CONFIG "/linphonerc"
#define PATH_FACTORY_CONFIG "/linphonerc-factory"
#define PATH_FRIENDS_LIST "/friends.db" #define PATH_FRIENDS_LIST "/friends.db"
#define PATH_MESSAGE_HISTORY_LIST "/message-history.db" #define PATH_MESSAGE_HISTORY_LIST "/message-history.db"
#define PATH_ZRTP_SECRETS "/zidcache" #define PATH_ZRTP_SECRETS "/zidcache"
...@@ -78,16 +81,48 @@ inline void ensureFilePathExists (const QString &path) { ...@@ -78,16 +81,48 @@ inline void ensureFilePathExists (const QString &path) {
qFatal("Unable to access at path: `%s`", path.toStdString().c_str()); qFatal("Unable to access at path: `%s`", path.toStdString().c_str());
} }
inline string getDirectoryPath (const QString &dirname) { inline string getReadableDirectoryPath (const QString &dirname) {
ensureDirectoryPathExists(dirname);
return Utils::qStringToLinphoneString(QDir::toNativeSeparators(dirname)); return Utils::qStringToLinphoneString(QDir::toNativeSeparators(dirname));
} }
inline string getFilePath (const QString &filename) { inline string getWritableDirectoryPath (const QString &dirname) {
ensureFilePathExists(filename); ensureDirectoryPathExists(dirname);
return getReadableDirectoryPath(dirname);
}
inline string getReadableFilePath (const QString &filename) {
return Utils::qStringToLinphoneString(QDir::toNativeSeparators(filename)); return Utils::qStringToLinphoneString(QDir::toNativeSeparators(filename));
} }
inline string getWritableFilePath (const QString &filename) {
ensureFilePathExists(filename);
return getReadableFilePath(filename);
}
static QString getAppPackageDataDirpath () {
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") {
dir.cdUp();
dir.cd("Resources");
} else {
dir.cdUp();
}
dir.cd("share/linphone");
return dir.absolutePath();
}
static QString getAppPackageMsPluginsDirpath () {
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") {
dir.cdUp();
dir.cd("Resources");
} else {
dir.cdUp();
}
dir.cd(MSPLUGINS_DIR);
return dir.absolutePath();
}
static QString getAppConfigFilepath () { static QString getAppConfigFilepath () {
if (QSysInfo::productType() == "macos") if (QSysInfo::productType() == "macos")
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG;
...@@ -99,6 +134,10 @@ static QString getAppCallHistoryFilepath () { ...@@ -99,6 +134,10 @@ static QString getAppCallHistoryFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST;
} }
static QString getAppFactoryConfigFilepath () {
return getAppPackageDataDirpath() + PATH_FACTORY_CONFIG;
}
static QString getAppFriendsFilepath () { static QString getAppFriendsFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST;
} }
...@@ -110,46 +149,58 @@ static QString getAppMessageHistoryFilepath () { ...@@ -110,46 +149,58 @@ static QString getAppMessageHistoryFilepath () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
string Paths::getAvatarsDirpath () { string Paths::getAvatarsDirpath () {
return getDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS);
} }
string Paths::getCallHistoryFilepath () { string Paths::getCallHistoryFilepath () {
return getFilePath(getAppCallHistoryFilepath()); return getWritableFilePath(getAppCallHistoryFilepath());
} }
string Paths::getConfigFilepath (const QString &config_path) { string Paths::getConfigFilepath (const QString &config_path) {
if (!config_path.isEmpty()) if (!config_path.isEmpty())
return getFilePath(QFileInfo(config_path).absoluteFilePath()); return getWritableFilePath(QFileInfo(config_path).absoluteFilePath());
return getFilePath(getAppConfigFilepath()); return getWritableFilePath(getAppConfigFilepath());
}
string Paths::getFactoryConfigFilepath () {
return getReadableFilePath(getAppFactoryConfigFilepath());
} }
string Paths::getFriendsListFilepath () { string Paths::getFriendsListFilepath () {
return getFilePath(getAppFriendsFilepath()); return getWritableFilePath(getAppFriendsFilepath());
} }
string Paths::getLogsDirpath () { string Paths::getLogsDirpath () {
return getDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS);
} }
string Paths::getMessageHistoryFilepath () { string Paths::getMessageHistoryFilepath () {
return getFilePath(getAppMessageHistoryFilepath()); return getWritableFilePath(getAppMessageHistoryFilepath());
}
string Paths::getPackageDataDirpath () {
return getReadableDirectoryPath(getAppPackageDataDirpath());
}
string Paths::getPackageMsPluginsDirpath () {
return getReadableDirectoryPath(getAppPackageMsPluginsDirpath());
} }
string Paths::getThumbnailsDirpath () { string Paths::getThumbnailsDirpath () {
return getDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
} }
string Paths::getCapturesDirpath () { string Paths::getCapturesDirpath () {
return getDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
} }
string Paths::getZrtpSecretsFilepath () { string Paths::getZrtpSecretsFilepath () {
return getFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + PATH_ZRTP_SECRETS); return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + PATH_ZRTP_SECRETS);
} }
string Paths::getUserCertificatesDirpath () { string Paths::getUserCertificatesDirpath () {
return getDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -36,8 +36,12 @@ namespace Paths { ...@@ -36,8 +36,12 @@ namespace Paths {
std::string getThumbnailsDirpath (); std::string getThumbnailsDirpath ();
std::string getUserCertificatesDirpath (); std::string getUserCertificatesDirpath ();
std::string getPackageDataDirpath ();
std::string getPackageMsPluginsDirpath ();
std::string getCallHistoryFilepath (); std::string getCallHistoryFilepath ();
std::string getConfigFilepath (const QString &config_path = QString()); std::string getConfigFilepath (const QString &config_path = QString());
std::string getFactoryConfigFilepath ();
std::string getFriendsListFilepath (); std::string getFriendsListFilepath ();
std::string getMessageHistoryFilepath (); std::string getMessageHistoryFilepath ();
std::string getZrtpSecretsFilepath (); std::string getZrtpSecretsFilepath ();
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "CoreManager.hpp" #include "CoreManager.hpp"
#include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QtConcurrent> #include <QtConcurrent>
...@@ -97,19 +96,9 @@ void CoreManager::setOtherPaths () { ...@@ -97,19 +96,9 @@ void CoreManager::setOtherPaths () {
} }
void CoreManager::setResourcesPaths () { void CoreManager::setResourcesPaths () {
QDir dir(QCoreApplication::applicationDirPath()); shared_ptr<linphone::Factory> factory = linphone::Factory::get();
if (dir.dirName() == "MacOS") { factory->setMspluginsDir(Paths::getPackageMsPluginsDirpath());
dir.cdUp(); factory->setTopResourcesDir(Paths::getPackageDataDirpath());
dir.cd("Resources");
QDir mspluginsdir(dir);
mspluginsdir.cd("lib/mediastreamer/plugins");
QDir datadir(dir);
datadir.cd("share");
shared_ptr<linphone::Factory> factory = linphone::Factory::get();
factory->setMspluginsDir(::Utils::qStringToLinphoneString(mspluginsdir.absolutePath()));
factory->setTopResourcesDir(::Utils::qStringToLinphoneString(datadir.absolutePath()));
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -122,7 +111,7 @@ void CoreManager::createLinphoneCore (const QString &config_path) { ...@@ -122,7 +111,7 @@ void CoreManager::createLinphoneCore (const QString &config_path) {
setResourcesPaths(); setResourcesPaths();
m_core = linphone::Factory::get()->createCore(m_handlers, Paths::getConfigFilepath(config_path), ""); m_core = linphone::Factory::get()->createCore(m_handlers, Paths::getConfigFilepath(config_path), Paths::getFactoryConfigFilepath());
m_core->setVideoDisplayFilter("MSOGL"); m_core->setVideoDisplayFilter("MSOGL");
m_core->usePreviewWindow(true); m_core->usePreviewWindow(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment