From: <sb...@us...> - 2007-09-12 16:55:53
|
Revision: 1122 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1122&view=rev Author: sbalea Date: 2007-09-12 09:55:56 -0700 (Wed, 12 Sep 2007) Log Message: ----------- Video negotiation improvements: - add iaxc_call_ex API, that allows setting of caller ID info and video support on a per-call basis - better handling of audio-only connections - improve handling of the currently selected call not wanting video Patch provided by Erik Bunce Modified Paths: -------------- trunk/lib/iaxclient.h trunk/lib/iaxclient_lib.c trunk/lib/video.c trunk/simpleclient/vtestcall/vtestcall.c Modified: trunk/lib/iaxclient.h =================================================================== --- trunk/lib/iaxclient.h 2007-09-12 14:46:09 UTC (rev 1121) +++ trunk/lib/iaxclient.h 2007-09-12 16:55:56 UTC (rev 1122) @@ -290,6 +290,7 @@ EXPORT int iaxc_start_processing_thread(); EXPORT int iaxc_stop_processing_thread(); EXPORT int iaxc_call(const char * num); +EXPORT int iaxc_call_ex(const char* num, const char* callerid_name, const char* callerid_number, int video); EXPORT int iaxc_unregister( int id ); EXPORT int iaxc_register(const char * user, const char * pass, const char * host); EXPORT void iaxc_send_busy_on_incoming_call(int callNo); Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2007-09-12 14:46:09 UTC (rev 1121) +++ trunk/lib/iaxclient_lib.c 2007-09-12 16:55:56 UTC (rev 1122) @@ -1340,6 +1340,11 @@ EXPORT int iaxc_call(const char * num) { + return iaxc_call_ex(num, NULL, NULL, 1); +} + +EXPORT int iaxc_call_ex(const char *num, const char* callerid_name, const char* callerid_number, int video) +{ int video_format_capability = 0; int video_format_preferred = 0; int callNo = -1; @@ -1391,6 +1396,12 @@ strncpy(calls[callNo].remote, "" , IAXC_EVENT_BUFSIZ); } + if (callerid_number != NULL) + strncpy(calls[callNo].callerid_number, callerid_number, IAXC_EVENT_BUFSIZ); + + if (callerid_name != NULL) + strncpy(calls[callNo].callerid_name, callerid_name, IAXC_EVENT_BUFSIZ); + strncpy(calls[callNo].local , calls[callNo].callerid_name, IAXC_EVENT_BUFSIZ); strncpy(calls[callNo].local_context, "default", IAXC_EVENT_BUFSIZ); @@ -1401,7 +1412,8 @@ calls[callNo].last_ping = calls[callNo].last_activity; #ifdef USE_VIDEO - iaxc_video_format_get_cap(&video_format_preferred, &video_format_capability); + if (video) + iaxc_video_format_get_cap(&video_format_preferred, &video_format_capability); #endif iaxci_usermsg(IAXC_NOTICE, "Originating an %s call", @@ -1665,27 +1677,32 @@ iaxc_video_format_get_cap(&video_format_preferred, &video_format_capability); - /* first, try _their_ preferred format */ - video_format = video_format_capability & - (e->ies.format & IAXC_VIDEO_FORMAT_MASK); + /* first, see if they even want video */ + video_format = (e->ies.format & IAXC_VIDEO_FORMAT_MASK); - if ( !video_format ) + if (video_format) { - /* then, try our preferred format */ - video_format = video_format_preferred & - (e->ies.capability & IAXC_VIDEO_FORMAT_MASK); - } + /* next, try _their_ preferred format */ + video_format &= video_format_capability; - if ( !video_format ) - { - /* finally, see if we have one in common */ - video_format = video_format_capability & - (e->ies.capability & IAXC_VIDEO_FORMAT_MASK); + if ( !video_format ) + { + /* then, try our preferred format */ + video_format = video_format_preferred & + (e->ies.capability & IAXC_VIDEO_FORMAT_MASK); + } - /* now choose amongst these, if we got one */ - if ( video_format ) + if ( !video_format ) { - video_format = iaxc_choose_codec(video_format); + /* finally, see if we have one in common */ + video_format = video_format_capability & + (e->ies.capability & IAXC_VIDEO_FORMAT_MASK); + + /* now choose amongst these, if we got one */ + if ( video_format ) + { + video_format = iaxc_choose_codec(video_format); + } } } Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2007-09-12 14:46:09 UTC (rev 1121) +++ trunk/lib/video.c 2007-09-12 16:55:56 UTC (rev 1122) @@ -448,8 +448,9 @@ // If we don't need to send encoded video to the network or back // to the main application, just return here. - if ( !(iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED) && - (iaxc_video_prefs & IAXC_VIDEO_PREF_SEND_DISABLE) ) + if ( ( !(iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED) && + (iaxc_video_prefs & IAXC_VIDEO_PREF_SEND_DISABLE) ) || + (format == 0) ) { if ( call->vencoder ) { Modified: trunk/simpleclient/vtestcall/vtestcall.c =================================================================== --- trunk/simpleclient/vtestcall/vtestcall.c 2007-09-12 14:46:09 UTC (rev 1121) +++ trunk/simpleclient/vtestcall/vtestcall.c 2007-09-12 16:55:56 UTC (rev 1122) @@ -597,14 +597,10 @@ fflush(stdin); // TODO: Better control on inserted strings fscanf(stdin,"%s",mydest); - // Force to have a A or A/V call - if (mydest[0]=='A') { - iaxc_video_format_set(0, 0, framerate, bitrate, width, height, fragsize); - } - else { - fprintf(stderr,"format_set a %d,%d,%d,%d,%d,%d,%d\n",formatp, format, framerate, bitrate, width, height, fragsize); - iaxc_video_format_set(formatp, format, framerate, bitrate, width, height, fragsize); - } + + fprintf(stderr,"format_set a %d,%d,%d,%d,%d,%d,%d\n",formatp, format, framerate, bitrate, width, height, fragsize); + iaxc_video_format_set(formatp, format, framerate, bitrate, width, height, fragsize); + /* if (iaxc_initialize(Vmode|Amode,MAX_CALLS)) fatal_error("cannot initialize iaxclient!"); @@ -615,7 +611,8 @@ sprintf(caption,"Calling to %s",mydest); my_safe_caption(caption); //iaxc_play_sound(&sound_ringOUT, 1 /* ring device */ ); - iaxc_call(mydest); + // Force to have a A or A/V call + iaxc_call_ex(mydest, NULL, NULL, (mydest[0]!='A')); break; case SDLK_c: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |