Commit 40a82f05 authored by François Grisez's avatar François Grisez

Rename fileplayer.c into localplayer.c

parent 08539a08
......@@ -62,7 +62,7 @@ liblinphone_la_SOURCES=\
call_log.c \
call_params.c \
player.c \
fileplayer.c \
localplayer.c \
$(GITVERSION_FILE)
if BUILD_UPNP
......
......@@ -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.
......
......@@ -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);
}
......@@ -18,79 +18,79 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "private.h"
#include <mediastreamer2/fileplayer.h>
#include <mediastreamer2/msmediaplayer.h>
#include <mediastreamer2/mssndcard.h>
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) {
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_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);
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_file_player_destroy(LinphonePlayer *obj) {
ms_file_player_free((MSFilePlayer *)obj->impl);
void linphone_local_player_destroy(LinphonePlayer *obj) {
ms_media_player_free((MSMediaPlayer *)obj->impl);
ms_free(obj);
}
bool_t linphone_file_player_matroska_supported(void) {
return ms_file_player_matroska_supported();
bool_t linphone_local_player_matroska_supported(void) {
return ms_media_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 _local_player_open(LinphonePlayer *obj, const char *filename) {
return ms_media_player_open((MSMediaPlayer *)obj->impl, filename) ? 0 : -1;
}
static int file_player_start(LinphonePlayer *obj) {
return ms_file_player_start((MSFilePlayer *)obj->impl) ? 0 : -1;
static int _local_player_start(LinphonePlayer *obj) {
return ms_media_player_start((MSMediaPlayer *)obj->impl) ? 0 : -1;
}
static int file_player_pause(LinphonePlayer *obj) {
ms_file_player_pause((MSFilePlayer *)obj->impl);
static int _local_player_pause(LinphonePlayer *obj) {
ms_media_player_pause((MSMediaPlayer *)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 int _local_player_seek(LinphonePlayer *obj, int time_ms) {
return ms_media_player_seek((MSMediaPlayer *)obj->impl, time_ms) ? 0 : -1;
}
static MSPlayerState file_player_get_state(LinphonePlayer *obj) {
return ms_file_player_get_state((MSFilePlayer *)obj->impl);
static MSPlayerState _local_player_get_state(LinphonePlayer *obj) {
return ms_media_player_get_state((MSMediaPlayer *)obj->impl);
}
static int file_player_get_duration(LinphonePlayer *obj) {
return ms_file_player_get_duration((MSFilePlayer *)obj->impl);
static int _local_player_get_duration(LinphonePlayer *obj) {
return ms_media_player_get_duration((MSMediaPlayer *)obj->impl);
}
static int file_player_get_current_position(LinphonePlayer *obj) {
return ms_file_player_get_current_position((MSFilePlayer *)obj->impl);
static int _local_player_get_current_position(LinphonePlayer *obj) {
return ms_media_player_get_current_position((MSMediaPlayer *)obj->impl);
}
static void file_player_close(LinphonePlayer *obj) {
ms_file_player_close((MSFilePlayer *)obj->impl);
static void _local_player_close(LinphonePlayer *obj) {
ms_media_player_close((MSMediaPlayer *)obj->impl);
}
static void file_player_eof_callback(void *user_data) {
static void _local_player_eof_callback(void *user_data) {
LinphonePlayer *obj = (LinphonePlayer *)user_data;
obj->cb(obj, obj->user_data);
}
mediastreamer2 @ 38b219a9
Subproject commit 2054fd60911b585458b62d52092894a5d1b59503
Subproject commit 38b219a95a5ecdf2ed52594c6aadcf0a78c880f5
......@@ -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[] = {
......
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