From f89751515fdff8f89da1c51c5ca7a70bca68025f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 7 Oct 2014 13:52:18 +0200 Subject: [PATCH] Add two getter the the LinphonePlayer interface --- coreapi/fileplayer.c | 12 ++++++++++++ coreapi/linphonecore.h | 2 ++ coreapi/player.c | 18 ++++++++++++++++++ coreapi/private.h | 2 ++ mediastreamer2 | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/coreapi/fileplayer.c b/coreapi/fileplayer.c index 6752dc9e1..505ce2297 100644 --- a/coreapi/fileplayer.c +++ b/coreapi/fileplayer.c @@ -7,6 +7,8 @@ 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); @@ -20,6 +22,8 @@ LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *sn 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; @@ -55,6 +59,14 @@ 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); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 041e8756e..7b4f7d791 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -592,6 +592,8 @@ int linphone_player_start(LinphonePlayer *obj); int linphone_player_pause(LinphonePlayer *obj); int linphone_player_seek(LinphonePlayer *obj, int time_ms); MSPlayerState linphone_player_get_state(LinphonePlayer *obj); +int linphone_player_get_duration(LinphonePlayer *obj); +int linphone_player_get_position(LinphonePlayer *obj); void linphone_player_close(LinphonePlayer *obj); /** diff --git a/coreapi/player.c b/coreapi/player.c index ed9d4095f..ef5233a34 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -71,6 +71,24 @@ MSPlayerState linphone_player_get_state(LinphonePlayer *obj){ return obj->get_state(obj); } +/** + * Get the duration of the media + * @param obj the player + * @return The duration in milliseconds + */ +int linphone_player_get_duration(LinphonePlayer *obj) { + return obj->get_duration(obj); +} + +/** + * Get the position of the playback + * @param obj the player + * @return Position of the playback in milliseconds + */ +int linphone_player_get_position(LinphonePlayer *obj) { + return obj->get_position(obj); +} + /** * Close the player. * @param obj the player. diff --git a/coreapi/private.h b/coreapi/private.h index 936c7d3e8..40777e207 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -920,6 +920,8 @@ struct _LinphonePlayer{ int (*pause)(struct _LinphonePlayer* player); int (*seek)(struct _LinphonePlayer* player, int time_ms); MSPlayerState (*get_state)(struct _LinphonePlayer* player); + int (*get_duration)(struct _LinphonePlayer *player); + int (*get_position)(struct _LinphonePlayer *player); void (*close)(struct _LinphonePlayer* player); LinphonePlayerEofCallback cb; void *user_data; diff --git a/mediastreamer2 b/mediastreamer2 index 548ccf41f..636c6b928 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 548ccf41fa0d3cd3ab48d0eff44d3bed45083312 +Subproject commit 636c6b928d696cf8943653548351a5b8524491e9