From 401128331335ce4f089385a153bbb2adc32f49c1 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 19 Apr 2017 14:50:15 +0200 Subject: [PATCH] Add linphone_video_definition_clone(). --- coreapi/factory.c | 4 ++-- coreapi/video_definition.c | 3 +++ include/linphone/video_definition.h | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/coreapi/factory.c b/coreapi/factory.c index 3ec5a770c..5601a620b 100644 --- a/coreapi/factory.c +++ b/coreapi/factory.c @@ -206,7 +206,7 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item); if (linphone_video_definition_equals(svdef, searched_vdef)) { linphone_video_definition_unref(searched_vdef); - return svdef; + return linphone_video_definition_clone(svdef); } } @@ -220,7 +220,7 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_na for (item = supported; item != NULL; item = bctbx_list_next(item)) { LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item); if (strcmp(linphone_video_definition_get_name(svdef), name) == 0) { - return svdef; + return linphone_video_definition_clone(svdef); } } return NULL; diff --git a/coreapi/video_definition.c b/coreapi/video_definition.c index ee68b76d1..57329d154 100644 --- a/coreapi/video_definition.c +++ b/coreapi/video_definition.c @@ -66,6 +66,9 @@ void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void vdef->user_data = ud; } +LinphoneVideoDefinition * linphone_video_definition_clone(const LinphoneVideoDefinition *vdef) { + return linphone_video_definition_new(linphone_video_definition_get_width(vdef), linphone_video_definition_get_height(vdef), linphone_video_definition_get_name(vdef)); +} unsigned int linphone_video_definition_get_width(const LinphoneVideoDefinition *vdef) { return vdef->width; diff --git a/include/linphone/video_definition.h b/include/linphone/video_definition.h index 5d5bb6220..c89b545d7 100644 --- a/include/linphone/video_definition.h +++ b/include/linphone/video_definition.h @@ -61,6 +61,13 @@ LINPHONE_PUBLIC void *linphone_video_definition_get_user_data(const LinphoneVide **/ LINPHONE_PUBLIC void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void *ud); +/** + * Clone a video definition. + * @param[in] vdef LinphoneVideoDefinition object to be cloned + * @return The new clone of the video definition + */ +LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_video_definition_clone(const LinphoneVideoDefinition *vdef); + /** * Get the width of the video definition. * @param[in] vdef LinphoneVideoDefinition object