- Timestamp:
- Dec 3, 2013 10:45:36 AM (11 years ago)
- Location:
- pjproject/branches/projects/pjsua2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/pjsua2.i
r4668 r4669 75 75 %template(AudioMediaVector) std::vector<pj::AudioMedia*>; 76 76 %template(MediaFormatVector) std::vector<pj::MediaFormat*>; 77 %template(AudioDevInfoVector) std::vector<AudioDevInfo*>; 77 %template(AudioDevInfoVector) std::vector<AudioDevInfo*>; 78 %template(CodecInfoVector) std::vector<pj::CodecInfo*>; 78 79 79 80 %include "pjsua2/media.hpp" -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/endpoint.hpp
r4668 r4669 1007 1007 AudDevManager &audDevManager(); 1008 1008 1009 /************************************************************************* 1010 * Codec management operations 1011 */ 1012 1013 /** 1014 * Enum all supported codecs in the system. 1015 * 1016 * @return Array of codec info. 1017 */ 1018 const CodecInfoVector &codecEnum() throw(Error); 1019 1020 /** 1021 * Change codec priority. 1022 * 1023 * @param codec_id Codec ID, which is a string that uniquely identify 1024 * the codec (such as "speex/8000"). 1025 * @param priority Codec priority, 0-255, where zero means to disable 1026 * the codec. 1027 * 1028 */ 1029 void codecSetPriority(const string &codec_id, 1030 pj_uint8_t priority) throw(Error); 1031 1032 /** 1033 * Get codec parameters. 1034 * 1035 * @param codec_id Codec ID. 1036 * 1037 * @return Codec parameters. If codec is not found, Error 1038 * will be thrown. 1039 * 1040 */ 1041 CodecParam codecGetParam(const string &codec_id) const throw(Error); 1042 1043 /** 1044 * Set codec parameters. 1045 * 1046 * @param codec_id Codec ID. 1047 * @param param Codec parameter to set. Set to NULL to reset 1048 * codec parameter to library default settings. 1049 * 1050 */ 1051 void codecSetParam(const string &codec_id, 1052 const CodecParam param) throw(Error); 1053 1054 1009 1055 public: 1010 1056 /* … … 1075 1121 AudioMediaVector mediaList; 1076 1122 AudDevManager audioDevMgr; 1123 CodecInfoVector codecInfoList; 1077 1124 1078 1125 /* Endpoint static callbacks */ … … 1197 1244 unsigned flags); 1198 1245 1246 private: 1247 void clearCodecInfoList(); 1248 1199 1249 }; 1200 1250 -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/media.hpp
r4668 r4669 276 276 * the media port from the conference bridge and Endpoint's media list. 277 277 * Descendant should only call this method if it has registered the media 278 * with the previous call to #registerMediaPort().278 * with the previous call to registerMediaPort(). 279 279 */ 280 280 void unregisterMediaPort(); … … 432 432 433 433 /** 434 * Device capabilities, as bitmask combination of #pjmedia_aud_dev_cap.434 * Device capabilities, as bitmask combination of pjmedia_aud_dev_cap. 435 435 */ 436 436 unsigned caps; … … 438 438 /** 439 439 * Supported audio device routes, as bitmask combination of 440 * #pjmedia_aud_dev_route. The value may be zero if the device440 * pjmedia_aud_dev_route. The value may be zero if the device 441 441 * does not support audio routing. 442 442 */ … … 562 562 * Check whether the sound device is currently active. The sound device 563 563 * may be inactive if the application has set the auto close feature to 564 * non-zero (the sndAutoCloseTime setting in #MediaConfig), or564 * non-zero (the sndAutoCloseTime setting in MediaConfig), or 565 565 * if null sound device or no sound device has been configured via the 566 * #setNoDev() function.566 * setNoDev() function. 567 567 */ 568 568 bool sndIsActive() const; … … 1054 1054 }; 1055 1055 1056 /************************************************************************* 1057 * Codec management 1058 */ 1059 1060 /** 1061 * This structure describes codec information. 1062 */ 1063 struct CodecInfo 1064 { 1065 /** 1066 * Codec unique identification. 1067 */ 1068 string codecId; 1069 1070 /** 1071 * Codec priority (integer 0-255). 1072 */ 1073 pj_uint8_t priority; 1074 1075 /** 1076 * Codec description. 1077 */ 1078 string desc; 1079 1080 /** 1081 * Construct from pjsua_codec_info. 1082 */ 1083 void fromPj(const pjsua_codec_info &codec_info); 1084 }; 1085 1086 /** Array of codec info */ 1087 typedef std::vector<CodecInfo*> CodecInfoVector; 1088 1089 /** 1090 * Codec parameters, corresponds to pjmedia_codec_param or 1091 * pjmedia_vid_codec_param. 1092 */ 1093 typedef void *CodecParam; 1094 1056 1095 } // namespace pj 1057 1096 -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/endpoint.cpp
r4668 r4669 32 32 #define MAX_STUN_SERVERS 32 33 33 #define TIMER_SIGNATURE 0x600D878A 34 #define MAX_CODEC_NUM 64 34 35 35 36 struct UserTimer … … 376 377 } 377 378 379 clearCodecInfoList(); 380 378 381 instance_ = NULL; 379 382 } … … 1365 1368 return audioDevMgr; 1366 1369 } 1370 1371 /* 1372 * Codec operations. 1373 */ 1374 const CodecInfoVector &Endpoint::codecEnum() throw(Error) 1375 { 1376 pjsua_codec_info pj_codec[MAX_CODEC_NUM]; 1377 unsigned count = 0; 1378 1379 PJSUA2_CHECK_EXPR( pjsua_enum_codecs(pj_codec, &count) ); 1380 1381 clearCodecInfoList(); 1382 1383 pj_enter_critical_section(); 1384 for (unsigned i=0;(i<count && i<MAX_CODEC_NUM);++i) { 1385 CodecInfo *codec_info = new CodecInfo; 1386 1387 codec_info->fromPj(pj_codec[i]); 1388 codecInfoList.push_back(codec_info); 1389 } 1390 pj_leave_critical_section(); 1391 return codecInfoList; 1392 } 1393 1394 void Endpoint::codecSetPriority(const string &codec_id, 1395 pj_uint8_t priority) throw(Error) 1396 { 1397 pj_str_t codec_str = str2Pj(codec_id); 1398 PJSUA2_CHECK_EXPR( pjsua_codec_set_priority(&codec_str, priority) ); 1399 } 1400 1401 CodecParam Endpoint::codecGetParam(const string &codec_id) const throw(Error) 1402 { 1403 pjmedia_codec_param *pj_param = NULL; 1404 pj_str_t codec_str = str2Pj(codec_id); 1405 1406 PJSUA2_CHECK_EXPR( pjsua_codec_get_param(&codec_str, pj_param) ); 1407 1408 return pj_param; 1409 } 1410 1411 void Endpoint::codecSetParam(const string &codec_id, 1412 const CodecParam param) throw(Error) 1413 { 1414 pj_str_t codec_str = str2Pj(codec_id); 1415 pjmedia_codec_param *pj_param = (pjmedia_codec_param*)param; 1416 1417 PJSUA2_CHECK_EXPR( pjsua_codec_set_param(&codec_str, pj_param) ); 1418 } 1419 1420 void Endpoint::clearCodecInfoList() 1421 { 1422 pj_enter_critical_section(); 1423 for (unsigned i=0;i<codecInfoList.size();++i) { 1424 delete codecInfoList[i]; 1425 } 1426 codecInfoList.clear(); 1427 pj_leave_critical_section(); 1428 } -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/media.cpp
r4668 r4669 386 386 unsigned count; 387 387 388 PJSUA2_CHECK_EXPR( pjsua_enum_aud_devs(pj_info, &count) ); 389 388 390 clearAudioDevList(); 389 391 390 PJSUA2_CHECK_EXPR( pjsua_enum_aud_devs(pj_info, &count) ); 391 392 pj_enter_critical_section(); 392 393 for (unsigned i = 0; (i<count && i<MAX_DEV_COUNT) ;++i) { 393 394 AudioDevInfo *dev_info = new AudioDevInfo; … … 395 396 audioDevList.push_back(dev_info); 396 397 } 398 pj_leave_critical_section(); 397 399 return audioDevList; 398 400 } … … 691 693 void AudDevManager::clearAudioDevList() 692 694 { 695 pj_enter_critical_section(); 693 696 for(unsigned i=0;i<audioDevList.size();++i) { 694 697 delete audioDevList[i]; 695 698 } 696 699 audioDevList.clear(); 700 pj_leave_critical_section(); 697 701 } 698 702 … … 704 708 return is_capture?capture_dev:playback_dev; 705 709 } 710 711 /////////////////////////////////////////////////////////////////////////////// 712 void CodecInfo::fromPj(const pjsua_codec_info &codec_info) 713 { 714 codecId = pj2Str(codec_info.codec_id); 715 priority = codec_info.priority; 716 desc = pj2Str(codec_info.desc); 717 }
Note: See TracChangeset
for help on using the changeset viewer.