Changeset 4335 for pjproject/trunk/pjmedia/src/pjmedia-codec/opencore_amr.c
- Timestamp:
- Jan 29, 2013 8:09:15 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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");
Note: See TracChangeset
for help on using the changeset viewer.