Commit f5c41494 authored by Ghislain MARY's avatar Ghislain MARY

Add new LinphoneVideoDefinition object and deprecate API functions handling MSVideoSize structures.

parent be66a259
......@@ -113,6 +113,7 @@ set(LINPHONE_SOURCE_FILES_C
siplogin.c
sipsetup.c
sqlite3_bctbx_vfs.c
video_definition.c
xml2lpc.c
xml.c
xmlrpc.c
......
......@@ -34,6 +34,7 @@ liblinphone_la_SOURCES=\
carddav.h \
call_log.c \
call_params.c \
carddav.c \
chat.c \
chat_file_transfer.c \
conference.cc conference_private.h \
......@@ -46,6 +47,7 @@ liblinphone_la_SOURCES=\
enum.c enum.h \
error_info.c \
event.c \
factory.c \
friend.c \
friendlist.c \
im_notif_policy.c \
......@@ -63,25 +65,24 @@ liblinphone_la_SOURCES=\
misc.c \
nat_policy.c \
offeranswer.c offeranswer.h\
payload_type.c \
player.c \
presence.c \
private.h \
proxy.c \
quality_reporting.c quality_reporting.h\
remote_provisioning.c \
ringtoneplayer.c \
sal.c \
siplogin.c \
sipsetup.c \
sqlite3_bctbx_vfs.c sqlite3_bctbx_vfs.h\
vcard_private.h \
vtables.c \
video_definition.c \
xml2lpc.c xml2lpc.h \
xml.c \
xmlrpc.c \
vtables.c \
carddav.c \
ringtoneplayer.c \
sqlite3_bctbx_vfs.c sqlite3_bctbx_vfs.h\
factory.c \
payload_type.c \
$(GITVERSION_FILE)
if BUILD_UPNP
......
......@@ -193,6 +193,10 @@ MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParam
return cp->recv_vsize;
}
const LinphoneVideoDefinition * linphone_call_params_get_received_video_definition(const LinphoneCallParams *cp) {
return cp->recv_vdef;
}
const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp){
return cp->record_file;
}
......@@ -209,6 +213,10 @@ MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *c
return cp->sent_vsize;
}
const LinphoneVideoDefinition * linphone_call_params_get_sent_video_definition(const LinphoneCallParams *cp) {
return cp->sent_vdef;
}
const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp){
return cp->session_name;
}
......@@ -317,6 +325,8 @@ LinphoneCallParams * linphone_call_params_ref(LinphoneCallParams *cp) {
}
void linphone_call_params_unref(LinphoneCallParams *cp) {
if (cp->sent_vdef != NULL) linphone_video_definition_unref(cp->sent_vdef);
if (cp->recv_vdef != NULL) linphone_video_definition_unref(cp->recv_vdef);
belle_sip_object_unref(cp);
}
......
......@@ -38,6 +38,9 @@ typedef belle_sip_object_t_vptr_t LinphoneFactory_vptr_t;
struct _LinphoneFactory {
belle_sip_object_t base;
bctbx_list_t *supported_video_definitions;
/*these are the directories set by the application*/
char *top_resources_dir;
char *data_resources_dir;
......@@ -56,6 +59,8 @@ struct _LinphoneFactory {
};
static void linphone_factory_uninit(LinphoneFactory *obj){
bctbx_list_free_with_data(obj->supported_video_definitions, (bctbx_list_free_func)linphone_video_definition_unref);
STRING_RESET(obj->top_resources_dir);
STRING_RESET(obj->data_resources_dir);
STRING_RESET(obj->sound_resources_dir);
......@@ -87,9 +92,41 @@ static void _linphone_factory_destroying_cb(void) {
}
}
#define ADD_SUPPORTED_VIDEO_DEFINITION(factory, width, height, name) \
(factory)->supported_video_definitions = bctbx_list_append((factory)->supported_video_definitions, \
linphone_video_definition_ref(linphone_video_definition_new(width, height, name)))
static void initialize_supported_video_definitions(LinphoneFactory *factory) {
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H, "1080p");
#endif
#if !defined(__ANDROID__) && !TARGET_OS_MAC /*limit to most common sizes because mac video API cannot list supported resolutions*/
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H, "uxga");
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H, "sxga-");
#endif
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H, "720p");
#if !defined(__ANDROID__) && !TARGET_OS_MAC
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H, "xga");
#endif
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H, "svga");
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_4CIF_W, MS_VIDEO_SIZE_4CIF_H, "4cif");
#endif
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_VGA_W, MS_VIDEO_SIZE_VGA_H, "vga");
#if TARGET_OS_IPHONE
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_IOS_MEDIUM_H, MS_VIDEO_SIZE_IOS_MEDIUM_W, "ios-medium");
#endif
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_CIF_W, MS_VIDEO_SIZE_CIF_H, "cif");
#if !TARGET_OS_MAC || TARGET_OS_IPHONE /* OS_MAC is 1 for iPhone, but we need QVGA */
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_QVGA_W, MS_VIDEO_SIZE_QVGA_H, "qvga");
#endif
ADD_SUPPORTED_VIDEO_DEFINITION(factory, MS_VIDEO_SIZE_QCIF_W, MS_VIDEO_SIZE_QCIF_H, "qcif");
}
static LinphoneFactory *linphone_factory_new(void){
LinphoneFactory *factory = belle_sip_object_new(LinphoneFactory);
factory->top_resources_dir = bctbx_strdup(PACKAGE_DATA_DIR);
initialize_supported_video_definitions(factory);
return factory;
}
......@@ -141,6 +178,54 @@ LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
return _linphone_vcard_new();
}
LinphoneVideoDefinition * linphone_factory_create_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height) {
return linphone_video_definition_ref(linphone_video_definition_new(width, height, NULL));
}
LinphoneVideoDefinition * linphone_factory_create_video_definition_from_name(const LinphoneFactory *factory, const char *name) {
unsigned int width = 0;
unsigned int height = 0;
LinphoneVideoDefinition *vdef = linphone_factory_find_supported_video_definition_by_name(factory, name);
if (vdef != NULL) return vdef;
if (sscanf(name, "%ux%u", &width, &height) == 2) {
return linphone_video_definition_new(width, height, NULL);
}
return linphone_video_definition_new(0, 0, NULL);
}
const bctbx_list_t * linphone_factory_get_supported_video_definitions(const LinphoneFactory *factory) {
return factory->supported_video_definitions;
}
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height) {
const bctbx_list_t *item;
const bctbx_list_t *supported = linphone_factory_get_supported_video_definitions(factory);
LinphoneVideoDefinition *searched_vdef = linphone_video_definition_new(width, height, NULL);
for (item = supported; item != NULL; item = bctbx_list_next(item)) {
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 searched_vdef;
}
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name) {
const bctbx_list_t *item;
const bctbx_list_t *supported = linphone_factory_get_supported_video_definitions(factory);
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 NULL;
}
const char * linphone_factory_get_top_resources_dir(const LinphoneFactory *factory) {
return factory->top_resources_dir;
}
......
......@@ -1964,6 +1964,10 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
#ifdef VIDEO_ENABLED
VideoStream *vstream;
#endif
if (call->current_params->sent_vdef != NULL) linphone_video_definition_unref(call->current_params->sent_vdef);
call->current_params->sent_vdef = NULL;
if (call->current_params->recv_vdef != NULL) linphone_video_definition_unref(call->current_params->recv_vdef);
call->current_params->recv_vdef = NULL;
MS_VIDEO_SIZE_ASSIGN(call->current_params->sent_vsize, UNKNOWN);
MS_VIDEO_SIZE_ASSIGN(call->current_params->recv_vsize, UNKNOWN);
#ifdef VIDEO_ENABLED
......@@ -1971,6 +1975,10 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
if (vstream != NULL) {
call->current_params->sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params->recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params->sent_vdef = linphone_video_definition_ref(linphone_factory_find_supported_video_definition(
linphone_factory_get(), call->current_params->sent_vsize.width, call->current_params->sent_vsize.height));
call->current_params->recv_vdef = linphone_video_definition_ref(linphone_factory_find_supported_video_definition(
linphone_factory_get(), call->current_params->recv_vsize.width, call->current_params->recv_vsize.height));
call->current_params->sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params->received_fps = video_stream_get_received_framerate(vstream);
}
......
This diff is collapsed.
......@@ -139,8 +139,10 @@ struct _LinphoneCallParams{
PayloadType *audio_codec; /*audio codec currently in use */
PayloadType *video_codec; /*video codec currently in use */
PayloadType *text_codec; /*text codec currently in use */
MSVideoSize sent_vsize; /* Size of the video currently being sent */
MSVideoSize recv_vsize; /* Size of the video currently being received */
MSVideoSize sent_vsize; /* DEPRECATED: Size of the video currently being sent */
MSVideoSize recv_vsize; /* DEPRECATED: Size of the video currently being received */
LinphoneVideoDefinition *sent_vdef; /* Definition of the video currently being sent */
LinphoneVideoDefinition *recv_vdef; /* Definition of the video currrently being received */
float received_fps,sent_fps;
int down_bw;
int up_bw;
......@@ -929,6 +931,8 @@ typedef struct video_config{
const char **cams;
MSVideoSize vsize;
MSVideoSize preview_vsize; /*is 0,0 if no forced preview size is set, in which case vsize field above is used.*/
LinphoneVideoDefinition *vdef;
LinphoneVideoDefinition *preview_vdef;
float fps;
bool_t capture;
bool_t show_local;
......@@ -1783,7 +1787,8 @@ BELLE_SIP_TYPE_ID(LinphoneConferenceParams),
BELLE_SIP_TYPE_ID(LinphoneConference),
BELLE_SIP_TYPE_ID(LinphoneInfoMessage),
BELLE_SIP_TYPE_ID(LinphonePayloadType),
BELLE_SIP_TYPE_ID(LinphoneRange)
BELLE_SIP_TYPE_ID(LinphoneRange),
BELLE_SIP_TYPE_ID(LinphoneVideoDefinition)
BELLE_SIP_DECLARE_TYPES_END
......@@ -1921,6 +1926,21 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneErrorInfo);
void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log);
void linphone_core_report_early_failed_call(LinphoneCore *lc, LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to, LinphoneErrorInfo *ei);
struct _LinphoneVideoDefinition {
belle_sip_object_t base;
void *user_data;
unsigned int width; /**< The width of the video */
unsigned int height; /**< The height of the video */
char *name; /** The name of the video definition */
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneVideoDefinition);
LinphoneVideoDefinition * linphone_video_definition_new(unsigned int width, unsigned int height, const char *name);
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height);
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name);
#ifdef __cplusplus
}
#endif
......
/*
linphone
Copyright (C) 2010-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 2
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/factory.h"
#include "linphone/video_definition.h"
#include "private.h"
static void linphone_video_definition_destroy(LinphoneVideoDefinition *vdef) {
if (vdef->name) bctbx_free(vdef->name);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneVideoDefinition);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneVideoDefinition, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_video_definition_destroy,
NULL, // clone
NULL, // marshal
TRUE
);
LinphoneVideoDefinition * linphone_video_definition_new(unsigned int width, unsigned int height, const char *name) {
LinphoneVideoDefinition *vdef = belle_sip_object_new(LinphoneVideoDefinition);
vdef->width = width;
vdef->height = height;
if (name == NULL) {
vdef->name = bctbx_strdup_printf("%ux%u", width, height);
} else {
vdef->name = bctbx_strdup(name);
}
return vdef;
}
LinphoneVideoDefinition * linphone_video_definition_ref(LinphoneVideoDefinition *vdef) {
belle_sip_object_ref(vdef);
return vdef;
}
void linphone_video_definition_unref(LinphoneVideoDefinition *vdef) {
belle_sip_object_unref(vdef);
}
void *linphone_video_definition_get_user_data(const LinphoneVideoDefinition *vdef) {
return vdef->user_data;
}
void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void *ud) {
vdef->user_data = ud;
}
unsigned int linphone_video_definition_get_width(const LinphoneVideoDefinition *vdef) {
return vdef->width;
}
void linphone_video_definition_set_width(LinphoneVideoDefinition *vdef, unsigned int width) {
vdef->width = width;
}
unsigned int linphone_video_definition_get_height(const LinphoneVideoDefinition *vdef) {
return vdef->height;
}
void linphone_video_definition_set_height(LinphoneVideoDefinition *vdef, unsigned int height) {
vdef->height = height;
}
void linphone_video_definition_set_definition(LinphoneVideoDefinition *vdef, unsigned int width, unsigned int height) {
vdef->width = width;
vdef->height = height;
}
const char * linphone_video_definition_get_name(const LinphoneVideoDefinition *vdef) {
return vdef->name;
}
void linphone_video_definition_set_name(LinphoneVideoDefinition *vdef, const char *name) {
if (vdef->name != NULL) bctbx_free(vdef->name);
vdef->name = bctbx_strdup(name);
}
bool_t linphone_video_definition_equals(const LinphoneVideoDefinition *vdef1, const LinphoneVideoDefinition *vdef2) {
return (((vdef1->width == vdef2->width) && (vdef1->height == vdef2->height))
|| ((vdef1->width == vdef2->height) && (vdef1->height == vdef2->width)));
}
bool_t linphone_video_definition_strict_equals(const LinphoneVideoDefinition *vdef1, const LinphoneVideoDefinition *vdef2) {
return (vdef1->width == vdef2->width) && (vdef1->height == vdef2->height);
}
bool_t linphone_video_definition_is_undefined(const LinphoneVideoDefinition *vdef) {
return (vdef->width == 0) || (vdef->height == 0);
}
......@@ -60,6 +60,7 @@ set(HEADER_FILES
tunnel.h
types.h
vcard.h
video_definition.h
wrapper_utils.h
xmlrpc.h
......
......@@ -40,6 +40,7 @@ linphone_include_HEADERS=\
tunnel.h \
types.h \
vcard.h \
video_definition.h \
wrapper_utils.h \
xmlrpc.h \
linphonecore.h \
......
......@@ -132,12 +132,20 @@ LINPHONE_PUBLIC LinphonePrivacyMask linphone_call_params_get_privacy(const Linph
*/
LINPHONE_PUBLIC float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp);
/**
* Get the definition of the received video.
* @param[in] cp LinphoneCallParams object
* @return The received LinphoneVideoDefinition
*/
LINPHONE_PUBLIC const LinphoneVideoDefinition * linphone_call_params_get_received_video_definition(const LinphoneCallParams *cp);
/**
* Get the size of the video that is received.
* @param[in] cp LinphoneCallParams object
* @return The received video size or MS_VIDEO_SIZE_UNKNOWN if not available.
* @deprecated Use linphone_call_params_get_received_video_definition() instead
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
LINPHONE_PUBLIC LINPHONE_DEPRECATED MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
/**
* Get the path for the audio recording of the call.
......@@ -160,12 +168,20 @@ LINPHONE_PUBLIC const char * linphone_call_params_get_rtp_profile(const Linphone
*/
LINPHONE_PUBLIC float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp);
/**
* Get the definition of the sent video.
* @param[in] cp LinphoneCallParams object
* @return The sent LinphoneVideoDefinition
*/
LINPHONE_PUBLIC const LinphoneVideoDefinition * linphone_call_params_get_sent_video_definition(const LinphoneCallParams *cp);
/**
* Gets the size of the video that is sent.
* @param[in] cp LinphoneCalParams object
* @return The sent video size or MS_VIDEO_SIZE_UNKNOWN if not available.
* @deprecated Use linphone_call_params_get_sent_video_definition() instead
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp);
LINPHONE_PUBLIC LINPHONE_DEPRECATED MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp);
/**
* Get the session name of the media session (ie in SDP).
......
......@@ -62,6 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/proxy_config.h"
#include "linphone/ringtoneplayer.h"
#include "linphone/vcard.h"
#include "linphone/video_definition.h"
#include "linphone/xmlrpc.h"
......@@ -2816,7 +2817,7 @@ LINPHONE_PUBLIC void linphone_core_set_ring_during_incoming_early_media(Linphone
/**
* Tells whether the ring play is enabled during an incoming early media call.
* @param[in] lc #LinphoneCore object
* @ingroup media_paramaters
* @ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc);
......@@ -3118,8 +3119,18 @@ LINPHONE_PUBLIC const LinphoneVideoPolicy *linphone_core_get_video_policy(const
/**
* Returns the zero terminated table of supported video resolutions.
* @ingroup media_parameters
* @deprecated Use linphone_factory_get_supported_video_definitions() instead
**/
LINPHONE_PUBLIC const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
LINPHONE_PUBLIC LINPHONE_DEPRECATED const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
/**
* Set the preferred video definition for the stream that is captured and sent to the remote party.
* All standard video definitions are accepted on the receive path.
* @param[in] lc LinphoneCore object
* @param[in] vdef LinphoneVideoDefinition object
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_set_preferred_video_definition(LinphoneCore *lc, LinphoneVideoDefinition *vdef);
/**
* Sets the preferred video size.
......@@ -3127,8 +3138,20 @@ LINPHONE_PUBLIC const MSVideoSizeDef *linphone_core_get_supported_video_sizes(Li
* This applies only to the stream that is captured and sent to the remote party,
* since we accept all standard video size on the receive path.
* @ingroup media_parameters
* @deprecated Use linphone_core_set_preferred_video_definition() instead
**/
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
/**
* Set the video definition for the captured (preview) video.
* This method is for advanced usage where a video capture must be set independently of the definition of the stream actually sent through the call.
* This allows for example to have the preview window in High Definition even if due to bandwidth constraint the sent video definition is small.
* Using this feature increases the CPU consumption, since a rescaling will be done internally.
* @param[in] lc LinphoneCore object
* @param[in] vdef LinphoneVideoDefinition object
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_set_preview_video_definition(LinphoneCore *lc, LinphoneVideoDefinition *vdef);
/**
* Sets the video size for the captured (preview) video.
......@@ -3138,25 +3161,47 @@ LINPHONE_PUBLIC void linphone_core_set_preferred_video_size(LinphoneCore *lc, MS
* @ingroup media_parameters
* @param lc the linphone core
* @param vsize the video resolution choosed for capuring and previewing. It can be (0,0) to not request any specific preview size and let the core optimize the processing.
* @deprecated Use linphone_core_set_preview_video_definition() instead
**/
LINPHONE_PUBLIC void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize);
/**
* Sets the preview video size by its name. See linphone_core_set_preview_video_size() for more information about this feature.
*
* Video resolution names are: qcif, svga, cif, vga, 4cif, svga ...
* @ingroup media_parameters
* @deprecated Use linphone_factory_create_video_definition_from_name() and linphone_core_set_preview_video_definition() instead
**/
LINPHONE_PUBLIC void linphone_core_set_preview_video_size_by_name(LinphoneCore *lc, const char *name);
/**
* Get the definition of the captured video.
* @param[in] lc LinphoneCore object
* @return The captured LinphoneVideoDefinition if it was previously set by linphone_core_set_preview_video_definition(), otherwise a 0x0 LinphoneVideoDefinition.
* @see linphone_core_set_preview_video_definition()
* @ingroup media_parameters
*/
LINPHONE_PUBLIC const LinphoneVideoDefinition * linphone_core_get_preview_video_definition(const LinphoneCore *lc);
/**
* Returns video size for the captured video if it was previously set by linphone_core_set_preview_video_size(), otherwise returns a 0,0 size.
* @see linphone_core_set_preview_video_size()
* @ingroup media_parameters
* @param lc the core
* @return a MSVideoSize
* @deprecated Use linphone_core_get_preview_video_definition() instead
**/
LINPHONE_PUBLIC MSVideoSize linphone_core_get_preview_video_size(const LinphoneCore *lc);
LINPHONE_PUBLIC LINPHONE_DEPRECATED MSVideoSize linphone_core_get_preview_video_size(const LinphoneCore *lc);
/**
* Get the effective video definition provided by the camera for the captured video.
* When preview is disabled or not yet started this function returns a 0x0 video definition.
* @param[in] lc LinphoneCore object
* @return The captured LinphoneVideoDefinition
* @ingroup media_parameters
* @see linphone_core_set_preview_video_definition()
*/
LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_core_get_current_preview_video_definition(const LinphoneCore *lc);
/**
* Returns the effective video size for the captured video as provided by the camera.
......@@ -3165,20 +3210,30 @@ LINPHONE_PUBLIC MSVideoSize linphone_core_get_preview_video_size(const LinphoneC
* @ingroup media_parameters
* @param lc the core
* @return a MSVideoSize
* @deprecated Use linphone_core_get_current_preview_video_definition() instead
**/
LINPHONE_PUBLIC MSVideoSize linphone_core_get_current_preview_video_size(const LinphoneCore *lc);
LINPHONE_PUBLIC LINPHONE_DEPRECATED MSVideoSize linphone_core_get_current_preview_video_size(const LinphoneCore *lc);
/**
* Get the preferred video definition for the stream that is captured and sent to the remote party.
* @param[in] lc LinphoneCore object
* @return The preferred LinphoneVideoDefinition
* @ingroup media_parameters
*/
LINPHONE_PUBLIC const LinphoneVideoDefinition * linphone_core_get_preferred_video_definition(const LinphoneCore *lc);
/**
* Returns the current preferred video size for sending.
*
* @ingroup media_parameters
* @deprecated Use linphone_core_get_preferred_video_definition() instead
**/
LINPHONE_PUBLIC MSVideoSize linphone_core_get_preferred_video_size(const LinphoneCore *lc);
LINPHONE_PUBLIC LINPHONE_DEPRECATED MSVideoSize linphone_core_get_preferred_video_size(const LinphoneCore *lc);
/**
* Get the name of the current preferred video size for sending.
* @param[in] lc #LinphoneCore object.
* @return A string containing the name of the current preferred video size (to be freed with ms_free()).
* @deprecated Use linphone_core_get_preferred_video_defintion() and linphone_video_definition_get_name() instead
*/
LINPHONE_PUBLIC char * linphone_core_get_preferred_video_size_name(const LinphoneCore *lc);
......@@ -3189,6 +3244,7 @@ LINPHONE_PUBLIC char * linphone_core_get_preferred_video_size_name(const Linphon
* that it takes the name of the video resolution as input.
* Video resolution names are: qcif, svga, cif, vga, 4cif, svga ...
* @ingroup media_parameters
* @deprecated Use linphone_factory_create_video_definition_from_name() and linphone_core_set_preferred_video_definition() instead
**/
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
......@@ -4140,7 +4196,7 @@ LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneC
* @see linphone_core_get_supported_file_formats
* @param lc A #LinphoneCore object
* @param fmt The format extension (wav, mkv).
* @ingroup media_paramaters
* @ingroup media_parameters
**/
LINPHONE_PUBLIC bool_t linphone_core_file_format_supported(LinphoneCore *lc, const char *fmt);
......
......@@ -125,6 +125,30 @@ LINPHONE_PUBLIC LinphoneCallCbs * linphone_factory_create_call_cbs(const Linphon
*/
LINPHONE_PUBLIC LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory);
/**
* Create a LinphoneVideoDefinition from a given width and height
* @param[in] factory LinphoneFactory singleton object
* @param[in] width The width of the created video definition
* @param[in] height The height of the created video definition
* @return A new LinphoneVideoDefinition object
*/
LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_factory_create_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height);
/**
* Create a LinphoneVideoDefinition from a given standard definition name
* @param[in] factory LinphoneFactory singleton object
* @param[in] name The standard definition name of the video definition to create
* @return A new LinphoneVideoDefinition object
*/
LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_factory_create_video_definition_from_name(const LinphoneFactory *factory, const char *name);
/**
* Get the list of standard video definitions supported by Linphone.
* @param[in] factory LinphoneFactory singleton object
* @return \bctbx_list{LinphoneVideoDefinition}
*/
LINPHONE_PUBLIC const bctbx_list_t * linphone_factory_get_supported_video_definitions(const LinphoneFactory *factory);
/**
* Get the top directory where the resources are located.
* @param[in] factory LinphoneFactory object
......
......@@ -1105,6 +1105,12 @@ typedef enum _LinphoneUpnpState {
*/
typedef struct _LinphoneVcard LinphoneVcard;
/**
* The LinphoneVideoDefinition object represents a video definition, eg. its width and its height.
* @ingroup media_parameters
*/
typedef struct _LinphoneVideoDefinition LinphoneVideoDefinition;
/**
* Structure describing policy regarding video streams establishments.
* @ingroup media_parameters
......
/*
video_definition.h
Copyright (C) 2010-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 2
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LINPHONE_VIDEO_DEFINITION_H_
#define LINPHONE_VIDEO_DEFINITION_H_
#include "linphone/types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup media_parameters
* @{
*/
/**
* Acquire a reference to the video definition.
* @param[in] vdef LinphoneVideoDefinition object.
* @return The same LinphoneVideoDefinition object.
**/
LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_video_definition_ref(LinphoneVideoDefinition *vdef);
/**
* Release reference to the video definition.
* @param[in] vdef LinphoneVideoDefinition object.
**/
LINPHONE_PUBLIC void linphone_video_definition_unref(LinphoneVideoDefinition *vdef);
/**
* Retrieve the user pointer associated with the video definition.
* @param[in] vdef LinphoneVideoDefinition object.
* @return The user pointer associated with the video definition.
**/
LINPHONE_PUBLIC void *linphone_video_definition_get_user_data(const LinphoneVideoDefinition *vdef);
/**
* Assign a user pointer to the video definition.
* @param[in] vdef LinphoneVideoDefinition object.
* @param[in] ud The user pointer to associate with the video definition.
**/
LINPHONE_PUBLIC void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void *ud);
/**
* Get the width of the video definition.
* @param[in] vdef LinphoneVideoDefinition object
* @return The width of the video definition
*/
LINPHONE_PUBLIC unsigned int linphone_video_definition_get_width(const LinphoneVideoDefinition *vdef);
/**
* Set the width of the video definition.
* @param[in] vdef LinphoneVideoDefinition object
* @param[in] width The width of the video definition
*/
LINPHONE_PUBLIC void linphone_video_definition_set_width(LinphoneVideoDefinition *vdef, unsigned int width);
/**
* Get the height of the video definition.
* @param[in] vdef LinphoneVideoDefinition object
* @return The height of the video definition
*/
LINPHONE_PUBLIC unsigned int linphone_video_definition_get_height(const LinphoneVideoDefinition *vdef);
/**
* Set the height of the video definition.
* @param[in] vdef LinphoneVideoDefinition object
* @param[in] height The height of the video definition
*/