diff --git a/coreapi/call_params.c b/coreapi/call_params.c index a2a378eef..b2eea131a 100644 --- a/coreapi/call_params.c +++ b/coreapi/call_params.c @@ -33,6 +33,28 @@ SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) { return SalProtoRtpAvp; } +static SalStreamDir sal_dir_from_call_params_dir(LinphoneCallParamsMediaDirection cpdir) { + switch (cpdir) { + default: + case LinphoneCallParamsMediaDirectionInactive: + return SalStreamInactive; + case LinphoneCallParamsMediaDirectionSendOnly: + return SalStreamSendOnly; + case LinphoneCallParamsMediaDirectionRecvOnly: + return SalStreamRecvOnly; + case LinphoneCallParamsMediaDirectionSendRecv: + return SalStreamSendRecv; + } +} + +SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params) { + return sal_dir_from_call_params_dir(linphone_call_params_get_audio_direction(params)); +} + +SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params) { + return sal_dir_from_call_params_dir(linphone_call_params_get_video_direction(params)); +} + /******************************************************************************* * Public functions * diff --git a/coreapi/call_params.h b/coreapi/call_params.h index c3362534e..8d728c22c 100644 --- a/coreapi/call_params.h +++ b/coreapi/call_params.h @@ -280,14 +280,14 @@ LINPHONE_PUBLIC LinphoneCallParamsMediaDirection linphone_call_params_get_video * @param[in] cl LinphoneCallParams object * @param[in] The audio stream direction associated with this call params. **/ -/*LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/ +LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir); /** * Set the video stream direction. Only relevant for multicast * @param[in] cl LinphoneCallParams object * @param[in] The video stream direction associated with this call params. **/ -/*LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/ +LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir); /******************************************************************************* diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ec0dd70b6..4f8b9d7e7 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -612,6 +612,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * md->streams[0].rtp_port=call->media_ports[0].rtp_port; md->streams[0].rtcp_port=call->media_ports[0].rtcp_port; md->streams[0].proto=get_proto_from_call_params(call->params); + md->streams[0].dir=get_audio_dir_from_call_params(call->params); md->streams[0].type=SalAudio; if (call->params->down_ptime) md->streams[0].ptime=call->params->down_ptime; @@ -640,6 +641,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * md->streams[1].rtp_port=call->media_ports[1].rtp_port; md->streams[1].rtcp_port=call->media_ports[1].rtcp_port; md->streams[1].proto=md->streams[0].proto; + md->streams[1].dir=get_video_dir_from_call_params(call->params); md->streams[1].type=SalVideo; codec_hints.bandwidth_limit=0; codec_hints.max_codecs=-1; diff --git a/coreapi/private.h b/coreapi/private.h index 166448fe8..56ddf2dc8 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -298,6 +298,8 @@ LinphonePlayer *linphone_call_build_player(LinphoneCall*call); LinphoneCallParams * linphone_call_params_new(void); SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params); +SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params); +SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params); void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);