diff --git a/coreapi/fileplayer.c b/coreapi/fileplayer.c index ce04456d6..6752dc9e1 100644 --- a/coreapi/fileplayer.c +++ b/coreapi/fileplayer.c @@ -25,11 +25,15 @@ LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *sn return obj; } -void file_player_destroy(LinphonePlayer *obj) { +void linphone_file_player_destroy(LinphonePlayer *obj) { ms_file_player_free((MSFilePlayer *)obj->impl); ms_free(obj); } +bool_t linphone_file_player_matroska_supported(void) { + return ms_file_player_matroska_supported(); +} + static int file_player_open(LinphonePlayer *obj, const char *filename) { return ms_file_player_open((MSFilePlayer *)obj->impl, filename) ? 0 : -1; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index f8508b2de..5609d4168 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -608,7 +608,13 @@ LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *l * @brief Destroy a file player * @param obj File player to destroy */ -LINPHONE_PUBLIC void file_player_destroy(LinphonePlayer *obj); +LINPHONE_PUBLIC void linphone_file_player_destroy(LinphonePlayer *obj); + +/** + * @brief Check whether Matroksa format is supported by the player + * @return TRUE if it is supported + */ +LINPHONE_PUBLIC bool_t linphone_file_player_matroska_supported(void); /** * LinphoneCallState enum represents the different state a call can reach into. diff --git a/mediastreamer2 b/mediastreamer2 index aea0153df..75080eb55 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit aea0153df53e7a1b16618930ecb4310983124e80 +Subproject commit 75080eb55cca69c569e9b1b1cdcb4ac979f6a954 diff --git a/tester/player_tester.c b/tester/player_tester.c index 872f9a17f..59e648340 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -13,10 +13,9 @@ static void eof_callback(LinphonePlayer *player, void *user_data) { *eof = TRUE; } -static void playing_test(void) { +static void play_file(const char *filename, bool_t unsupported_format) { LinphoneCoreManager *lc_manager; LinphonePlayer *player; - const char *filename = "sounds/hello_opus_h264.mkv"; int res, time = 0; bool_t eof = FALSE; @@ -28,7 +27,12 @@ static void playing_test(void) { CU_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; - CU_ASSERT_EQUAL((res = linphone_player_open(player, filename, eof_callback, &eof)), 0); + res = linphone_player_open(player, filename, eof_callback, &eof); + if(unsupported_format) { + CU_ASSERT_EQUAL(res, -1); + } else { + CU_ASSERT_EQUAL(res, 0); + } if(res == -1) goto fail; CU_ASSERT_EQUAL((res = linphone_player_start(player)), 0); @@ -39,10 +43,14 @@ static void playing_test(void) { linphone_player_close(player); fail: - if(player) file_player_destroy(player); + if(player) linphone_file_player_destroy(player); if(lc_manager) linphone_core_manager_destroy(lc_manager); } +static void playing_test(void) { + play_file("sounds/hello_opus_h264.mkv", !linphone_file_player_matroska_supported()); +} + test_t player_tests[] = { { "Playing" , playing_test } };