- Timestamp:
- Jul 15, 2011 9:51:46 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/build/Makefile
r3649 r3661 110 110 # 111 111 export PJMEDIA_CODEC_SRCDIR = ../src/pjmedia-codec 112 export PJMEDIA_CODEC_OBJS += ffmpeg_codecs.o \112 export PJMEDIA_CODEC_OBJS += audio_codecs.o ffmpeg_codecs.o \ 113 113 h263_packetizer.o h264_packetizer.o \ 114 114 $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ -
pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia-codec.h
r3392 r3661 26 26 */ 27 27 28 #include <pjmedia-codec/audio_codecs.h> 28 29 #include <pjmedia-codec/l16.h> 29 30 #include <pjmedia-codec/ffmpeg_codecs.h> -
pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/codec.h
r3498 r3661 553 553 pjmedia_codec *codec ); 554 554 555 /** 556 * This callback will be called to deinitialize and destroy this factory. 557 * 558 * @param factory The codec factory. 559 */ 560 pj_status_t (*destroy)(void); 561 555 562 } pjmedia_codec_factory_op; 556 563 … … 724 731 * Unregister codec factory from the codec manager. This will also 725 732 * remove all the codecs registered by the codec factory from the 726 * codec manager's list of supported codecs. 727 * 728 * @param mgr The codec manager instance. Application can get the 729 * instance by calling #pjmedia_endpt_get_codec_mgr(). 733 * codec manager's list of supported codecs. This function should 734 * only be called by the codec implementers and not by application. 735 * 736 * @param mgr The codec manager instance, use 737 * #pjmedia_endpt_get_codec_mgr(). 730 738 * @param factory The codec factory to be unregistered. 731 739 * -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/g722.c
r3250 r3661 123 123 &g722_enum_codecs, 124 124 &g722_alloc_codec, 125 &g722_dealloc_codec 125 &g722_dealloc_codec, 126 &pjmedia_codec_g722_deinit 126 127 }; 127 128 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/g7221.c
r2760 r3661 116 116 &enum_codecs, 117 117 &alloc_codec, 118 &dealloc_codec 118 &dealloc_codec, 119 &pjmedia_codec_g7221_deinit 119 120 }; 120 121 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/gsm.c
r3158 r3661 118 118 &gsm_enum_codecs, 119 119 &gsm_alloc_codec, 120 &gsm_dealloc_codec 120 &gsm_dealloc_codec, 121 &pjmedia_codec_gsm_deinit 121 122 }; 122 123 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ilbc.c
r3362 r3661 114 114 &ilbc_enum_codecs, 115 115 &ilbc_alloc_codec, 116 &ilbc_dealloc_codec 116 &ilbc_dealloc_codec, 117 &pjmedia_codec_ilbc_deinit 117 118 }; 118 119 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ipp_codecs.c
r3517 r3661 104 104 &ipp_enum_codecs, 105 105 &ipp_alloc_codec, 106 &ipp_dealloc_codec 106 &ipp_dealloc_codec, 107 &pjmedia_codec_ipp_deinit 107 108 }; 108 109 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/l16.c
r3146 r3661 113 113 &l16_enum_codecs, 114 114 &l16_alloc_codec, 115 &l16_dealloc_codec 115 &l16_dealloc_codec, 116 &pjmedia_codec_l16_deinit 116 117 }; 117 118 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/passthrough.c
r3165 r3661 99 99 &enum_codecs, 100 100 &alloc_codec, 101 &dealloc_codec 101 &dealloc_codec, 102 &pjmedia_codec_passthrough_deinit 102 103 }; 103 104 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/speex_codec.c
r2394 r3661 100 100 &spx_enum_codecs, 101 101 &spx_alloc_codec, 102 &spx_dealloc_codec 102 &spx_dealloc_codec, 103 &pjmedia_codec_speex_deinit 103 104 }; 104 105 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/codec.c
r3380 r3661 73 73 PJ_DEF(pj_status_t) pjmedia_codec_mgr_destroy (pjmedia_codec_mgr *mgr) 74 74 { 75 pjmedia_codec_factory *factory; 75 76 unsigned i; 76 77 77 78 PJ_ASSERT_RETURN(mgr, PJ_EINVAL); 79 80 /* Destroy all factories in the list */ 81 factory = mgr->factory_list.next; 82 while (factory != &mgr->factory_list) { 83 pjmedia_codec_factory *next = factory->next; 84 (*factory->op->destroy)(); 85 factory = next; 86 } 78 87 79 88 /* Cleanup all pools of all codec default params */ … … 111 120 112 121 PJ_ASSERT_RETURN(mgr && factory, PJ_EINVAL); 122 123 /* Since 2.0 we require codec factory to implement "destroy" op. Please 124 * see: https://trac.pjsip.org/repos/ticket/1294 125 * 126 * Really! Please do see it. 127 */ 128 PJ_ASSERT_RETURN(factory->op->destroy != NULL, PJ_ENOTSUP); 113 129 114 130 /* Enum codecs */ -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/g711.c
r2832 r3661 112 112 &g711_enum_codecs, 113 113 &g711_alloc_codec, 114 &g711_dealloc_codec 114 &g711_dealloc_codec, 115 &pjmedia_codec_g711_deinit 115 116 }; 116 117 -
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/encdec.c
r2394 r3661 239 239 240 240 /* Register all codecs */ 241 #if PJMEDIA_HAS_G711_CODEC 242 CHECK( pjmedia_codec_g711_init(mept) ); 243 #endif 244 #if PJMEDIA_HAS_GSM_CODEC 245 CHECK( pjmedia_codec_gsm_init(mept) ); 246 #endif 247 #if PJMEDIA_HAS_ILBC_CODEC 248 CHECK( pjmedia_codec_ilbc_init(mept, 30) ); 249 #endif 250 #if PJMEDIA_HAS_SPEEX_CODEC 251 CHECK( pjmedia_codec_speex_init(mept, 0, 5, 5) ); 252 #endif 253 #if PJMEDIA_HAS_G722_CODEC 254 CHECK( pjmedia_codec_g722_init(mept) ); 255 #endif 241 CHECK( pjmedia_codec_register_audio_codecs(mept, NULL) ); 256 242 257 243 pj_gettimeofday(&t0); -
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/jbsim.c
r3392 r3661 473 473 474 474 /* Register codecs */ 475 #if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC != 0 476 pjmedia_codec_gsm_init(g_app.endpt); 477 #endif 478 #if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 479 pjmedia_codec_g711_init(g_app.endpt); 480 #endif 481 #if defined(PJMEDIA_HAS_SPEEX_CODEC) && PJMEDIA_HAS_SPEEX_CODEC!=0 482 pjmedia_codec_speex_init(g_app.endpt, 0, PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY, 483 PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY); 484 #endif 485 #if defined(PJMEDIA_HAS_G722_CODEC) && (PJMEDIA_HAS_G722_CODEC != 0) 486 pjmedia_codec_g722_init(g_app.endpt); 487 #endif 488 #if defined(PJMEDIA_HAS_ILBC_CODEC) && PJMEDIA_HAS_ILBC_CODEC != 0 489 /* Init ILBC with mode=20 to make the losts occur at the same 490 * places as other codecs. 491 */ 492 pjmedia_codec_ilbc_init(g_app.endpt, 20); 493 #endif 494 #if defined(PJMEDIA_HAS_INTEL_IPP) && PJMEDIA_HAS_INTEL_IPP != 0 495 pjmedia_codec_ipp_init(g_app.endpt); 496 #endif 497 #if defined(PJMEDIA_HAS_L16_CODEC) && PJMEDIA_HAS_L16_CODEC != 0 498 pjmedia_codec_l16_init(g_app.endpt, 0); 499 #endif 475 pjmedia_codec_register_audio_codecs(g_app.endpt, NULL); 500 476 501 477 /* Create the loop transport */ -
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/pcaputil.c
r3392 r3661 229 229 230 230 /* Initialize all codecs */ 231 #if PJMEDIA_HAS_SPEEX_CODEC 232 T( pjmedia_codec_speex_init(app.mept, 0, 10, 10) ); 233 #endif /* PJMEDIA_HAS_SPEEX_CODEC */ 234 235 #if PJMEDIA_HAS_ILBC_CODEC 236 T( pjmedia_codec_ilbc_init(app.mept, 30) ); 237 #endif /* PJMEDIA_HAS_ILBC_CODEC */ 238 239 #if PJMEDIA_HAS_GSM_CODEC 240 T( pjmedia_codec_gsm_init(app.mept) ); 241 #endif /* PJMEDIA_HAS_GSM_CODEC */ 242 243 #if PJMEDIA_HAS_G711_CODEC 244 T( pjmedia_codec_g711_init(app.mept) ); 245 #endif /* PJMEDIA_HAS_G711_CODEC */ 246 247 #if PJMEDIA_HAS_G722_CODEC 248 T( pjmedia_codec_g722_init(app.mept) ); 249 #endif /* PJMEDIA_HAS_G722_CODEC */ 250 251 #if PJMEDIA_HAS_L16_CODEC 252 T( pjmedia_codec_l16_init(app.mept, 0) ); 253 #endif /* PJMEDIA_HAS_L16_CODEC */ 231 T( pjmedia_codec_register_audio_codecs(app.mept, NULL) ); 254 232 255 233 /* Create SRTP transport is needed */ -
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/pjsip-perf.c
r2408 r3661 929 929 930 930 /* Must register all codecs to be supported */ 931 #if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 932 pjmedia_codec_g711_init(app.med_endpt); 933 #endif 934 #if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC!=0 935 pjmedia_codec_gsm_init(app.med_endpt); 936 #endif 937 #if defined(PJMEDIA_HAS_SPEEX_CODEC) && PJMEDIA_HAS_SPEEX_CODEC!=0 938 pjmedia_codec_speex_init(app.med_endpt, PJMEDIA_SPEEX_NO_UWB, 3, 3); 939 #endif 940 #if defined(PJMEDIA_HAS_G722_CODEC) && PJMEDIA_HAS_G722_CODEC!=0 941 pjmedia_codec_g722_init(app.med_endpt); 942 #endif 931 pjmedia_codec_register_audio_codecs(app.med_endpt, NULL); 943 932 944 933 /* Init dummy socket addresses */ -
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/streamutil.c
r3514 r3661 101 101 static pj_status_t init_codecs(pjmedia_endpt *med_endpt) 102 102 { 103 pj_status_t status; 104 105 /* To suppress warning about unused var when all codecs are disabled */ 106 PJ_UNUSED_ARG(status); 107 108 #if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 109 status = pjmedia_codec_g711_init(med_endpt); 110 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 111 #endif 112 113 #if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC!=0 114 status = pjmedia_codec_gsm_init(med_endpt); 115 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 116 #endif 117 118 #if defined(PJMEDIA_HAS_SPEEX_CODEC) && PJMEDIA_HAS_SPEEX_CODEC!=0 119 status = pjmedia_codec_speex_init(med_endpt, 0, -1, -1); 120 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 121 #endif 122 123 #if defined(PJMEDIA_HAS_G722_CODEC) && PJMEDIA_HAS_G722_CODEC!=0 124 status = pjmedia_codec_g722_init(med_endpt); 125 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 126 #endif 127 128 #if defined(PJMEDIA_HAS_L16_CODEC) && PJMEDIA_HAS_L16_CODEC!=0 129 status = pjmedia_codec_l16_init(med_endpt, 0); 130 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 131 #endif 132 133 return PJ_SUCCESS; 103 return pjmedia_codec_register_audio_codecs(med_endpt, NULL); 134 104 } 135 105 -
pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_media.c
r3659 r3661 67 67 pj_str_t codec_id = {NULL, 0}; 68 68 unsigned opt; 69 pjmedia_audio_codec_config codec_cfg; 69 70 pj_status_t status; 70 71 … … 113 114 } 114 115 115 /* Register all codecs */ 116 117 #if PJMEDIA_HAS_SPEEX_CODEC 118 /* Register speex. */ 119 status = pjmedia_codec_speex_init(pjsua_var.med_endpt, 120 0, 121 pjsua_var.media_cfg.quality, 122 -1); 123 if (status != PJ_SUCCESS) { 124 pjsua_perror(THIS_FILE, "Error initializing Speex codec", 125 status); 126 return status; 127 } 128 129 /* Set speex/16000 to higher priority*/ 130 codec_id = pj_str("speex/16000"); 131 pjmedia_codec_mgr_set_codec_priority( 132 pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt), 133 &codec_id, PJMEDIA_CODEC_PRIO_NORMAL+2); 134 135 /* Set speex/8000 to next higher priority*/ 136 codec_id = pj_str("speex/8000"); 137 pjmedia_codec_mgr_set_codec_priority( 138 pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt), 139 &codec_id, PJMEDIA_CODEC_PRIO_NORMAL+1); 140 141 142 143 #endif /* PJMEDIA_HAS_SPEEX_CODEC */ 144 145 #if PJMEDIA_HAS_ILBC_CODEC 146 /* Register iLBC. */ 147 status = pjmedia_codec_ilbc_init( pjsua_var.med_endpt, 148 pjsua_var.media_cfg.ilbc_mode); 149 if (status != PJ_SUCCESS) { 150 pjsua_perror(THIS_FILE, "Error initializing iLBC codec", 151 status); 152 return status; 153 } 154 #endif /* PJMEDIA_HAS_ILBC_CODEC */ 155 156 #if PJMEDIA_HAS_GSM_CODEC 157 /* Register GSM */ 158 status = pjmedia_codec_gsm_init(pjsua_var.med_endpt); 159 if (status != PJ_SUCCESS) { 160 pjsua_perror(THIS_FILE, "Error initializing GSM codec", 161 status); 162 return status; 163 } 164 #endif /* PJMEDIA_HAS_GSM_CODEC */ 165 166 #if PJMEDIA_HAS_G711_CODEC 167 /* Register PCMA and PCMU */ 168 status = pjmedia_codec_g711_init(pjsua_var.med_endpt); 169 if (status != PJ_SUCCESS) { 170 pjsua_perror(THIS_FILE, "Error initializing G711 codec", 171 status); 172 return status; 173 } 174 #endif /* PJMEDIA_HAS_G711_CODEC */ 175 176 #if PJMEDIA_HAS_G722_CODEC 177 status = pjmedia_codec_g722_init( pjsua_var.med_endpt ); 178 if (status != PJ_SUCCESS) { 179 pjsua_perror(THIS_FILE, "Error initializing G722 codec", 180 status); 181 return status; 182 } 183 #endif /* PJMEDIA_HAS_G722_CODEC */ 184 185 #if PJMEDIA_HAS_INTEL_IPP 186 /* Register IPP codecs */ 187 status = pjmedia_codec_ipp_init(pjsua_var.med_endpt); 188 if (status != PJ_SUCCESS) { 189 pjsua_perror(THIS_FILE, "Error initializing IPP codecs", 190 status); 191 return status; 192 } 193 194 #endif /* PJMEDIA_HAS_INTEL_IPP */ 116 /* 117 * Register all codecs 118 */ 119 pjmedia_audio_codec_config_default(&codec_cfg); 120 codec_cfg.speex.quality = pjsua_var.media_cfg.quality; 121 codec_cfg.speex.complexity = -1; 122 codec_cfg.ilbc.mode = pjsua_var.media_cfg.ilbc_mode; 195 123 196 124 #if PJMEDIA_HAS_PASSTHROUGH_CODECS … … 200 128 unsigned ext_fmt_cnt = 0; 201 129 pjmedia_format ext_fmts[32]; 202 pjmedia_codec_passthrough_setting setting;203 130 204 131 /* List extended formats supported by audio devices */ … … 237 164 238 165 /* Init the passthrough codec with supported formats only */ 239 setting.fmt_cnt = ext_fmt_cnt; 240 setting.fmts = ext_fmts; 241 setting.ilbc_mode = cfg->ilbc_mode; 242 status = pjmedia_codec_passthrough_init2(pjsua_var.med_endpt, &setting); 243 if (status != PJ_SUCCESS) { 244 pjsua_perror(THIS_FILE, "Error initializing passthrough codecs", 245 status); 246 return status; 247 } 166 codec_cfg.passthrough.setting.fmt_cnt = ext_fmt_cnt; 167 codec_cfg.passthrough.setting.fmts = ext_fmts; 168 codec_cfg.passthrough.setting.ilbc_mode = cfg->ilbc_mode; 248 169 } 249 170 #endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */ 250 171 251 #if PJMEDIA_HAS_G7221_CODEC 252 /* Register G722.1 codecs */253 status = pjmedia_codec_g7221_init(pjsua_var.med_endpt);172 /* Register all codecs */ 173 status = pjmedia_codec_register_audio_codecs(pjsua_var.med_endpt, 174 &codec_cfg); 254 175 if (status != PJ_SUCCESS) { 255 pjsua_perror(THIS_FILE, "Error initializing G722.1 codec", 256 status); 176 PJ_PERROR(1,(THIS_FILE, status, "Error registering codecs")); 257 177 return status; 258 178 } 259 #endif /* PJMEDIA_HAS_G7221_CODEC */ 260 261 #if PJMEDIA_HAS_L16_CODEC 262 /* Register L16 family codecs, but disable all */ 263 status = pjmedia_codec_l16_init(pjsua_var.med_endpt, 0); 264 if (status != PJ_SUCCESS) { 265 pjsua_perror(THIS_FILE, "Error initializing L16 codecs", 266 status); 267 return status; 268 } 179 180 /* Set speex/16000 to higher priority*/ 181 codec_id = pj_str("speex/16000"); 182 pjmedia_codec_mgr_set_codec_priority( 183 pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt), 184 &codec_id, PJMEDIA_CODEC_PRIO_NORMAL+2); 185 186 /* Set speex/8000 to next higher priority*/ 187 codec_id = pj_str("speex/8000"); 188 pjmedia_codec_mgr_set_codec_priority( 189 pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt), 190 &codec_id, PJMEDIA_CODEC_PRIO_NORMAL+1); 269 191 270 192 /* Disable ALL L16 codecs */ … … 273 195 pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt), 274 196 &codec_id, PJMEDIA_CODEC_PRIO_DISABLED); 275 276 #endif /* PJMEDIA_HAS_L16_CODEC */277 197 278 198 … … 519 439 pjsua_vid_subsys_destroy(); 520 440 # endif 521 /* Shutdown all codecs: */522 # if PJMEDIA_HAS_SPEEX_CODEC523 pjmedia_codec_speex_deinit();524 # endif /* PJMEDIA_HAS_SPEEX_CODEC */525 526 # if PJMEDIA_HAS_GSM_CODEC527 pjmedia_codec_gsm_deinit();528 # endif /* PJMEDIA_HAS_GSM_CODEC */529 530 # if PJMEDIA_HAS_G711_CODEC531 pjmedia_codec_g711_deinit();532 # endif /* PJMEDIA_HAS_G711_CODEC */533 534 # if PJMEDIA_HAS_G722_CODEC535 pjmedia_codec_g722_deinit();536 # endif /* PJMEDIA_HAS_G722_CODEC */537 538 # if PJMEDIA_HAS_INTEL_IPP539 pjmedia_codec_ipp_deinit();540 # endif /* PJMEDIA_HAS_INTEL_IPP */541 542 # if PJMEDIA_HAS_PASSTHROUGH_CODECS543 pjmedia_codec_passthrough_deinit();544 # endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */545 546 # if PJMEDIA_HAS_G7221_CODEC547 pjmedia_codec_g7221_deinit();548 # endif /* PJMEDIA_HAS_G7221_CODEC */549 550 # if PJMEDIA_HAS_L16_CODEC551 pjmedia_codec_l16_deinit();552 # endif /* PJMEDIA_HAS_L16_CODEC */553 441 554 442 pjmedia_endpt_destroy(pjsua_var.med_endpt);
Note: See TracChangeset
for help on using the changeset viewer.