Changeset 795:653a07331dfa in mediastreamer2
- Timestamp:
- Dec 16, 2009 2:41:27 PM (3 years ago)
- Branch:
- default
- Location:
- linphone
- Files:
-
- 9 edited
-
console/linphonec.c (modified) (1 diff)
-
coreapi/help/Doxyfile.in (modified) (1 diff)
-
coreapi/help/Makefile.am (modified) (1 diff)
-
coreapi/help/doxygen.dox.in (modified) (3 diffs)
-
coreapi/linphonecore.c (modified) (26 diffs)
-
coreapi/linphonecore.h (modified) (4 diffs)
-
coreapi/private.h (modified) (1 diff)
-
gtk-glade/main.c (modified) (1 diff)
-
po/fr.po (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
linphone/console/linphonec.c
r794 r795 613 613 * Initialize linphone core 614 614 */ 615 linphonec=linphone_core_new (&linphonec_vtable, configfile_name, 615 linphonec=linphone_core_new (&linphonec_vtable, configfile_name, NULL, 616 616 NULL); 617 617 linphone_core_enable_video(linphonec,vcap_enabled,display_enabled); -
linphone/coreapi/help/Doxyfile.in
r793 r795 86 86 *.c \ 87 87 *.dox 88 RECURSIVE = YES88 RECURSIVE = NO 89 89 EXCLUDE = 90 90 EXCLUDE_SYMLINKS = NO -
linphone/coreapi/help/Makefile.am
r793 r795 3 3 4 4 SOURCES=$(top_srcdir)/coreapi/*.h 5 5 6 6 7 #html doc -
linphone/coreapi/help/doxygen.dox.in
r793 r795 1 1 /** 2 2 * @mainpage 3 * Project Website: http://savannah.gnu.org/projects/linphone4 3 * 5 * @verbinclude README 6 * 7 */ 8 9 /** 10 * @defgroup liblinphone liblinphone library - high level library for building SIP applications 11 * @brief liblinphone Version @LINPHONE_VERSION@ 12 * 13 * @see http://savannah.gnu.org/projects/linphone 4 * @see http://www.linphone.org 14 5 * 15 6 * @section what_is_it What is liblinphone … … 28 19 * (contact@belledonne-communications.com) 29 20 * 30 * 21 * 22 **/ 31 23 32 24 /** … … 36 28 37 29 30 /** 31 * @defgroup initializing Initialization and destruction 32 * 33 **/ 34 35 /** 36 * @defgroup media_parameters Controlling media parameters 37 **/ 38 39 /** 40 * @defgroup misc Miscenalleous: logs, version strings 41 **/ -
linphone/coreapi/linphonecore.c
r793 r795 163 163 } 164 164 165 static void set_call_log_date(LinphoneCallLog *cl, const struct tm *loctime){ 166 my_strftime(cl->start_date,sizeof(cl->start_date),"%c",loctime); 167 } 168 165 169 LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ 166 170 LinphoneCallLog *cl=ms_new0(LinphoneCallLog,1); … … 172 176 localtime_r(&call->start_time,&loctime); 173 177 #endif 174 my_strftime(cl->start_date,sizeof(cl->start_date),"%c",&loctime);178 set_call_log_date(cl,&loctime); 175 179 cl->from=from; 176 180 cl->to=to; 177 181 return cl; 178 182 } 183 184 static void call_logs_write_to_config_file(LinphoneCore *lc){ 185 MSList *elem; 186 char logsection[32]; 187 int i; 188 char *tmp; 189 LpConfig *cfg=lc->config; 190 191 if (!lc->ready) return; 192 193 for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){ 194 LinphoneCallLog *cl=(LinphoneCallLog*)elem->data; 195 snprintf(logsection,sizeof(logsection),"call_log_%i",i); 196 lp_config_set_int(cfg,logsection,"dir",cl->dir); 197 lp_config_set_int(cfg,logsection,"status",cl->status); 198 tmp=linphone_address_as_string(cl->from); 199 lp_config_set_string(cfg,logsection,"from",tmp); 200 ms_free(tmp); 201 tmp=linphone_address_as_string(cl->to); 202 lp_config_set_string(cfg,logsection,"to",tmp); 203 ms_free(tmp); 204 lp_config_set_string(cfg,logsection,"start_date",cl->start_date); 205 lp_config_set_int(cfg,logsection,"duration",cl->duration); 206 if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey); 207 } 208 for(;i<lc->max_call_logs;++i){ 209 snprintf(logsection,sizeof(logsection),"call_log_%i",i); 210 lp_config_clean_section(cfg,logsection); 211 } 212 } 213 214 static void call_logs_read_from_config_file(LinphoneCore *lc){ 215 char logsection[32]; 216 int i; 217 const char *tmp; 218 LpConfig *cfg=lc->config; 219 for(i=0;;++i){ 220 snprintf(logsection,sizeof(logsection),"call_log_%i",i); 221 if (lp_config_has_section(cfg,logsection)){ 222 LinphoneCallLog *cl=ms_new0(LinphoneCallLog,1); 223 cl->dir=lp_config_get_int(cfg,logsection,"dir",0); 224 cl->status=lp_config_get_int(cfg,logsection,"status",0); 225 tmp=lp_config_get_string(cfg,logsection,"from",NULL); 226 if (tmp) cl->from=linphone_address_new(tmp); 227 tmp=lp_config_get_string(cfg,logsection,"to",NULL); 228 if (tmp) cl->to=linphone_address_new(tmp); 229 tmp=lp_config_get_string(cfg,logsection,"start_date",NULL); 230 if (tmp) strncpy(cl->start_date,tmp,sizeof(cl->start_date)); 231 cl->duration=lp_config_get_int(cfg,logsection,"duration",0); 232 tmp=lp_config_get_string(cfg,logsection,"refkey",NULL); 233 if (tmp) cl->refkey=ms_strdup(tmp); 234 lc->call_logs=ms_list_append(lc->call_logs,cl); 235 }else break; 236 } 237 } 238 239 179 240 void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call){ 180 241 LinphoneCore *lc=call->core; 242 181 243 calllog->duration=time(NULL)-call->start_time; 182 244 switch(call->state){ … … 211 273 lc->vtable.call_log_updated(lc,calllog); 212 274 } 275 call_logs_write_to_config_file(lc); 213 276 } 214 277 … … 252 315 } 253 316 317 /** 318 * Associate a persistent reference key to the call log. 319 * 320 * The reference key can be for example an id to an external database. 321 * It is stored in the config file, thus can survive to process exits/restarts. 322 * 323 **/ 324 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey){ 325 if (cl->refkey!=NULL){ 326 ms_free(cl->refkey); 327 cl->refkey=NULL; 328 } 329 if (refkey) cl->refkey=ms_strdup(refkey); 330 call_logs_write_to_config_file(cl->lc); 331 } 332 333 /** 334 * Get the persistent reference key associated to the call log. 335 * 336 * The reference key can be for example an id to an external database. 337 * It is stored in the config file, thus can survive to process exits/restarts. 338 * 339 **/ 340 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl){ 341 return cl->refkey; 342 } 343 254 344 void linphone_call_log_destroy(LinphoneCallLog *cl){ 255 if (cl->from!=NULL) osip_free(cl->from); 256 if (cl->to!=NULL) osip_free(cl->to); 345 if (cl->from!=NULL) linphone_address_destroy(cl->from); 346 if (cl->to!=NULL) linphone_address_destroy(cl->to); 347 if (cl->refkey!=NULL) ms_free(cl->refkey); 257 348 ms_free(cl); 258 349 } … … 308 399 } 309 400 310 401 /** 402 * Enable logs in supplied FILE*. 403 * 404 * @ingroup misc 405 * 406 * @param file a C FILE* where to fprintf logs. If null stdout is used. 407 * 408 **/ 311 409 void linphone_core_enable_logs(FILE *file){ 312 410 if (file==NULL) file=stdout; … … 316 414 } 317 415 416 /** 417 * Enable logs through the user's supplied log callback. 418 * 419 * @ingroup misc 420 * 421 * @param logfunc The address of a OrtpLogFunc callback whose protoype is 422 * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); 423 * 424 **/ 318 425 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){ 319 426 ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); … … 322 429 } 323 430 431 /** 432 * Entirely disable logging. 433 * 434 * @ingroup misc 435 **/ 324 436 void linphone_core_disable_logs(){ 325 437 int tl; … … 329 441 330 442 331 void443 static void 332 444 net_config_read (LinphoneCore *lc) 333 445 { … … 369 481 } 370 482 371 void sound_config_read(LinphoneCore *lc)483 static void sound_config_read(LinphoneCore *lc) 372 484 { 373 485 /*int tmp;*/ … … 441 553 } 442 554 443 void sip_config_read(LinphoneCore *lc)555 static void sip_config_read(LinphoneCore *lc) 444 556 { 445 557 char *contact; … … 516 628 } 517 629 518 void rtp_config_read(LinphoneCore *lc)630 static void rtp_config_read(LinphoneCore *lc) 519 631 { 520 632 int port; … … 536 648 537 649 538 PayloadType * get_codec(LpConfig *config, char* type,int index){650 static PayloadType * get_codec(LpConfig *config, char* type,int index){ 539 651 char codeckey[50]; 540 652 const char *mime,*fmtp; … … 559 671 } 560 672 561 void codecs_config_read(LinphoneCore *lc)673 static void codecs_config_read(LinphoneCore *lc) 562 674 { 563 675 int i; … … 580 692 } 581 693 582 void video_config_read(LinphoneCore *lc)694 static void video_config_read(LinphoneCore *lc) 583 695 { 584 696 int capture, display; … … 616 728 } 617 729 618 void ui_config_read(LinphoneCore *lc)730 static void ui_config_read(LinphoneCore *lc) 619 731 { 620 732 LinphoneFriend *lf; … … 623 735 linphone_core_add_friend(lc,lf); 624 736 } 625 626 } 627 628 void autoreplier_config_init(LinphoneCore *lc) 737 call_logs_read_from_config_file(lc); 738 } 739 740 /* 741 static void autoreplier_config_init(LinphoneCore *lc) 629 742 { 630 743 autoreplier_config_t *config=&lc->autoreplier_conf; … … 636 749 config->message=lp_config_get_string(lc->config,"autoreplier","message",NULL); 637 750 } 638 751 */ 752 753 /** 754 * Sets maximum available download bandwidth 755 * 756 * @ingroup media_parameters 757 * 758 * This is IP bandwidth, in kbit/s. 759 * This information is used signaled to other parties during 760 * calls (within SDP messages) so that the remote end can have 761 * sufficient knowledge to properly configure its audio & video 762 * codec output bitrate to not overflow available bandwidth. 763 * 764 * @param lc the LinphoneCore object 765 * @param bw the bandwidth in kbits/s, 0 for infinite 766 */ 639 767 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw){ 640 768 lc->net_conf.download_bw=bw; … … 648 776 } 649 777 778 /** 779 * Sets maximum available upload bandwidth 780 * 781 * @ingroup media_parameters 782 * 783 * This is IP bandwidth, in kbit/s. 784 * This information is used by liblinphone together with remote 785 * side available bandwidth signaled in SDP messages to properly 786 * configure audio & video codec's output bitrate. 787 * 788 * @param lc the LinphoneCore object 789 * @param bw the bandwidth in kbits/s, 0 for infinite 790 */ 650 791 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){ 651 792 lc->net_conf.upload_bw=bw; … … 659 800 } 660 801 802 /** 803 * Retrieve the maximum available download bandwidth. 804 * 805 * @ingroup media_parameters 806 * 807 * This value was set by linphone_core_set_download_bandwidth(). 808 * 809 **/ 661 810 int linphone_core_get_download_bandwidth(const LinphoneCore *lc){ 662 811 return lc->net_conf.download_bw; 663 812 } 664 813 814 /** 815 * Retrieve the maximum available upload bandwidth. 816 * 817 * @ingroup media_parameters 818 * 819 * This value was set by linphone_core_set_upload_bandwidth(). 820 * 821 **/ 665 822 int linphone_core_get_upload_bandwidth(const LinphoneCore *lc){ 666 823 return lc->net_conf.upload_bw; 667 824 } 668 825 826 /** 827 * Returns liblinphone's version as a string. 828 * 829 * @ingroup misc 830 * 831 **/ 669 832 const char * linphone_core_get_version(void){ 670 833 return liblinphone_version; … … 688 851 } 689 852 690 void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, void * userdata) 853 static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, 854 const char *factory_config_path, void * userdata) 691 855 { 692 856 memset (lc, 0, sizeof (LinphoneCore)); … … 733 897 734 898 lc->config=lp_config_new(config_path); 899 if (factory_config_path) 900 lp_config_read_file(lc->config,factory_config_path); 735 901 736 902 #ifdef VINCENT_MAURY_RSVP … … 757 923 } 758 924 925 /** 926 * Instanciates a LinphoneCore object. 927 * @ingroup initializing 928 * 929 * The LinphoneCore object is the primary handle for doing all phone actions. 930 * It should be unique within your application. 931 * @param vtable a LinphoneCoreVTable structure holding your application callbacks 932 * @param config_path a path to a config file. If it does not exists it will be created. 933 * The config file is used to store all user settings, call logs, friends, proxies... 934 * @param factory_config_path a path to a read-only config file that can be used to 935 * to store hard-coded preference such as proxy settings or internal preferences. 936 * The settings in this factory file always override the one in the normal config file. 937 * It is OPTIONAL, use NULL if unneeded. 938 * @param userdata an opaque user pointer that can be retrieved at any time (for example in 939 * callbacks) using linphone_core_get_user_data(). 940 * 941 **/ 759 942 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, 760 const char *config_path, void * userdata)943 const char *config_path, const char *factory_config_path, void * userdata) 761 944 { 762 945 LinphoneCore *core=ms_new(LinphoneCore,1); 763 linphone_core_init(core,vtable,config_path, userdata);946 linphone_core_init(core,vtable,config_path, factory_config_path, userdata); 764 947 return core; 765 948 } 766 949 950 /** 951 * Returns the list of available audio codecs. 952 * 953 * This list is unmodifiable. The ->data field of the MSList points a PayloadType 954 * structure holding the codec information. 955 * It is possible to make copy of the list with ms_list_copy() in order to modify it 956 * (such as the order of codecs). 957 **/ 767 958 const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc) 768 959 { … … 770 961 } 771 962 963 /** 964 * Returns the list of available video codecs. 965 * 966 * This list is unmodifiable. The ->data field of the MSList points a PayloadType 967 * structure holding the codec information. 968 * It is possible to make copy of the list with ms_list_copy() in order to modify it 969 * (such as the order of codecs). 970 **/ 772 971 const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc) 773 972 { … … 1275 1474 return FALSE; 1276 1475 } 1476 linphone_address_set_display_name(uri,NULL); 1277 1477 linphone_address_set_username(uri,url); 1278 1478 if (real_parsed_url!=NULL) *real_parsed_url=uri; … … 2349 2549 } 2350 2550 2551 void linphone_core_clear_call_logs(LinphoneCore *lc){ 2552 lc->missed_calls=0; 2553 ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_destroy); 2554 lc->call_logs=ms_list_free(lc->call_logs); 2555 } 2556 2351 2557 static void toggle_video_preview(LinphoneCore *lc, bool_t val){ 2352 2558 #ifdef VIDEO_ENABLED … … 2735 2941 } 2736 2942 2737 void linphone_core_uninit(LinphoneCore *lc)2943 static void linphone_core_uninit(LinphoneCore *lc) 2738 2944 { 2739 2945 if (lc->call){ -
linphone/coreapi/linphonecore.h
r793 r795 189 189 char start_date[128]; 190 190 int duration; 191 char *refkey; 191 192 void *user_pointer; 193 struct _LinphoneCore *lc; 192 194 } LinphoneCallLog; 193 195 … … 197 199 void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up); 198 200 void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl); 201 void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey); 202 const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl); 199 203 char * linphone_call_log_to_str(LinphoneCallLog *cl); 200 204 … … 549 553 550 554 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, 551 const char *config_path, void* userdata);555 const char *config_path, const char *factory_config, void* userdata); 552 556 553 557 /* function to be periodically called in a main loop */ … … 730 734 /* returns a list of LinphoneCallLog */ 731 735 const MSList * linphone_core_get_call_logs(LinphoneCore *lc); 736 void linphone_core_clear_call_logs(LinphoneCore *lc); 732 737 733 738 /* video support */ -
linphone/coreapi/private.h
r793 r795 191 191 int linphone_core_get_local_ip_for(const char *dest, char *result); 192 192 193 void linphone_core_init(LinphoneCore *lc, const LinphoneCoreVTable *vtable,194 const char *config_path, void * userdata);195 void linphone_core_uninit(LinphoneCore *lc);196 197 193 #endif /* _PRIVATE_H */ -
linphone/gtk-glade/main.c
r783 r795 161 161 static void linphone_gtk_init_liblinphone(const char *file){ 162 162 linphone_core_set_user_agent("Linphone", LINPHONE_VERSION); 163 the_core=linphone_core_new(&vtable,file,NULL );163 the_core=linphone_core_new(&vtable,file,NULL,NULL); 164 164 linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL); 165 165 } -
linphone/po/fr.po
r733 r795 1028 1028 "Duration: %i mn %i sec\n" 1029 1029 msgstr "" 1030 "%s le %s De: %s\n"1030 "%s le %s\nDe: %s\n" 1031 1031 "A destination de: %s\n" 1032 1032 "Etat: %s\n"
Note: See TracChangeset
for help on using the changeset viewer.
