Changeset 4335
- Timestamp:
- Jan 29, 2013 8:09:15 AM (12 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia-codec/opencore_amr.h
r4331 r4335 33 33 34 34 /** 35 * Bitmask options to be passed during AMR codec factory initialization. 36 */ 37 enum pjmedia_amr_options 38 { 39 PJMEDIA_AMR_NO_NB = 1, /**< Disable narrowband mode. */ 40 PJMEDIA_AMR_NO_WB = 2, /**< Disable wideband mode. */ 41 }; 42 43 /** 35 44 * Settings. Use #pjmedia_codec_opencore_amrnb/wb_set_config() to 36 45 * activate. … … 54 63 55 64 /** 56 * Initialize and register AMR-NB codec factory to pjmedia endpoint. 65 * Initialize and register AMR codec factory to pjmedia endpoint. 66 * 67 * @param endpt The pjmedia endpoint. 68 * @param options Bitmask of pjmedia_amr_options (default=0). 69 * 70 * @return PJ_SUCCESS on success. 71 */ 72 PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_init(pjmedia_endpt* endpt, 73 unsigned options); 74 75 /** 76 * Initialize and register AMR codec factory using default settings to 77 * pjmedia endpoint. 78 * 79 * @param endpt The pjmedia endpoint. 80 * 81 * @return PJ_SUCCESS on success. 82 */ 83 PJ_DECL(pj_status_t) 84 pjmedia_codec_opencore_amr_init_default(pjmedia_endpt* endpt); 85 86 /** 87 * Unregister AMR codec factory from pjmedia endpoint and deinitialize 88 * the OpenCORE codec library. 89 * 90 * @return PJ_SUCCESS on success. 91 */ 92 PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_deinit(void); 93 94 /** 95 * Initialize and register AMR-NB codec factory to pjmedia endpoint. Calling 96 * this function will automatically initialize AMR codec factory without 97 * the wideband mode (i.e. it is equivalent to calling 98 * #pjmedia_codec_opencore_amr_init() with PJMEDIA_AMR_NO_WB). Application 99 * should call #pjmedia_codec_opencore_amr_init() instead if wishing to use 100 * both modes. 57 101 * 58 102 * @param endpt The pjmedia endpoint. … … 81 125 const pjmedia_codec_amrnb_config* cfg); 82 126 83 /**84 * Initialize and register AMR-WB codec factory to pjmedia endpoint.85 *86 * @param endpt The pjmedia endpoint.87 *88 * @return PJ_SUCCESS on success.89 */90 PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrwb_init(pjmedia_endpt* endpt);91 92 /**93 * Unregister AMR-WB codec factory from pjmedia endpoint and deinitialize94 * the OpenCORE codec library.95 *96 * @return PJ_SUCCESS on success.97 */98 PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrwb_deinit(void);99 100 127 101 128 /** -
pjproject/trunk/pjmedia/src/pjmedia-codec/audio_codecs.c
r4331 r4335 108 108 #endif /* PJMEDIA_HAS_L16_CODEC */ 109 109 110 #if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC 111 /* Register OpenCORE AMR-NB */ 112 status = pjmedia_codec_opencore_amrnb_init(endpt); 113 if (status != PJ_SUCCESS) 114 return status; 115 #endif 116 117 #if PJMEDIA_HAS_OPENCORE_AMRWB_CODEC 118 /* Register OpenCORE AMR-WB */ 119 status = pjmedia_codec_opencore_amrwb_init(endpt); 110 #if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC || PJMEDIA_HAS_OPENCORE_AMRWB_CODEC 111 /* Register OpenCORE AMR */ 112 status = pjmedia_codec_opencore_amr_init(endpt, 0); 120 113 if (status != PJ_SUCCESS) 121 114 return status; -
pjproject/trunk/pjmedia/src/pjmedia-codec/opencore_amr.c
r4331 r4335 199 199 * Initialize and register AMR codec factory to pjmedia endpoint. 200 200 */ 201 static pj_status_t amr_init( pjmedia_endpt *endpt ) 201 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amr_init( pjmedia_endpt *endpt, 202 unsigned options) 202 203 { 203 204 pjmedia_codec_mgr *codec_mgr; … … 212 213 amr_codec_factory.base.factory_data = NULL; 213 214 amr_codec_factory.endpt = endpt; 214 215 amr_codec_factory.pool = pjmedia_endpt_create_pool(endpt, "amr", 1000, 215 #ifdef USE_AMRNB 216 amr_codec_factory.init[IDX_AMR_NB] = ((options & PJMEDIA_AMR_NO_NB) == 0); 217 #else 218 amr_codec_factory.init[IDX_AMR_NB] = PJ_FALSE; 219 #endif 220 #ifdef USE_AMRWB 221 amr_codec_factory.init[IDX_AMR_WB] = ((options & PJMEDIA_AMR_NO_WB) == 0); 222 #else 223 amr_codec_factory.init[IDX_AMR_WB] = PJ_FALSE; 224 #endif 225 226 amr_codec_factory.pool = pjmedia_endpt_create_pool(endpt, "amr", 1000, 216 227 1000); 217 228 if (!amr_codec_factory.pool) … … 248 259 } 249 260 261 PJ_DEF(pj_status_t) 262 pjmedia_codec_opencore_amr_init_default( pjmedia_endpt *endpt ) 263 { 264 return pjmedia_codec_opencore_amr_init(endpt, 0); 265 } 266 250 267 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amrnb_init( pjmedia_endpt *endpt ) 251 268 { 252 amr_codec_factory.init[IDX_AMR_NB] = PJ_TRUE; 253 254 return amr_init(endpt); 255 } 256 257 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amrwb_init( pjmedia_endpt *endpt ) 258 { 259 amr_codec_factory.init[IDX_AMR_WB] = PJ_TRUE; 260 261 return amr_init(endpt); 269 return pjmedia_codec_opencore_amr_init(endpt, PJMEDIA_AMR_NO_WB); 262 270 } 263 271 … … 267 275 * the AMR codec library. 268 276 */ 269 static pj_status_tamr_deinit(void)277 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amr_deinit(void) 270 278 { 271 279 pjmedia_codec_mgr *codec_mgr; 272 280 pj_status_t status; 273 281 274 if (amr_codec_factory.init[IDX_AMR_NB] || 275 amr_codec_factory.init[IDX_AMR_WB]) 276 { 277 return PJ_SUCCESS; 278 } 282 amr_codec_factory.init[IDX_AMR_NB] = PJ_FALSE; 283 amr_codec_factory.init[IDX_AMR_WB] = PJ_FALSE; 279 284 280 285 if (amr_codec_factory.pool == NULL) … … 302 307 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amrnb_deinit(void) 303 308 { 304 amr_codec_factory.init[IDX_AMR_NB] = PJ_FALSE; 309 if (amr_codec_factory.init[IDX_AMR_NB] && 310 amr_codec_factory.init[IDX_AMR_WB]) 311 { 312 PJ_LOG(4, (THIS_FILE, "Should call " 313 "pjmedia_codec_opencore_amr_deinit() instead")); 314 315 return PJ_EINVALIDOP; 316 } 305 317 306 return amr_deinit(); 307 } 308 309 PJ_DEF(pj_status_t) pjmedia_codec_opencore_amrwb_deinit(void) 310 { 311 amr_codec_factory.init[IDX_AMR_WB] = PJ_FALSE; 312 313 return amr_deinit(); 318 return pjmedia_codec_opencore_amr_deinit(); 314 319 } 315 320 … … 448 453 } 449 454 450 if (amr_codec_factory.init[IDX_AMR_ NB]) {455 if (amr_codec_factory.init[IDX_AMR_WB]) { 451 456 pj_bzero(&codecs[*count], sizeof(pjmedia_codec_info)); 452 457 codecs[*count].encoding_name = pj_str("AMR-WB"); -
pjproject/trunk/pjmedia/src/test/mips_test.c
r4331 r4335 954 954 { 955 955 return codec_encode_decode(pool, "AMR/16000", 956 &pjmedia_codec_opencore_amr wb_init,957 &pjmedia_codec_opencore_amr wb_deinit,956 &pjmedia_codec_opencore_amr_init_default, 957 &pjmedia_codec_opencore_amr_deinit, 958 958 clock_rate, channel_count, 959 959 samples_per_frame, flags, te); … … 2053 2053 struct test_entry *te) 2054 2054 { 2055 return create_stream(pool, "AMR/16000", &pjmedia_codec_opencore_amrwb_init, 2056 &pjmedia_codec_opencore_amrwb_deinit, 2055 return create_stream(pool, "AMR/16000", 2056 &pjmedia_codec_opencore_amr_init_default, 2057 &pjmedia_codec_opencore_amr_deinit, 2057 2058 PJ_FALSE, PJ_FALSE, PJ_FALSE, 2058 2059 clock_rate, channel_count,
Note: See TracChangeset
for help on using the changeset viewer.