Commit 3d791362 authored by Simon Morlat's avatar Simon Morlat

add new rings and enable the ones by default

parent cb49c4f3
......@@ -116,11 +116,13 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val);
#define SOUNDS_PREFIX
#endif
/* relative path where is stored local ring*/
#define LOCAL_RING SOUNDS_PREFIX "rings/oldphone.wav"
#define LOCAL_RING SOUNDS_PREFIX "rings/oldphone-mono.wav"
#define LOCAL_RING_MKV SOUNDS_PREFIX "rings/notes_of_the_optimistic.mkv"
/* same for remote ring (ringback)*/
#define REMOTE_RING SOUNDS_PREFIX "ringback.wav"
#define HOLD_MUSIC SOUNDS_PREFIX "rings/toy-mono.wav"
#define HOLD_MUSIC SOUNDS_PREFIX "toy-mono.wav"
#define HOLD_MUSIC_MKV SOUNDS_PREFIX "dont_wait_too_long.mkv"
extern SalCallbacks linphone_sal_callbacks;
......@@ -815,6 +817,20 @@ static void build_sound_devices_table(LinphoneCore *lc){
if (old!=NULL) ms_free(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;
}
return PACKAGE_SOUND_DIR "/" LOCAL_RING;
}
static const char *get_default_onhold_music(LinphoneCore * lc){
if (linphone_core_file_format_supported(lc, "mkv")){
return PACKAGE_SOUND_DIR "/" HOLD_MUSIC_MKV;
}
return PACKAGE_SOUND_DIR "/" HOLD_MUSIC;
}
static void sound_config_read(LinphoneCore *lc)
{
int tmp;
......@@ -870,15 +886,11 @@ static void sound_config_read(LinphoneCore *lc)
linphone_core_set_sound_source(lc,tmpbuf[0]);
*/
tmpbuf=PACKAGE_SOUND_DIR "/" LOCAL_RING;
tmpbuf = get_default_local_ring(lc);
tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",tmpbuf);
if (ortp_file_exist(tmpbuf)==-1) {
ms_warning("%s does not exist",tmpbuf);
tmpbuf=PACKAGE_SOUND_DIR "/" LOCAL_RING;
}
if (strstr(tmpbuf,".wav")==NULL){
/* it currently uses old sound files, so replace them */
tmpbuf=PACKAGE_SOUND_DIR "/" LOCAL_RING;
tmpbuf = get_default_local_ring(lc);
}
linphone_core_set_ring(lc,tmpbuf);
......@@ -893,7 +905,7 @@ static void sound_config_read(LinphoneCore *lc)
}
linphone_core_set_ringback(lc,tmpbuf);
linphone_core_set_play_file(lc,lp_config_get_string(lc->config,"sound","hold_music",PACKAGE_SOUND_DIR "/" HOLD_MUSIC));
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;
......
......@@ -4035,6 +4035,15 @@ LINPHONE_PUBLIC const char * linphone_core_get_file_transfer_server(LinphoneCore
**/
LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneCore *core);
/**
* Returns whether a specific file format is supported.
* @see linphone_core_get_supported_file_formats
* @param lc the core
* @param the format extension (wav, mkv).
* @ingroup media_paramaters
**/
LINPHONE_PUBLIC bool_t linphone_core_file_format_supported(LinphoneCore *lc, const char *fmt);
LINPHONE_PUBLIC void linphone_core_add_supported_tag(LinphoneCore *core, const char *tag);
LINPHONE_PUBLIC void linphone_core_remove_supported_tag(LinphoneCore *core, const char *tag);
......
......@@ -1824,6 +1824,14 @@ const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){
return core->supported_formats;
}
bool_t linphone_core_file_format_supported(LinphoneCore *lc, const char *fmt){
const char **formats=linphone_core_get_supported_file_formats(lc);
for(;*formats!=NULL;++formats){
if (strcasecmp(*formats,fmt)==0) return TRUE;
}
return FALSE;
}
bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc){
return lp_config_get_int(lc->config,"rtp","symmetric",1);
}
......
......@@ -45,6 +45,8 @@ set(SOUND_FILES
hello8000.wav
incoming_chat.wav
ringback.wav
dont_wait_too_long.mkv
toy-mono.wav
)
install(FILES ${SOUND_FILES}
......
......@@ -2,20 +2,22 @@
SUBDIRS=C fr it ja cs xml
LINPHONE_SOUNDS=ringback.wav hello8000.wav hello16000.wav incoming_chat.wav
LINPHONE_RINGS=rings/orig.wav \
rings/oldphone.wav \
rings/oldphone-mono.wav \
rings/oldphone-mono-30s.caf \
rings/rock.wav \
rings/bigben.wav \
rings/toy-mono.wav \
rings/sweet.wav \
rings/synth.wav \
rings/tapping.wav
LINPHONE_RINGS= \
rings/oldphone-mono.wav \
rings/oldphone-mono-30s.caf \
rings/four_hands_together.mkv \
rings/house_keeping.mkv \
rings/its_a_game.mkv \
rings/leaving_dreams.mkv \
rings/notes_of_the_optimistic.mkv \
rings/soft_as_snow.mkv
LINPHONE_ONHOLD_MUSIC= toy-mono.wav \
dont_wait_too_long.mkv
sounddir=$(datadir)/sounds/linphone
sound_DATA=$(LINPHONE_SOUNDS)
sound_DATA=$(LINPHONE_SOUNDS) $(LINPHONE_ONHOLD_MUSIC)
ringdir=$(datadir)/sounds/linphone/rings
......
......@@ -21,18 +21,17 @@
############################################################################
set(RING_FILES
bigben.wav
oldphone-mono-30s.caf
oldphone-mono.wav
oldphone.wav
orig.wav
rock.wav
sweet.wav
synth.wav
tapping.wav
toy-mono.wav
four_hands_together.mkv
house_keeping.mkv
its_a_game.mkv
leaving_dreams.mkv
notes_of_the_optimistic.mkv
soft_as_snow.mkv
)
install(FILES ${RING_FILES}
DESTINATION ${PACKAGE_RING_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
......
......@@ -2820,14 +2820,6 @@ end:
ms_free(hellopath);
}
static bool_t is_format_supported(LinphoneCore *lc, const char *fmt){
const char **formats=linphone_core_get_supported_file_formats(lc);
for(;*formats!=NULL;++formats){
if (strcasecmp(*formats,fmt)==0) return TRUE;
}
return FALSE;
}
static void call_with_mkv_file_player(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
......@@ -2844,7 +2836,7 @@ static void call_with_mkv_file_player(void) {
hellowav = bc_tester_res("sounds/hello8000_mkv_ref.wav");
hellomkv = bc_tester_res("sounds/hello8000.mkv");
if (!is_format_supported(marie->lc,"mkv")){
if (!linphone_core_file_format_supported(marie->lc,"mkv")){
ms_warning("Test skipped, no mkv support.");
goto end;
}
......
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