Commit 4a13ac6a authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Use real pointer for C++ object inside LinphoneCallParams as it is a ClonableObject.

parent a5ce479a
......@@ -70,7 +70,6 @@ set(LINPHONE_SOURCE_FILES_C
buffer.c
callbacks.c
call_log.c
call_params.c
carddav.c
chat.c
chat_file_transfer.c
......
......@@ -179,7 +179,7 @@ int linphone_call_log_get_duration(LinphoneCallLog *cl){
return cl->duration;
}
LinphoneAddress *linphone_call_log_get_from_address(LinphoneCallLog *cl){
const LinphoneAddress *linphone_call_log_get_from_address(LinphoneCallLog *cl){
return cl->from;
}
......@@ -211,7 +211,7 @@ LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog *cl){
return cl->status;
}
LinphoneAddress *linphone_call_log_get_to_address(LinphoneCallLog *cl){
const LinphoneAddress *linphone_call_log_get_to_address(LinphoneCallLog *cl){
return cl->to;
}
......
......@@ -191,9 +191,9 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t,
LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc, const LinphoneAddress *addr) {
LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom);
if (linphone_core_realtime_text_enabled(lc))
cr->cr = new LinphonePrivate::RealTimeTextChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address));
cr->cr = new LinphonePrivate::RealTimeTextChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address));
else
cr->cr = new LinphonePrivate::BasicChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address));
cr->cr = new LinphonePrivate::BasicChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address));
L_GET_PRIVATE(cr->cr)->setCBackPointer(cr);
return cr;
}
......@@ -257,9 +257,20 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd
}
LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, bctbx_list_t *addresses) {
const char *factoryUri = linphone_core_get_chat_conference_factory_uri(lc);
if (!factoryUri)
return nullptr;
LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom);
LinphoneAddress *factoryAddr = linphone_address_new(factoryUri);
LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(lc, factoryAddr);
linphone_address_unref(factoryAddr);
std::string from;
if (proxy)
from = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address, Address)->asString();
if (from.empty())
from = linphone_core_get_primary_contact(lc);
LinphonePrivate::Address me(from);
std::list<LinphonePrivate::Address> l = L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(addresses, Address);
LinphonePrivate::Address me; // TODO
cr->cr = new LinphonePrivate::ClientGroupChatRoom(lc, me, l);
L_GET_PRIVATE(cr->cr)->setCBackPointer(cr);
return cr;
......
......@@ -45,7 +45,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// For migration purpose.
#include "address/address-p.h"
#include "c-wrapper/c-private-types.h"
#include "c-wrapper/c-tools.h"
#include "call/call.h"
#include "call/call-p.h"
......@@ -289,7 +288,9 @@ LinphoneCall * linphone_call_new_outgoing(LinphoneCore *lc, const LinphoneAddres
call->paramsCache = linphone_call_params_new_for_wrapper();
call->remoteParamsCache = linphone_call_params_new_for_wrapper();
call->remoteAddressCache = linphone_address_new(nullptr);
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing, *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address), cfg, nullptr, linphone_call_params_get_cpp_obj(params));
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing,
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address),
cfg, nullptr, L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams));
return call;
}
......@@ -299,7 +300,9 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const LinphoneAddres
call->paramsCache = linphone_call_params_new_for_wrapper();
call->remoteParamsCache = linphone_call_params_new_for_wrapper();
call->remoteAddressCache = linphone_address_new(nullptr);
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming, *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address), nullptr, op, nullptr);
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming,
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address),
nullptr, op, nullptr);
L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->initiateIncoming();
return call;
}
......@@ -453,20 +456,20 @@ void linphone_call_unref(LinphoneCall *obj){
}
const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
call->currentParamsCache->msp = linphone_call_get_cpp_obj(call)->getCurrentParams();
L_SET_CPP_PTR_FROM_C_STRUCT(call->currentParamsCache, linphone_call_get_cpp_obj(call)->getCurrentParams());
return call->currentParamsCache;
}
const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call) {
call->remoteParamsCache->msp = linphone_call_get_cpp_obj(call)->getRemoteParams();
if (call->remoteParamsCache->msp)
return call->remoteParamsCache;
return nullptr;
const LinphonePrivate::MediaSessionParams *remoteParams = linphone_call_get_cpp_obj(call)->getRemoteParams();
if (!remoteParams)
return nullptr;
L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteParamsCache, remoteParams);
return call->remoteParamsCache;
}
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call) {
std::shared_ptr<LinphonePrivate::Address> addr = std::make_shared<LinphonePrivate::Address>(linphone_call_get_cpp_obj(call)->getRemoteAddress());
L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteAddressCache, addr);
L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteAddressCache, &linphone_call_get_cpp_obj(call)->getRemoteAddress());
return call->remoteAddressCache;
}
......@@ -1071,7 +1074,7 @@ void _linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams
}
const LinphoneCallParams * linphone_call_get_params(LinphoneCall *call) {
call->paramsCache->msp = linphone_call_get_cpp_obj(call)->getParams();
L_SET_CPP_PTR_FROM_C_STRUCT(call->paramsCache, linphone_call_get_cpp_obj(call)->getParams());
return call->paramsCache;
}
......@@ -1281,7 +1284,7 @@ LinphoneStatus linphone_call_accept(LinphoneCall *call) {
}
LinphoneStatus linphone_call_accept_with_params(LinphoneCall *call, const LinphoneCallParams *params) {
return linphone_call_get_cpp_obj(call)->accept(params ? linphone_call_params_get_cpp_obj(params) : nullptr);
return linphone_call_get_cpp_obj(call)->accept(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
}
LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) {
......@@ -1289,11 +1292,11 @@ LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) {
}
LinphoneStatus linphone_call_accept_early_media_with_params(LinphoneCall *call, const LinphoneCallParams *params) {
return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? linphone_call_params_get_cpp_obj(params) : nullptr);
return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
}
LinphoneStatus linphone_call_update(LinphoneCall *call, const LinphoneCallParams *params) {
return linphone_call_get_cpp_obj(call)->update(params ? linphone_call_params_get_cpp_obj(params) : nullptr);
return linphone_call_get_cpp_obj(call)->update(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
}
int linphone_call_start_update(LinphoneCall *call) {
......@@ -1324,7 +1327,7 @@ int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next
}
LinphoneStatus linphone_call_accept_update(LinphoneCall *call, const LinphoneCallParams *params) {
return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? linphone_call_params_get_cpp_obj(params) : nullptr);
return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
}
LinphoneStatus linphone_call_transfer(LinphoneCall *call, const char *refer_to) {
......
......@@ -3359,7 +3359,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
ret=bctbx_list_append(ret,sal_address_new(local_route));
}
if (srv_route){
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address)->getInternalAddress()));
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address, Address)->getInternalAddress()));
}
if (ret==NULL){
/*if the proxy address matches the domain part of the destination, then use the same transport
......@@ -5918,7 +5918,7 @@ void friends_config_uninit(LinphoneCore* lc)
ms_message("Destroying friends done.");
}
LpConfig * linphone_core_get_config(LinphoneCore *lc){
LpConfig * linphone_core_get_config(const LinphoneCore *lc){
return lc->config;
}
......@@ -6671,7 +6671,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
}
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
linphone_call_params_get_cpp_obj(params)->initDefault(lc);
L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams)->initDefault(lc);
}
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
......@@ -7085,6 +7085,14 @@ LinphoneConference *linphone_core_get_conference(LinphoneCore *lc) {
return lc->conf_ctx;
}
void linphone_core_set_chat_conference_factory_uri(LinphoneCore *lc, const char *uri) {
lp_config_set_string(linphone_core_get_config(lc), "misc", "chat_conference_factory_uri", uri);
}
const char * linphone_core_get_chat_conference_factory_uri(const LinphoneCore *lc) {
return lp_config_get_string(linphone_core_get_config(lc), "misc", "chat_conference_factory_uri", nullptr);
}
void linphone_core_set_tls_cert(LinphoneCore *lc, const char *tls_cert) {
if (lc->tls_cert) {
ms_free(lc->tls_cert);
......
......@@ -500,7 +500,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
linphone_configure_op(cfg->lc, cfg->op, cfg->identity_address, cfg->sent_headers, FALSE);
if ((contact=guess_contact_for_register(cfg))) {
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress());
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address, Address)->getInternalAddress());
linphone_address_unref(contact);
}
......@@ -511,7 +511,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
proxy_string,
cfg->reg_identity,
cfg->expires,
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address)->getInternalAddress() : NULL
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address, Address)->getInternalAddress() : NULL
)==0) {
if (cfg->pending_contact) {
linphone_address_unref(cfg->pending_contact);
......@@ -1393,7 +1393,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
bool_t destroy_route_addr = FALSE;
if (linphone_proxy_config_get_service_route(cfg)) {
route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress();
route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address, Address)->getInternalAddress();
} else if (linphone_proxy_config_get_route(cfg)) {
addr=linphone_proxy_config_get_route(cfg);
} else if(linphone_proxy_config_get_addr(cfg)) {
......
......@@ -62,7 +62,7 @@ LINPHONE_PUBLIC int linphone_call_log_get_duration(LinphoneCallLog *cl);
* @param[in] cl LinphoneCallLog object
* @return The origin address (ie from) of the call.
**/
LINPHONE_PUBLIC LinphoneAddress * linphone_call_log_get_from_address(LinphoneCallLog *cl);
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_log_get_from_address(LinphoneCallLog *cl);
/**
* Get the RTP statistics computed locally regarding the call.
......@@ -123,7 +123,7 @@ LINPHONE_PUBLIC LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog
* @param[in] cl LinphoneCallLog object
* @return The destination address (ie to) of the call.
**/
LINPHONE_PUBLIC LinphoneAddress * linphone_call_log_get_to_address(LinphoneCallLog *cl);
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_log_get_to_address(LinphoneCallLog *cl);
/**
* Associate a persistent reference key to the call log.
......
......@@ -3908,7 +3908,7 @@ LINPHONE_PUBLIC void linphone_core_set_user_data(LinphoneCore *lc, void *userdat
* sections and pairs of key=value in the configuration file.
* @ingroup misc
**/
LINPHONE_PUBLIC LinphoneConfig * linphone_core_get_config(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneConfig * linphone_core_get_config(const LinphoneCore *lc);
/**
* Create a LpConfig object from a user config file.
......@@ -4187,6 +4187,10 @@ LINPHONE_PUBLIC LinphoneStatus linphone_core_stop_conference_recording(LinphoneC
*/
LINPHONE_PUBLIC LinphoneConference *linphone_core_get_conference(LinphoneCore *lc);
void linphone_core_set_chat_conference_factory_uri(LinphoneCore *lc, const char *uri);
const char * linphone_core_get_chat_conference_factory_uri(const LinphoneCore *lc);
/**
* @}
*/
......
......@@ -23,7 +23,6 @@
set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
address/address-p.h
address/address.h
c-wrapper/c-private-types.h
c-wrapper/c-tools.h
call/call-listener.h
call/call-p.h
......@@ -98,6 +97,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
address/address.cpp
c-wrapper/api/c-address.cpp
c-wrapper/api/c-call-params.cpp
c-wrapper/api/c-event-log.cpp
call/call.cpp
chat/basic-chat-room.cpp
......
......@@ -26,7 +26,7 @@
using namespace std;
L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, address);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, Address, address);
LinphoneAddress *linphone_address_new (const char *address) {
LINPHONE_NAMESPACE::Address *cppPtr = new LINPHONE_NAMESPACE::Address(L_C_TO_STRING(address));
......
/*
* c-private-types.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _C_PRIVATE_TYPES_H_
#define _C_PRIVATE_TYPES_H_
#include <memory>
#include "conference/params/media-session-params.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif
// =============================================================================
// C Structures.
// =============================================================================
struct _LinphoneCallParams{
belle_sip_object_t base;
void *user_data;
std::shared_ptr<LinphonePrivate::MediaSessionParams> msp;
};
#ifdef __cplusplus
}
#endif
#endif // ifndef _C_PRIVATE_TYPES_H_
......@@ -40,6 +40,7 @@ private:
template<typename T>
struct WrappedClonableObject {
belle_sip_object_t base;
void *userData;
T *cppPtr;
};
......@@ -101,6 +102,16 @@ public:
static_cast<WrappedObject<T> *>(object)->cppPtr = cppPtr;
}
template<typename T>
static inline void setCppPtrFromC (void *object, T *cppPtr) {
L_ASSERT(object);
T *tPtr = reinterpret_cast<T *>(static_cast<WrappedClonableObject<T> *>(object)->cppPtr);
if (tPtr != cppPtr) {
delete tPtr;
static_cast<WrappedClonableObject<T> *>(object)->cppPtr = new T(*cppPtr);
}
}
template<typename T>
static T *getCppPtr (const std::shared_ptr<T> &cppPtr) {
return cppPtr.get();
......@@ -173,24 +184,25 @@ LINPHONE_END_NAMESPACE
FALSE \
);
#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(STRUCT, C_NAME) \
struct _Linphone ## STRUCT { \
#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(CPP_CLASS, C_STRUCT, C_NAME) \
struct _Linphone ## C_STRUCT { \
belle_sip_object_t base; \
LINPHONE_NAMESPACE::STRUCT *cppPtr; \
void *userData; \
LINPHONE_NAMESPACE::CPP_CLASS *cppPtr; \
}; \
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## STRUCT); \
static Linphone ## STRUCT *_linphone_ ## C_NAME ## _init() { \
return belle_sip_object_new(Linphone ## STRUCT); \
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## C_STRUCT); \
static Linphone ## C_STRUCT *_linphone_ ## C_NAME ## _init() { \
return belle_sip_object_new(Linphone ## C_STRUCT); \
} \
static void _linphone_ ## C_NAME ## _uninit(Linphone ## STRUCT * object) { \
static void _linphone_ ## C_NAME ## _uninit(Linphone ## C_STRUCT * object) { \
delete object->cppPtr; \
} \
static void _linphone_ ## C_NAME ## _clone(Linphone ## STRUCT * dest, const Linphone ## STRUCT * src) { \
static void _linphone_ ## C_NAME ## _clone(Linphone ## C_STRUCT * dest, const Linphone ## C_STRUCT * src) { \
L_ASSERT(src->cppPtr); \
dest->cppPtr = new LINPHONE_NAMESPACE::STRUCT(*src->cppPtr); \
dest->cppPtr = new LINPHONE_NAMESPACE::CPP_CLASS(*src->cppPtr); \
} \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## STRUCT); \
BELLE_SIP_INSTANCIATE_VPTR(Linphone ## STRUCT, belle_sip_object_t, \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## C_STRUCT); \
BELLE_SIP_INSTANCIATE_VPTR(Linphone ## C_STRUCT, belle_sip_object_t, \
_linphone_ ## C_NAME ## _uninit, \
_linphone_ ## C_NAME ## _clone, \
NULL, \
......@@ -207,8 +219,8 @@ LINPHONE_END_NAMESPACE
#define L_STRING_TO_C(STR) ((STR).empty() ? NULL : (STR).c_str())
#define L_C_TO_STRING(STR) ((STR) == NULL ? std::string() : (STR))
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC<LINPHONE_NAMESPACE::TYPE, Linphone ## TYPE>(OBJECT)
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC<LINPHONE_NAMESPACE::CPP_TYPE, Linphone ## C_TYPE>(OBJECT)
#define L_SET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
......@@ -216,9 +228,9 @@ LINPHONE_END_NAMESPACE
#define L_GET_PRIVATE(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, TYPE) \
#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
L_GET_PRIVATE(LINPHONE_NAMESPACE::Wrapper::getCppPtr( \
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
))
#define L_GET_C_LIST_FROM_CPP_LIST(LIST, TYPE) \
......
......@@ -39,7 +39,7 @@ LINPHONE_BEGIN_NAMESPACE
class CallPrivate : public ObjectPrivate, CallListener {
public:
CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const std::shared_ptr<MediaSessionParams> msp);
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp);
virtual ~CallPrivate ();
void initiateIncoming ();
......
......@@ -35,7 +35,7 @@ LINPHONE_BEGIN_NAMESPACE
// =============================================================================
CallPrivate::CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const shared_ptr<MediaSessionParams> msp) : lcall(call), core(core) {
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : lcall(call), core(core) {
nextVideoFrameDecoded._func = nullptr;
nextVideoFrameDecoded._user_data = nullptr;
}
......@@ -189,7 +189,7 @@ void CallPrivate::onResetFirstVideoFrameDecoded () {
// =============================================================================
Call::Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const shared_ptr<MediaSessionParams> msp) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) {
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) {
L_D(Call);
const Address *myAddress = (direction == LinphoneCallIncoming) ? &to : &from;
string confType = lp_config_get_string(linphone_core_get_config(core), "misc", "conference_type", "local");
......@@ -205,17 +205,17 @@ Call::Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, c
// -----------------------------------------------------------------------------
LinphoneStatus Call::accept (const shared_ptr<MediaSessionParams> msp) {
LinphoneStatus Call::accept (const MediaSessionParams *msp) {
L_D(Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->accept(msp);
}
LinphoneStatus Call::acceptEarlyMedia (const std::shared_ptr<MediaSessionParams> msp) {
LinphoneStatus Call::acceptEarlyMedia (const MediaSessionParams *msp) {
L_D(Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->acceptEarlyMedia(msp);
}
LinphoneStatus Call::acceptUpdate (const shared_ptr<MediaSessionParams> msp) {
LinphoneStatus Call::acceptUpdate (const MediaSessionParams *msp) {
L_D(Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->acceptUpdate(msp);
}
......@@ -270,7 +270,7 @@ LinphoneStatus Call::terminate (const LinphoneErrorInfo *ei) {
return d->getActiveSession()->terminate(ei);
}
LinphoneStatus Call::update (const std::shared_ptr<MediaSessionParams> msp) {
LinphoneStatus Call::update (const MediaSessionParams *msp) {
L_D(Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->update(msp);
}
......@@ -342,7 +342,7 @@ LinphoneCore * Call::getCore () const {
return d->core;
}
const shared_ptr<MediaSessionParams> Call::getCurrentParams () const {
const MediaSessionParams * Call::getCurrentParams () const {
L_D(const Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->getCurrentParams();
}
......@@ -392,7 +392,7 @@ void * Call::getNativeVideoWindowId () const {
return static_cast<const MediaSession *>(d->getActiveSession().get())->getNativeVideoWindowId();
}
const std::shared_ptr<MediaSessionParams> Call::getParams () const {
const MediaSessionParams * Call::getParams () const {
L_D(const Call);
return static_cast<const MediaSession *>(d->getActiveSession().get())->getMediaParams();
}
......@@ -427,7 +427,7 @@ string Call::getRemoteContact () const {
return d->getActiveSession()->getRemoteContact();
}
const shared_ptr<MediaSessionParams> Call::getRemoteParams () const {
const MediaSessionParams * Call::getRemoteParams () const {
L_D(const Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->getRemoteParams();
}
......
......@@ -19,8 +19,6 @@
#ifndef _CALL_CALL_H_
#define _CALL_CALL_H_
#include <memory>
#include "linphone/types.h"
#include "object/object.h"
......@@ -42,11 +40,11 @@ class Call : public Object {
public:
Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const std::shared_ptr<MediaSessionParams> msp);
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp);
LinphoneStatus accept (const std::shared_ptr<MediaSessionParams> msp = nullptr);
LinphoneStatus acceptEarlyMedia (const std::shared_ptr<MediaSessionParams> msp = nullptr);
LinphoneStatus acceptUpdate (const std::shared_ptr<MediaSessionParams> msp);
LinphoneStatus accept (const MediaSessionParams *msp = nullptr);
LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr);
LinphoneStatus acceptUpdate (const MediaSessionParams *msp);
LinphoneStatus decline (LinphoneReason reason);
LinphoneStatus decline (const LinphoneErrorInfo *ei);
LinphoneStatus pause ();
......@@ -57,7 +55,7 @@ public:
LinphoneStatus takePreviewSnapshot (const std::string& file);
LinphoneStatus takeVideoSnapshot (const std::string& file);
LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr);
LinphoneStatus update (const std::shared_ptr<MediaSessionParams> msp = nullptr);
LinphoneStatus update (const MediaSessionParams *msp = nullptr);
void zoomVideo (float zoomFactor, float *cx, float *cy);
bool cameraEnabled () const;
......@@ -72,7 +70,7 @@ public:
bool getAuthenticationTokenVerified () const;
float getAverageQuality () const;
LinphoneCore * getCore () const;
const std::shared_ptr<MediaSessionParams> getCurrentParams () const;
const MediaSessionParams * getCurrentParams () const;
float getCurrentQuality () const;
LinphoneCallDir getDirection () const;
int getDuration () const;
......@@ -82,14 +80,14 @@ public:
RtpTransport * getMetaRtpTransport (int streamIndex);
float getMicrophoneVolumeGain () const;
void * getNativeVideoWindowId () const;
const std::shared_ptr<MediaSessionParams> getParams () const;
const MediaSessionParams * getParams () const;
float getPlayVolume () const;
LinphoneReason getReason () const;
float getRecordVolume () const;
const Address& getRemoteAddress () const;
std::string getRemoteAddressAsString () const;
std::string getRemoteContact () const;
const std::shared_ptr<MediaSessionParams> getRemoteParams () const;
const MediaSessionParams * getRemoteParams () const;
float getSpeakerVolumeGain () const;
LinphoneCallState getState () const;
LinphoneCallStats * getStats (LinphoneStreamType type) const;
......
......@@ -35,12 +35,12 @@ BasicChatRoom::BasicChatRoom (LinphoneCore *core, const Address &peerAddress) :
// -----------------------------------------------------------------------------
shared_ptr<Participant> BasicChatRoom::addParticipant (const Address &addr, const shared_ptr<CallSessionParams> params, bool hasMedia) {
shared_ptr<Participant> BasicChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
lError() << "addParticipant() is not allowed on a BasicChatRoom";
return nullptr;
}
void BasicChatRoom::addParticipants (const list<Address> &addresses, const shared_ptr<CallSessionParams> params, bool hasMedia) {
void BasicChatRoom::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
lError() << "addParticipants() is not allowed on a BasicChatRoom";
}
......
......@@ -39,8 +39,8 @@ public:
virtual ~BasicChatRoom () = default;
/* ConferenceInterface */
std::shared_ptr<Participant> addParticipant (const Address &addr, const std::shared_ptr<CallSessionParams> params, bool hasMedia);
void addParticipants (const std::list<Address> &addresses, const std::shared_ptr<CallSessionParams> params, bool hasMedia);
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia);
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia);
const std::string& getId () const;
int getNbParticipants () const;
std::list<std::shared_ptr<Participant>> getParticipants () const;
......