From 2f47ffacd3adb311a585d24084317de60497d705 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 20 Oct 2014 11:05:27 +0200 Subject: [PATCH] Change file transfer progression indication to have the number of bytes sent/received and the total. --- coreapi/chat.c | 2 +- coreapi/linphonecore.c | 4 ++-- coreapi/linphonecore.h | 6 +++--- coreapi/private.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index cbdacd7aa..3f00d291c 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -75,7 +75,7 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl LinphoneChatMessage* chatMsg=(LinphoneChatMessage *)data; LinphoneCore *lc = chatMsg->chat_room->lc; /* call back given by application level */ - linphone_core_notify_file_transfer_progress_indication(lc, chatMsg, chatMsg->file_transfer_information, (size_t)(((double)offset/(double)total)*100.0)); + linphone_core_notify_file_transfer_progress_indication(lc, chatMsg, chatMsg->file_transfer_information, offset, total); return; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5f794718f..a6aed5269 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6979,8 +6979,8 @@ void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessa void linphone_core_notify_file_transfer_send(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size) { NOTIFY_IF_EXIST(file_transfer_send)(lc,message,content,buff,size); } -void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t progress) { - NOTIFY_IF_EXIST(file_transfer_progress_indication)(lc,message,content,progress); +void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total) { + NOTIFY_IF_EXIST(file_transfer_progress_indication)(lc,message,content,offset,total); } void linphone_core_notify_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) { NOTIFY_IF_EXIST(is_composing_received)(lc,room); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index cd72701d7..06fcb8e1a 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1603,10 +1603,10 @@ typedef void (*LinphoneCoreFileTransferSendCb)(LinphoneCore *lc, LinphoneChatMes * @param lc #LinphoneCore object * @param message #LinphoneChatMessage message from which the body is received. * @param content #LinphoneContent incoming content information - * @param progress number of bytes sent/received from the begening of the transfer. - * + * @param offset The number of bytes sent/received since the beginning of the transfer. + * @param total The total number of bytes to be sent/received. */ -typedef void (*LinphoneCoreFileTransferProgressIndicationCb)(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t progress); +typedef void (*LinphoneCoreFileTransferProgressIndicationCb)(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total); /** * Is composing notification callback prototype. diff --git a/coreapi/private.h b/coreapi/private.h index bc0ff038c..bb021c27c 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1007,7 +1007,7 @@ void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRo void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message); void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size); void linphone_core_notify_file_transfer_send(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size); -void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t progress); +void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total); void linphone_core_notify_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room); void linphone_core_notify_dtmf_received(LinphoneCore* lc, LinphoneCall *call, int dtmf); /*