diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4f6d0de46..3d22687be 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 6d6444f03..26b86ef2f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -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); diff --git a/coreapi/misc.c b/coreapi/misc.c index e3a7f3daa..297371680 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -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); } diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index b12eb85ef..05acc992e 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -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} diff --git a/share/Makefile.am b/share/Makefile.am index 0b3fb0119..9b9357b6e 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -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 diff --git a/share/dont_wait_too_long.mkv b/share/dont_wait_too_long.mkv new file mode 100644 index 000000000..d90034b79 Binary files /dev/null and b/share/dont_wait_too_long.mkv differ diff --git a/share/rings/CMakeLists.txt b/share/rings/CMakeLists.txt index 6ec2182e2..73db53ea8 100644 --- a/share/rings/CMakeLists.txt +++ b/share/rings/CMakeLists.txt @@ -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 diff --git a/share/rings/bigben.wav b/share/rings/bigben.wav deleted file mode 100644 index f1ba850f6..000000000 Binary files a/share/rings/bigben.wav and /dev/null differ diff --git a/share/rings/four_hands_together.mkv b/share/rings/four_hands_together.mkv new file mode 100644 index 000000000..fef6c3ef8 Binary files /dev/null and b/share/rings/four_hands_together.mkv differ diff --git a/share/rings/house_keeping.mkv b/share/rings/house_keeping.mkv new file mode 100644 index 000000000..705c3616b Binary files /dev/null and b/share/rings/house_keeping.mkv differ diff --git a/share/rings/its_a_game.mkv b/share/rings/its_a_game.mkv new file mode 100644 index 000000000..a40ebe9c5 Binary files /dev/null and b/share/rings/its_a_game.mkv differ diff --git a/share/rings/leaving_dreams.mkv b/share/rings/leaving_dreams.mkv new file mode 100644 index 000000000..f82cb46a4 Binary files /dev/null and b/share/rings/leaving_dreams.mkv differ diff --git a/share/rings/notes_of_the_optimistic.mkv b/share/rings/notes_of_the_optimistic.mkv new file mode 100644 index 000000000..a1d923389 Binary files /dev/null and b/share/rings/notes_of_the_optimistic.mkv differ diff --git a/share/rings/oldphone.wav b/share/rings/oldphone.wav deleted file mode 100644 index e3056cc5d..000000000 Binary files a/share/rings/oldphone.wav and /dev/null differ diff --git a/share/rings/orig.wav b/share/rings/orig.wav deleted file mode 100644 index af74b54af..000000000 Binary files a/share/rings/orig.wav and /dev/null differ diff --git a/share/rings/rock.wav b/share/rings/rock.wav deleted file mode 100644 index 12374c067..000000000 Binary files a/share/rings/rock.wav and /dev/null differ diff --git a/share/rings/sweet.wav b/share/rings/sweet.wav deleted file mode 100644 index e5145486d..000000000 Binary files a/share/rings/sweet.wav and /dev/null differ diff --git a/share/rings/synth.wav b/share/rings/synth.wav deleted file mode 100644 index 7142f7a51..000000000 Binary files a/share/rings/synth.wav and /dev/null differ diff --git a/share/rings/tapping.wav b/share/rings/tapping.wav deleted file mode 100644 index 862fd79fb..000000000 Binary files a/share/rings/tapping.wav and /dev/null differ diff --git a/share/rings/toy-mono.wav b/share/toy-mono.wav similarity index 100% rename from share/rings/toy-mono.wav rename to share/toy-mono.wav diff --git a/tester/call_tester.c b/tester/call_tester.c index fda74ccf6..aec113218 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -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; }