From 40a82f05f5f8a01227d6d6a3a71743bc3c047d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Wed, 15 Oct 2014 12:10:03 +0200 Subject: [PATCH] Rename fileplayer.c into localplayer.c --- coreapi/Makefile.am | 2 +- coreapi/fileplayer.c | 96 ------------------------------------- coreapi/linphonecore.h | 10 ++-- coreapi/linphonecore_jni.cc | 6 +-- coreapi/localplayer.c | 96 +++++++++++++++++++++++++++++++++++++ mediastreamer2 | 2 +- tester/player_tester.c | 6 +-- 7 files changed, 109 insertions(+), 109 deletions(-) delete mode 100644 coreapi/fileplayer.c create mode 100644 coreapi/localplayer.c diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index e2a6beb4f..2bb8498d9 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -62,7 +62,7 @@ liblinphone_la_SOURCES=\ call_log.c \ call_params.c \ player.c \ - fileplayer.c \ + localplayer.c \ $(GITVERSION_FILE) if BUILD_UPNP diff --git a/coreapi/fileplayer.c b/coreapi/fileplayer.c deleted file mode 100644 index 103dd205e..000000000 --- a/coreapi/fileplayer.c +++ /dev/null @@ -1,96 +0,0 @@ -/* -linphone -Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org) - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "private.h" -#include -#include - -static int file_player_open(LinphonePlayer *obj, const char *filename); -static int file_player_start(LinphonePlayer *obj); -static int file_player_pause(LinphonePlayer *obj); -static int file_player_seek(LinphonePlayer *obj, int time_ms); -static MSPlayerState file_player_get_state(LinphonePlayer *obj); -static int file_player_get_duration(LinphonePlayer *obj); -static int file_player_get_current_position(LinphonePlayer *obj); -static void file_player_close(LinphonePlayer *obj); -static void file_player_eof_callback(void *user_data); - -LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id) { - LinphonePlayer *obj = ms_new0(LinphonePlayer, 1); - if(snd_card == NULL) snd_card = lc->sound_conf.play_sndcard; - if(video_out == NULL) video_out = linphone_core_get_video_display_filter(lc); - obj->impl = ms_file_player_new(snd_card, video_out, window_id); - obj->open = file_player_open; - obj->start = file_player_start; - obj->pause = file_player_pause; - obj->seek = file_player_seek; - obj->get_state = file_player_get_state; - obj->get_duration = file_player_get_duration; - obj->get_position = file_player_get_current_position; - obj->close = file_player_close; - ms_file_player_set_eof_callback((MSFilePlayer *)obj->impl, file_player_eof_callback, obj); - return 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; -} - -static int file_player_start(LinphonePlayer *obj) { - return ms_file_player_start((MSFilePlayer *)obj->impl) ? 0 : -1; -} - -static int file_player_pause(LinphonePlayer *obj) { - ms_file_player_pause((MSFilePlayer *)obj->impl); - return 0; -} - -static int file_player_seek(LinphonePlayer *obj, int time_ms) { - return ms_file_player_seek((MSFilePlayer *)obj->impl, time_ms) ? 0 : -1; -} - -static MSPlayerState file_player_get_state(LinphonePlayer *obj) { - return ms_file_player_get_state((MSFilePlayer *)obj->impl); -} - -static int file_player_get_duration(LinphonePlayer *obj) { - return ms_file_player_get_duration((MSFilePlayer *)obj->impl); -} - -static int file_player_get_current_position(LinphonePlayer *obj) { - return ms_file_player_get_current_position((MSFilePlayer *)obj->impl); -} - -static void file_player_close(LinphonePlayer *obj) { - ms_file_player_close((MSFilePlayer *)obj->impl); -} - -static void file_player_eof_callback(void *user_data) { - LinphonePlayer *obj = (LinphonePlayer *)user_data; - obj->cb(obj, obj->user_data); -} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 7dd4d8f55..2f1036678 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -599,25 +599,25 @@ void linphone_player_close(LinphonePlayer *obj); /** * @brief Create an independent media file player. * This player support WAVE and MATROSKA formats. - * @param lc A LinphoneCore + * @param lc A LinphoneCore object * @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used * @param video_out Video display. If NULL, the video display set in LinphoneCore will be used * @param window_id Pointer on the drawing window * @return A pointer on the new instance. NULL if faild. */ -LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id); +LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id); /** - * @brief Destroy a file player + * @brief Destroy a local player * @param obj File player to destroy */ -LINPHONE_PUBLIC void linphone_file_player_destroy(LinphonePlayer *obj); +LINPHONE_PUBLIC void linphone_local_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); +LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void); /** * LinphoneCallState enum represents the different state a call can reach into. diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index dbcc128c7..c1cc56e47 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -5303,7 +5303,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *en return 0; } window_ref = env->NewGlobalRef(window); - LinphonePlayer *player = linphone_core_create_file_player((LinphoneCore *)ptr, snd_card, "MSAndroidDisplay", window_ref); + LinphonePlayer *player = linphone_core_create_local_player((LinphoneCore *)ptr, snd_card, "MSAndroidDisplay", window_ref); if(player == NULL) { ms_error("Fails to create a player"); if(window_ref) env->DeleteGlobalRef(window_ref); @@ -5318,7 +5318,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_destroyPlayer(JNIEnv *en if(player->user_data) { delete (LinphonePlayerData *)player->user_data; } - jobject window_id = (jobject)ms_file_player_get_window_id((MSFilePlayer *)player->impl); + jobject window_id = (jobject)ms_media_player_get_window_id((MSMediaPlayer *)player->impl); if(window_id) env->DeleteGlobalRef(window_id); - linphone_file_player_destroy(player); + linphone_local_player_destroy(player); } diff --git a/coreapi/localplayer.c b/coreapi/localplayer.c new file mode 100644 index 000000000..9d6e1b5c3 --- /dev/null +++ b/coreapi/localplayer.c @@ -0,0 +1,96 @@ +/* +linphone +Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org) + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "private.h" +#include +#include + +static int _local_player_open(LinphonePlayer *obj, const char *filename); +static int _local_player_start(LinphonePlayer *obj); +static int _local_player_pause(LinphonePlayer *obj); +static int _local_player_seek(LinphonePlayer *obj, int time_ms); +static MSPlayerState _local_player_get_state(LinphonePlayer *obj); +static int _local_player_get_duration(LinphonePlayer *obj); +static int _local_player_get_current_position(LinphonePlayer *obj); +static void _local_player_close(LinphonePlayer *obj); +static void _local_player_eof_callback(void *user_data); + +LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id) { + LinphonePlayer *obj = ms_new0(LinphonePlayer, 1); + if(snd_card == NULL) snd_card = lc->sound_conf.play_sndcard; + if(video_out == NULL) video_out = linphone_core_get_video_display_filter(lc); + obj->impl = ms_media_player_new(snd_card, video_out, window_id); + obj->open = _local_player_open; + obj->start = _local_player_start; + obj->pause = _local_player_pause; + obj->seek = _local_player_seek; + obj->get_state = _local_player_get_state; + obj->get_duration = _local_player_get_duration; + obj->get_position = _local_player_get_current_position; + obj->close = _local_player_close; + ms_media_player_set_eof_callback((MSMediaPlayer *)obj->impl, _local_player_eof_callback, obj); + return obj; +} + +void linphone_local_player_destroy(LinphonePlayer *obj) { + ms_media_player_free((MSMediaPlayer *)obj->impl); + ms_free(obj); +} + +bool_t linphone_local_player_matroska_supported(void) { + return ms_media_player_matroska_supported(); +} + +static int _local_player_open(LinphonePlayer *obj, const char *filename) { + return ms_media_player_open((MSMediaPlayer *)obj->impl, filename) ? 0 : -1; +} + +static int _local_player_start(LinphonePlayer *obj) { + return ms_media_player_start((MSMediaPlayer *)obj->impl) ? 0 : -1; +} + +static int _local_player_pause(LinphonePlayer *obj) { + ms_media_player_pause((MSMediaPlayer *)obj->impl); + return 0; +} + +static int _local_player_seek(LinphonePlayer *obj, int time_ms) { + return ms_media_player_seek((MSMediaPlayer *)obj->impl, time_ms) ? 0 : -1; +} + +static MSPlayerState _local_player_get_state(LinphonePlayer *obj) { + return ms_media_player_get_state((MSMediaPlayer *)obj->impl); +} + +static int _local_player_get_duration(LinphonePlayer *obj) { + return ms_media_player_get_duration((MSMediaPlayer *)obj->impl); +} + +static int _local_player_get_current_position(LinphonePlayer *obj) { + return ms_media_player_get_current_position((MSMediaPlayer *)obj->impl); +} + +static void _local_player_close(LinphonePlayer *obj) { + ms_media_player_close((MSMediaPlayer *)obj->impl); +} + +static void _local_player_eof_callback(void *user_data) { + LinphonePlayer *obj = (LinphonePlayer *)user_data; + obj->cb(obj, obj->user_data); +} diff --git a/mediastreamer2 b/mediastreamer2 index 2054fd609..38b219a95 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2054fd60911b585458b62d52092894a5d1b59503 +Subproject commit 38b219a95a5ecdf2ed52594c6aadcf0a78c880f5 diff --git a/tester/player_tester.c b/tester/player_tester.c index 7c37a95de..14bb6d3ab 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -59,7 +59,7 @@ static void play_file(const char *filename, bool_t unsupported_format) { CU_ASSERT_PTR_NOT_NULL(lc_manager); if(lc_manager == NULL) return; - player = linphone_core_create_file_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), _get_default_video_renderer(), NULL); + player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), _get_default_video_renderer(), NULL); CU_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; @@ -79,12 +79,12 @@ static void play_file(const char *filename, bool_t unsupported_format) { linphone_player_close(player); fail: - if(player) linphone_file_player_destroy(player); + if(player) linphone_local_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()); + play_file("sounds/hello_opus_h264.mkv", !linphone_local_player_matroska_supported()); } test_t player_tests[] = {