]> sjero.net Git - linphone/commitdiff
Add API to know Call audio/video codec
authorYann Diorcet <yann.diorcet@belledonne-communications.com>
Wed, 25 Apr 2012 12:58:57 +0000 (14:58 +0200)
committerYann Diorcet <yann.diorcet@belledonne-communications.com>
Wed, 25 Apr 2012 13:37:10 +0000 (15:37 +0200)
coreapi/linphonecall.c
coreapi/linphonecore.h
coreapi/misc.c
coreapi/private.h

index d41c6cdadacd5319b18b6f2b133845957de9a052..69f9266a14dce11e1b2a392a4332b26520cebf00 100644 (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);
index a5a1e8c0cf6fd8a570258078a390c60fbea35d64..d3a514a69141e24410f7780a59a94ac472631d14 100644 (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);
 
index 41d4efac8682f79ec682f7a51e278c67ad7809ed..881b88eb6131bd0f28dc555934bb260232b2dd0d 100644 (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);
 }
 
index ec57eaf9cb1e0067644dae3276b24f01a1cfd54c..a790276dd23f714350896cd6c942d6a2af832899 100644 (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 */