mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
The resources directories can now be defined at runtime.
This commit is contained in:
parent
1fce67f507
commit
35d9eeb152
9 changed files with 282 additions and 63 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}"
|
||||
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
|
||||
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
|
||||
#define PACKAGE_RING_DIR "${PACKAGE_RING_DIR}"
|
||||
|
||||
#cmakedefine BUILD_WIZARD
|
||||
#cmakedefine HAVE_GTK_OSX 1
|
||||
|
|
|
|||
|
|
@ -557,6 +557,8 @@ AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${package_prefix}/${DATADIRNAME}",[Defines
|
|||
dnl Set PACKAGE_SOUND_DIR in config.h.
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_SOUND_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone",[Defines the place where linphone sounds are found])
|
||||
|
||||
dnl Set PACKAGE_RING_DIR in config.h.
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_RING_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone/rings",[Defines the place where linphone rings are found])
|
||||
|
||||
dnl check if we have the getifaddrs() sytem call
|
||||
AC_CHECK_FUNCS(getifaddrs)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "linphone/factory.h"
|
||||
#include "private.h"
|
||||
|
||||
#ifndef PACKAGE_SOUND_DIR
|
||||
#define PACKAGE_SOUND_DIR "."
|
||||
#endif
|
||||
#ifndef PACKAGE_RING_DIR
|
||||
#define PACKAGE_RING_DIR "."
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE_DATA_DIR
|
||||
#define PACKAGE_DATA_DIR "."
|
||||
#endif
|
||||
|
||||
extern LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata);
|
||||
extern LinphoneCoreCbs *_linphone_core_cbs_new(void);
|
||||
extern LinphoneAddress *_linphone_address_new(const char *addr);
|
||||
|
|
@ -28,6 +39,12 @@ typedef belle_sip_object_t_vptr_t LinphoneFactory_vptr_t;
|
|||
|
||||
struct _LinphoneFactory {
|
||||
belle_sip_object_t base;
|
||||
char *top_resources_dir;
|
||||
char *data_resources_dir;
|
||||
char *sound_resources_dir;
|
||||
char *ring_resources_dir;
|
||||
char *image_resources_dir;
|
||||
char *msplugins_dir;
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFactory);
|
||||
|
|
@ -89,3 +106,66 @@ LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *facto
|
|||
LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
|
||||
return _linphone_vcard_new();
|
||||
}
|
||||
|
||||
char * linphone_factory_get_top_resources_dir(const LinphoneFactory *factory) {
|
||||
if (factory->top_resources_dir) return factory->top_resources_dir;
|
||||
return bctbx_strdup(PACKAGE_DATA_DIR);
|
||||
}
|
||||
|
||||
void linphone_factory_set_top_resources_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->top_resources_dir) bctbx_free(factory->top_resources_dir);
|
||||
factory->top_resources_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
||||
char * linphone_factory_get_data_resources_dir(const LinphoneFactory *factory) {
|
||||
if (factory->data_resources_dir) return factory->data_resources_dir;
|
||||
if (factory->top_resources_dir) return bctbx_strdup_printf("%s/linphone", factory->top_resources_dir);
|
||||
return bctbx_strdup_printf("%s/linphone", PACKAGE_DATA_DIR);
|
||||
}
|
||||
|
||||
void linphone_factory_set_data_resources_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->data_resources_dir) bctbx_free(factory->data_resources_dir);
|
||||
factory->data_resources_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
||||
char * linphone_factory_get_sound_resources_dir(const LinphoneFactory *factory) {
|
||||
if (factory->sound_resources_dir) return factory->sound_resources_dir;
|
||||
if (factory->top_resources_dir) return bctbx_strdup_printf("%s/sounds/linphone", factory->top_resources_dir);
|
||||
return bctbx_strdup(PACKAGE_SOUND_DIR);
|
||||
}
|
||||
|
||||
void linphone_factory_set_sound_resources_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->sound_resources_dir) bctbx_free(factory->sound_resources_dir);
|
||||
factory->sound_resources_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
||||
char * linphone_factory_get_ring_resources_dir(const LinphoneFactory *factory) {
|
||||
if (factory->ring_resources_dir) return factory->ring_resources_dir;
|
||||
if (factory->sound_resources_dir) return bctbx_strdup_printf("%s/rings", factory->sound_resources_dir);
|
||||
return bctbx_strdup(PACKAGE_RING_DIR);
|
||||
}
|
||||
|
||||
void linphone_factory_set_ring_resources_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->ring_resources_dir) bctbx_free(factory->ring_resources_dir);
|
||||
factory->ring_resources_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
||||
char * linphone_factory_get_image_resources_dir(const LinphoneFactory *factory) {
|
||||
if (factory->image_resources_dir) return factory->image_resources_dir;
|
||||
if (factory->top_resources_dir) return bctbx_strdup_printf("%s/images", factory->top_resources_dir);
|
||||
return bctbx_strdup_printf("%s/images", PACKAGE_DATA_DIR);
|
||||
}
|
||||
|
||||
void linphone_factory_set_image_resources_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->image_resources_dir) bctbx_free(factory->image_resources_dir);
|
||||
factory->image_resources_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
||||
char * linphone_factory_get_msplugins_dir(const LinphoneFactory *factory) {
|
||||
return factory->msplugins_dir;
|
||||
}
|
||||
|
||||
void linphone_factory_set_msplugins_dir(LinphoneFactory *factory, const char *path) {
|
||||
if (factory->msplugins_dir) bctbx_free(factory->msplugins_dir);
|
||||
factory->msplugins_dir = bctbx_strdup(path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
/*#define UNSTANDART_GSM_11K 1*/
|
||||
|
||||
#define ROOT_CA_FILE PACKAGE_DATA_DIR "/linphone/rootca.pem"
|
||||
|
||||
static const char *liblinphone_version=
|
||||
#ifdef LIBLINPHONE_GIT_VERSION
|
||||
LIBLINPHONE_GIT_VERSION
|
||||
|
|
@ -115,19 +113,14 @@ const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc);
|
|||
static void toggle_video_preview(LinphoneCore *lc, bool_t val);
|
||||
|
||||
|
||||
#if defined(LINPHONE_WINDOWS_PHONE) || defined(LINPHONE_WINDOWS_UNIVERSAL)
|
||||
#define SOUNDS_PREFIX "Assets/Sounds/"
|
||||
#else
|
||||
#define SOUNDS_PREFIX
|
||||
#endif
|
||||
/* relative path where is stored local ring*/
|
||||
#define LOCAL_RING SOUNDS_PREFIX "rings/oldphone-mono.wav"
|
||||
#define LOCAL_RING_MKV SOUNDS_PREFIX "rings/notes_of_the_optimistic.mkv"
|
||||
#define LOCAL_RING_WAV "oldphone-mono.wav"
|
||||
#define LOCAL_RING_MKV "notes_of_the_optimistic.mkv"
|
||||
/* same for remote ring (ringback)*/
|
||||
#define REMOTE_RING SOUNDS_PREFIX "ringback.wav"
|
||||
#define REMOTE_RING_WAV "ringback.wav"
|
||||
|
||||
#define HOLD_MUSIC SOUNDS_PREFIX "toy-mono.wav"
|
||||
#define HOLD_MUSIC_MKV SOUNDS_PREFIX "dont_wait_too_long.mkv"
|
||||
#define HOLD_MUSIC_WAV "toy-mono.wav"
|
||||
#define HOLD_MUSIC_MKV "dont_wait_too_long.mkv"
|
||||
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
|
||||
|
|
@ -961,25 +954,30 @@ static void build_sound_devices_table(LinphoneCore *lc){
|
|||
if (old!=NULL) ms_free((void *)old);
|
||||
}
|
||||
|
||||
static const char *get_default_local_ring(LinphoneCore * lc){
|
||||
if (linphone_core_file_format_supported(lc, "mkv")){
|
||||
return PACKAGE_SOUND_DIR "/" LOCAL_RING_MKV;
|
||||
static char *get_default_local_ring(LinphoneCore * lc) {
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
if (linphone_core_file_format_supported(lc, "mkv")) {
|
||||
return bctbx_strdup_printf("%s/%s", linphone_factory_get_ring_resources_dir(factory), LOCAL_RING_MKV);
|
||||
}
|
||||
return PACKAGE_SOUND_DIR "/" LOCAL_RING;
|
||||
return bctbx_strdup_printf("%s/%s", linphone_factory_get_ring_resources_dir(factory), LOCAL_RING_WAV);
|
||||
}
|
||||
|
||||
static const char *get_default_onhold_music(LinphoneCore * lc){
|
||||
if (linphone_core_file_format_supported(lc, "mkv")){
|
||||
return PACKAGE_SOUND_DIR "/" HOLD_MUSIC_MKV;
|
||||
static char *get_default_onhold_music(LinphoneCore * lc) {
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
if (linphone_core_file_format_supported(lc, "mkv")) {
|
||||
return bctbx_strdup_printf("%s/%s", linphone_factory_get_sound_resources_dir(factory), HOLD_MUSIC_MKV);
|
||||
}
|
||||
return PACKAGE_SOUND_DIR "/" HOLD_MUSIC;
|
||||
return bctbx_strdup_printf("%s/%s", linphone_factory_get_sound_resources_dir(factory), HOLD_MUSIC_WAV);
|
||||
}
|
||||
|
||||
static void sound_config_read(LinphoneCore *lc)
|
||||
{
|
||||
int tmp;
|
||||
char *default_remote_ring;
|
||||
const char *tmpbuf;
|
||||
const char *devid;
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
|
||||
#ifdef __linux
|
||||
/*alsadev let the user use custom alsa device within linphone*/
|
||||
devid=lp_config_get_string(lc->config,"sound","alsadev",NULL);
|
||||
|
|
@ -1030,25 +1028,45 @@ static void sound_config_read(LinphoneCore *lc)
|
|||
linphone_core_set_sound_source(lc,tmpbuf[0]);
|
||||
*/
|
||||
|
||||
tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",NULL);
|
||||
if (tmpbuf==NULL||ortp_file_exist(tmpbuf)!=0) {
|
||||
if (tmpbuf) ms_warning("%s does not exist",tmpbuf);
|
||||
tmpbuf = get_default_local_ring(lc);
|
||||
tmpbuf = lp_config_get_string(lc->config, "sound", "local_ring", NULL);
|
||||
if (tmpbuf) {
|
||||
if (bctbx_file_exist(tmpbuf) == 0) {
|
||||
linphone_core_set_ring(lc, tmpbuf);
|
||||
} else {
|
||||
ms_warning("'%s' ring file does not exist", tmpbuf);
|
||||
}
|
||||
} else {
|
||||
char *default_local_ring = get_default_local_ring(lc);
|
||||
linphone_core_set_ring(lc, default_local_ring);
|
||||
bctbx_free(default_local_ring);
|
||||
}
|
||||
linphone_core_set_ring(lc,tmpbuf);
|
||||
|
||||
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
|
||||
tmpbuf=lp_config_get_string(lc->config,"sound","remote_ring",tmpbuf);
|
||||
if (ortp_file_exist(tmpbuf)==-1){
|
||||
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
|
||||
default_remote_ring = bctbx_strdup_printf("%s/%s", linphone_factory_get_sound_resources_dir(factory), REMOTE_RING_WAV);
|
||||
tmpbuf = default_remote_ring;
|
||||
tmpbuf = lp_config_get_string(lc->config, "sound", "remote_ring", tmpbuf);
|
||||
if (bctbx_file_exist(tmpbuf) == -1){
|
||||
tmpbuf = default_remote_ring;
|
||||
}
|
||||
if (strstr(tmpbuf,".wav")==NULL){
|
||||
/* it currently uses old sound files, so replace them */
|
||||
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
|
||||
if (strstr(tmpbuf, ".wav") == NULL) {
|
||||
/* It currently uses old sound files, so replace them */
|
||||
tmpbuf = default_remote_ring;
|
||||
}
|
||||
linphone_core_set_ringback(lc, tmpbuf);
|
||||
bctbx_free(default_remote_ring);
|
||||
|
||||
tmpbuf = lp_config_get_string(lc->config, "sound", "hold_music", NULL);
|
||||
if (tmpbuf) {
|
||||
if (bctbx_file_exist(tmpbuf) == 0) {
|
||||
linphone_core_set_play_file(lc, tmpbuf);
|
||||
} else {
|
||||
ms_warning("'%s' on-hold music file does not exist", tmpbuf);
|
||||
}
|
||||
} else {
|
||||
char *default_onhold_music = get_default_onhold_music(lc);
|
||||
linphone_core_set_play_file(lc, default_onhold_music);
|
||||
bctbx_free(default_onhold_music);
|
||||
}
|
||||
linphone_core_set_ringback(lc,tmpbuf);
|
||||
|
||||
linphone_core_set_play_file(lc,lp_config_get_string(lc->config,"sound","hold_music", get_default_onhold_music(lc)));
|
||||
lc->sound_conf.latency=0;
|
||||
#ifndef __ios
|
||||
tmp=TRUE;
|
||||
|
|
@ -1074,6 +1092,9 @@ static void sound_config_read(LinphoneCore *lc)
|
|||
}
|
||||
|
||||
static void certificates_config_read(LinphoneCore *lc) {
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
char *data_dir = linphone_factory_get_data_resources_dir(factory);
|
||||
char *root_ca_path = bctbx_strdup_printf("%s/rootca.pem", data_dir);
|
||||
const char *rootca = lp_config_get_string(lc->config,"sip","root_ca", NULL);
|
||||
// If rootca is not existing anymore, we reset it to the default value
|
||||
if (rootca == NULL || (bctbx_file_exist(rootca) != 0)) {
|
||||
|
|
@ -1083,13 +1104,17 @@ static void certificates_config_read(LinphoneCore *lc) {
|
|||
rootca = "/etc/ssl/certs";
|
||||
} else
|
||||
#endif
|
||||
if (bctbx_file_exist(ROOT_CA_FILE) == 0) {
|
||||
rootca = ROOT_CA_FILE;
|
||||
{
|
||||
if (bctbx_file_exist(root_ca_path) == 0) {
|
||||
rootca = root_ca_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
linphone_core_set_root_ca(lc,rootca);
|
||||
linphone_core_verify_server_certificates(lc,lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE));
|
||||
linphone_core_verify_server_cn(lc,lp_config_get_int(lc->config,"sip","verify_server_cn",TRUE));
|
||||
bctbx_free(root_ca_path);
|
||||
bctbx_free(data_dir);
|
||||
}
|
||||
|
||||
static void sip_config_read(LinphoneCore *lc) {
|
||||
|
|
@ -1937,7 +1962,10 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc,
|
|||
|
||||
static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig *config, void * userdata){
|
||||
const char *remote_provisioning_uri = NULL;
|
||||
LinphoneFactory *lfactory = linphone_factory_get();
|
||||
LinphoneCoreCbs *internal_cbs = _linphone_core_cbs_new();
|
||||
char *msplugins_dir;
|
||||
char *image_resources_dir;
|
||||
|
||||
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
|
||||
|
||||
|
|
@ -1966,7 +1994,12 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
ortp_init();
|
||||
linphone_core_activate_log_serialization_if_needed();
|
||||
|
||||
lc->factory = ms_factory_new_with_voip();
|
||||
msplugins_dir = linphone_factory_get_msplugins_dir(lfactory);
|
||||
lc->factory = ms_factory_new_with_voip_and_plugins_dir(msplugins_dir);
|
||||
if (msplugins_dir) bctbx_free(msplugins_dir);
|
||||
image_resources_dir = linphone_factory_get_image_resources_dir(lfactory);
|
||||
ms_factory_set_image_resources_dir(lc->factory, image_resources_dir);
|
||||
bctbx_free(image_resources_dir);
|
||||
linphone_core_register_default_codecs(lc);
|
||||
linphone_core_register_offer_answer_providers(lc);
|
||||
/* Get the mediastreamer2 event queue */
|
||||
|
|
|
|||
|
|
@ -62,14 +62,6 @@
|
|||
#define LIBLINPHONE_VERSION LINPHONE_VERSION
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE_SOUND_DIR
|
||||
#define PACKAGE_SOUND_DIR "."
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE_DATA_DIR
|
||||
#define PACKAGE_DATA_DIR "."
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
|||
45
gtk/main.c
45
gtk/main.c
|
|
@ -144,7 +144,6 @@ static GOptionEntry linphone_options[]={
|
|||
{0}
|
||||
};
|
||||
|
||||
#define INSTALLED_XML_DIR PACKAGE_DATA_DIR "/linphone"
|
||||
#define RELATIVE_XML_DIR
|
||||
#define BUILD_TREE_XML_DIR "gtk"
|
||||
|
||||
|
|
@ -334,12 +333,14 @@ static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name)
|
|||
static int get_ui_file(const char *name, char *path, int pathsize){
|
||||
snprintf(path,pathsize,"%s/%s.ui",BUILD_TREE_XML_DIR,name);
|
||||
if (bctbx_file_exist(path)!=0){
|
||||
snprintf(path,pathsize,"%s/%s.ui",INSTALLED_XML_DIR,name);
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
char *data_dir = linphone_factory_get_data_resources_dir(factory);
|
||||
snprintf(path,pathsize,"%s/%s.ui",data_dir,name);
|
||||
if (bctbx_file_exist(path)!=0){
|
||||
g_error("Could not locate neither %s/%s.ui nor %s/%s.ui",BUILD_TREE_XML_DIR,name,
|
||||
INSTALLED_XML_DIR,name);
|
||||
g_error("Could not locate neither %s/%s.ui nor %s/%s.ui",BUILD_TREE_XML_DIR,name,data_dir,name);
|
||||
return -1;
|
||||
}
|
||||
bctbx_free(data_dir);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -478,17 +479,22 @@ static void about_url_clicked(GtkAboutDialog *dialog, const char *url, gpointer
|
|||
|
||||
void linphone_gtk_show_about(void){
|
||||
struct stat filestat;
|
||||
const char *license_file=PACKAGE_DATA_DIR "/linphone/COPYING";
|
||||
char *data_dir;
|
||||
char *license_file;
|
||||
GtkWidget *about;
|
||||
const char *tmp;
|
||||
GdkPixbuf *logo=create_pixbuf(
|
||||
linphone_gtk_get_ui_config("logo","linphone-banner.png"));
|
||||
static const char *defcfg="defcfg";
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
|
||||
about=linphone_gtk_create_window("about", the_ui);
|
||||
|
||||
gtk_about_dialog_set_url_hook(about_url_clicked,NULL,NULL);
|
||||
|
||||
data_dir = linphone_factory_get_data_resources_dir(factory);
|
||||
license_file = bctbx_strdup_printf("%s/COPYING", data_dir);
|
||||
bctbx_free(data_dir);
|
||||
memset(&filestat,0,sizeof(filestat));
|
||||
if (stat(license_file,&filestat)!=0){
|
||||
license_file="COPYING";
|
||||
|
|
@ -503,6 +509,7 @@ void linphone_gtk_show_about(void){
|
|||
}
|
||||
g_free(license);
|
||||
}
|
||||
bctbx_free(license_file);
|
||||
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about),linphone_core_get_version());
|
||||
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("title","Linphone"));
|
||||
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("home","http://www.linphone.org"));
|
||||
|
|
@ -2103,6 +2110,8 @@ static void populate_xdg_data_dirs_envvar(void) {
|
|||
int i;
|
||||
gchar *value;
|
||||
gchar **paths;
|
||||
char *data_dir;
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
|
||||
if(g_getenv("XDG_DATA_DIRS") == NULL) {
|
||||
value = g_strdup("/usr/share:/usr/local/share:/opt/local/share");
|
||||
|
|
@ -2110,12 +2119,14 @@ static void populate_xdg_data_dirs_envvar(void) {
|
|||
value = g_strdup(g_getenv("XDG_DATA_DIRS"));
|
||||
}
|
||||
paths = g_strsplit(value, ":", -1);
|
||||
for(i=0; paths[i] && strcmp(paths[i], PACKAGE_DATA_DIR) != 0; i++);
|
||||
data_dir = linphone_factory_get_top_resources_dir(factory);
|
||||
for(i=0; paths[i] && strcmp(paths[i], data_dir) != 0; i++);
|
||||
if(paths[i] == NULL) {
|
||||
gchar *new_value = g_strdup_printf("%s:%s", PACKAGE_DATA_DIR, value);
|
||||
gchar *new_value = g_strdup_printf("%s:%s", data_dir, value);
|
||||
g_setenv("XDG_DATA_DIRS", new_value, TRUE);
|
||||
g_free(new_value);
|
||||
}
|
||||
bctbx_free(data_dir);
|
||||
g_strfreev(paths);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -2127,10 +2138,13 @@ int main(int argc, char *argv[]){
|
|||
GtkSettings *settings;
|
||||
const char *icon_name=LINPHONE_ICON_NAME;
|
||||
const char *app_name="Linphone";
|
||||
LpConfig *factory;
|
||||
LpConfig *factory_config;
|
||||
char *chat_messages_db_file, *call_logs_db_file, *friends_db_file;
|
||||
GError *error=NULL;
|
||||
const char *tmp;
|
||||
char *resources_dir;
|
||||
char *pixmaps_dir;
|
||||
LinphoneFactory *factory;
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
||||
g_thread_init(NULL);
|
||||
|
|
@ -2226,17 +2240,22 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
#endif
|
||||
add_pixmap_directory("pixmaps");
|
||||
add_pixmap_directory(PACKAGE_DATA_DIR "/pixmaps/linphone");
|
||||
factory = linphone_factory_get();
|
||||
resources_dir = linphone_factory_get_top_resources_dir(factory);
|
||||
pixmaps_dir = bctbx_strdup_printf("%s/pixmaps/linphone", resources_dir);
|
||||
add_pixmap_directory(pixmaps_dir);
|
||||
bctbx_free(pixmaps_dir);
|
||||
bctbx_free(resources_dir);
|
||||
|
||||
/* Now, look for the factory configuration file, we do it this late
|
||||
since we want to have had time to change directory and to parse
|
||||
the options, in case we needed to access the working directory */
|
||||
factory_config_file = linphone_gtk_get_factory_config_file();
|
||||
if (factory_config_file){
|
||||
factory=lp_config_new(NULL);
|
||||
lp_config_read_file(factory,factory_config_file);
|
||||
app_name=lp_config_get_string(factory,"GtkUi","title","Linphone");
|
||||
icon_name=lp_config_get_string(factory,"GtkUi","icon_name",LINPHONE_ICON_NAME);
|
||||
factory_config=lp_config_new(NULL);
|
||||
lp_config_read_file(factory_config,factory_config_file);
|
||||
app_name=lp_config_get_string(factory_config,"GtkUi","title","Linphone");
|
||||
icon_name=lp_config_get_string(factory_config,"GtkUi","icon_name",LINPHONE_ICON_NAME);
|
||||
}
|
||||
g_set_application_name(app_name);
|
||||
gtk_window_set_default_icon_name(icon_name);
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ void linphone_gtk_set_ui_config(const char *key , const char * val){
|
|||
const char *linphone_gtk_get_sound_path(const char *name){
|
||||
static char *ret=NULL;
|
||||
const char *file;
|
||||
char *sound_dir;
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
|
||||
file=linphone_gtk_get_ui_config(name,NULL);
|
||||
if (file==NULL){
|
||||
char *dirname=g_path_get_dirname(name);
|
||||
|
|
@ -207,7 +210,9 @@ const char *linphone_gtk_get_sound_path(const char *name){
|
|||
g_free(ret);
|
||||
ret=NULL;
|
||||
}
|
||||
ret=g_build_filename(PACKAGE_SOUND_DIR,name,NULL);
|
||||
sound_dir = linphone_factory_get_sound_resources_dir(factory);
|
||||
ret=g_build_filename(sound_dir,name,NULL);
|
||||
bctbx_free(sound_dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,91 @@ LINPHONE_PUBLIC LinphoneAuthInfo *linphone_factory_create_auth_info(const Linpho
|
|||
*/
|
||||
LINPHONE_PUBLIC LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Get the top directory where the resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the top directory where the resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_top_resources_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the top directory where the resources are located.
|
||||
* If you only define this top directory, the other resources directory will automatically be derived form this one.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path to the top directory where the resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_top_resources_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* Get the directory where the data resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the directory where the data resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_data_resources_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the directory where the data resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path where the data resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_data_resources_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* Get the directory where the sound resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the directory where the sound resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_sound_resources_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the directory where the sound resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path where the sound resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_sound_resources_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* Get the directory where the ring resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the directory where the ring resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_ring_resources_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the directory where the ring resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path where the ring resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_ring_resources_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* Get the directory where the image resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the directory where the image resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_image_resources_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the directory where the image resources are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path where the image resources are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_image_resources_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* Get the directory where the mediastreamer2 plugins are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @return The path to the directory where the mediastreamer2 plugins are located, or NULL if it has not been set
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_factory_get_msplugins_dir(const LinphoneFactory *factory);
|
||||
|
||||
/**
|
||||
* Set the directory where the mediastreamer2 plugins are located.
|
||||
* @param[in] factory LinphoneFactory object
|
||||
* @param[in] path The path to the directory where the mediastreamer2 plugins are located
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_factory_set_msplugins_dir(LinphoneFactory *factory, const char *path);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ static void dump_call_logs(int signum){
|
|||
dump_stats=TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef PACKAGE_DATA_DIR
|
||||
#define PACKAGE_DATA_DIR '.'
|
||||
#endif
|
||||
/*
|
||||
* Call state notification callback
|
||||
|
|
@ -143,7 +140,12 @@ int main(int argc, char *argv[]){
|
|||
linphone_core_set_use_files(lc,TRUE);
|
||||
linphone_core_enable_echo_cancellation(lc, FALSE); /*no need for local echo cancellation when playing files*/
|
||||
if (!media_file){
|
||||
linphone_core_set_play_file(lc,PACKAGE_DATA_DIR "/sounds/linphone/hello16000.wav");
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
char *sound_resources_dir = linphone_factory_get_sound_resources_dir(factory);
|
||||
char *play_file = bctbx_strdup_printf("%s/hello16000.wav", sound_resources_dir);
|
||||
linphone_core_set_play_file(lc, play_file);
|
||||
bctbx_free(play_file);
|
||||
bctbx_free(sound_resources_dir);
|
||||
linphone_core_set_preferred_framerate(lc,5);
|
||||
}else{
|
||||
PayloadType *pt = linphone_core_find_payload_type(lc, "opus", 48000, -1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue