Add API to know Call audio/video codec

This commit is contained in:
Yann Diorcet 2012-04-25 14:58:57 +02:00
parent edad295e05
commit ea6dd35f76
4 changed files with 24 additions and 6 deletions

View file

@ -770,6 +770,14 @@ void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
cp->has_video=enabled;
}
const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) {
return cp->audio_codec;
}
const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) {
return cp->video_codec;
}
/**
* Returns whether video is enabled.
**/
@ -1146,6 +1154,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
bool_t use_ec;
if (used_pt!=-1){
call->current_params.audio_codec = rtp_profile_get_payload(call->audio_profile, used_pt);
if (playcard==NULL) {
ms_warning("No card defined for playback !");
}
@ -1262,6 +1271,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
if (used_pt!=-1){
call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt);
VideoStreamDir dir=VideoStreamSendRecv;
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
@ -1333,6 +1343,10 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){
LinphoneCore *lc=call->core;
call->current_params.audio_codec = NULL;
call->current_params.video_codec = NULL;
LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc);
char *cname;
bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc);

View file

@ -183,6 +183,8 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl);
struct _LinphoneCallParams;
typedef struct _LinphoneCallParams LinphoneCallParams;
const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
@ -786,13 +788,13 @@ const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt);
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt);
int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate) ;
int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt);
int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt);
const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);

View file

@ -181,12 +181,12 @@ static void payload_type_set_enable(PayloadType *pt,int value)
else payload_type_unset_flag(pt,PAYLOAD_TYPE_ENABLED);
}
static bool_t payload_type_enabled(PayloadType *pt) {
static bool_t payload_type_enabled(const PayloadType *pt) {
return (((pt)->flags & PAYLOAD_TYPE_ENABLED)!=0);
}
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, PayloadType *pt){
if (ms_list_find(lc->codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt)){
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt){
if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt)){
return payload_type_enabled(pt);
}
ms_error("Getting enablement status of codec not in audio or video list of PayloadType !");
@ -202,7 +202,7 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t
return -1;
}
int linphone_core_get_payload_type_number(LinphoneCore *lc, PayloadType *pt){
int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt){
return payload_type_get_number(pt);
}

View file

@ -68,6 +68,8 @@ struct _LinphoneCallParams{
LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */
int audio_bw; /* bandwidth limit for audio stream */
LinphoneMediaEncryption media_encryption;
PayloadType *audio_codec;
PayloadType *video_codec;
bool_t has_video;
bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/
bool_t in_conference; /*in conference mode */