Changeset 632
- Timestamp:
- Jul 27, 2006 10:04:56 PM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r629 r632 22 22 #define THIS_FILE "pjsua.c" 23 23 24 //#define STEREO_DEMO 24 25 25 26 … … 55 56 unsigned auto_answer; 56 57 unsigned duration; 58 59 #ifdef STEREO_DEMO 60 pjmedia_snd_port *snd; 61 #endif 62 57 63 } app_config; 58 64 … … 61 67 static pjsua_call_id current_call; 62 68 static pj_str_t uri_arg; 69 70 static void stereo_demo(); 63 71 64 72 /***************************************************************************** … … 2200 2208 return status; 2201 2209 2210 #ifdef STEREO_DEMO 2211 stereo_demo(); 2212 #endif 2213 2202 2214 /* Optionally registers WAV file */ 2203 2215 if (app_config.wav_file.slen) { … … 2273 2285 2274 2286 /* Use null sound device? */ 2287 #ifndef STEREO_DEMO 2275 2288 if (app_config.null_audio) { 2276 2289 status = pjsua_set_null_snd_dev(); … … 2278 2291 return status; 2279 2292 } 2293 #endif 2280 2294 2281 2295 return PJ_SUCCESS; … … 2305 2319 pj_status_t app_destroy(void) 2306 2320 { 2321 #ifdef STEREO_DEMO 2322 if (app_config.snd) { 2323 pjmedia_snd_port_destroy(app_config.snd); 2324 app_config.snd = NULL; 2325 } 2326 #endif 2327 2307 2328 if (app_config.pool) { 2308 2329 pj_pool_release(app_config.pool); … … 2312 2333 return pjsua_destroy(); 2313 2334 } 2335 2336 2337 #ifdef STEREO_DEMO 2338 static void stereo_demo() 2339 { 2340 pjmedia_port *conf, *splitter, *ch1; 2341 unsigned clock; 2342 pj_status_t status; 2343 2344 /* Disable existing sound device */ 2345 conf = pjsua_set_no_snd_dev(); 2346 2347 clock = app_config.media_cfg.clock_rate; 2348 2349 /* Create stereo-mono splitter/combiner */ 2350 status = pjmedia_splitcomb_create(app_config.pool, 2351 clock /* clock rate */, 2352 2 /* stereo */, 2353 clock*2*10/1000/* 10ms samples * 2ch */, 2354 16 /* bits */, 2355 0 /* options */, 2356 &splitter); 2357 pj_assert(status == PJ_SUCCESS); 2358 2359 /* Connect channel0 (left channel?) to conference port slot0 */ 2360 status = pjmedia_splitcomb_set_channel(splitter, 0 /* ch0 */, 2361 0 /*options*/, 2362 conf); 2363 pj_assert(status == PJ_SUCCESS); 2364 2365 /* Create reverse channel for channel1 (right channel?)... */ 2366 status = pjmedia_splitcomb_create_rev_channel(app_config.pool, 2367 splitter, 2368 1 /* ch1 */, 2369 0 /* options */, 2370 &ch1); 2371 pj_assert(status == PJ_SUCCESS); 2372 2373 /* .. and register it to conference bridge (it would be slot1 2374 * if there's no other devices connected to the bridge) 2375 */ 2376 status = pjsua_conf_add_port(app_config.pool, ch1, NULL); 2377 pj_assert(status == PJ_SUCCESS); 2378 2379 /* Create sound device */ 2380 status = pjmedia_snd_port_create(app_config.pool, -1, -1, 2381 clock /* clock rate */, 2382 2 /* stereo */, 2383 clock*2*10/1000 /* 10 ms samples * 2ch */, 2384 16 /* bits */, 2385 0, &app_config.snd); 2386 pj_assert(status == PJ_SUCCESS); 2387 2388 2389 /* Connect the splitter to the sound device */ 2390 status = pjmedia_snd_port_connect(app_config.snd, splitter); 2391 pj_assert(status == PJ_SUCCESS); 2392 2393 } 2394 #endif 2395 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r629 r632 2248 2248 2249 2249 /** 2250 * Add arbitrary media port to PJSUA's conference bridge. Application 2251 * can use this function to add the media port that it creates. For 2252 * media ports that are created by PJSUA-LIB (such as calls, file player, 2253 * or file recorder), PJSUA-LIB will automatically add the port to 2254 * the bridge. 2255 * 2256 * @param pool Pool to use. 2257 * @param port Media port to be added to the bridge. 2258 * @param p_id Optional pointer to receive the conference 2259 * slot id. 2260 * 2261 * @return PJ_SUCCESS on success, or the appropriate error code. 2262 */ 2263 PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool, 2264 pjmedia_port *port, 2265 pjsua_conf_port_id *p_id); 2266 2267 2268 /** 2269 * Remove arbitrary slot from the conference bridge. Application should only 2270 * call this function if it registered the port manually. 2271 * 2272 * @param id The slot id of the port to be removed. 2273 * 2274 * @return PJ_SUCCESS on success, or the appropriate error code. 2275 */ 2276 PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id id); 2277 2278 2279 /** 2250 2280 * Establish unidirectional media flow from souce to sink. One source 2251 2281 * may transmit to multiple destinations/sink. And if multiple … … 2425 2455 2426 2456 2457 /** 2458 * Disconnect the main conference bridge from any sound devices, and let 2459 * application connect the bridge to it's own sound device/master port. 2460 * 2461 * @return The port interface of the conference bridge, 2462 * so that application can connect this to it's own 2463 * sound device or master port. 2464 */ 2465 PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void); 2466 2467 2427 2468 /***************************************************************************** 2428 2469 * Codecs. -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r611 r632 205 205 int cap_dev; /**< Capture device ID. */ 206 206 int play_dev; /**< Playback device ID. */ 207 pj_bool_t no_snd; /**< No sound (app will manage it) */ 207 208 pjmedia_snd_port *snd_port; /**< Sound port. */ 208 209 pjmedia_master_port *null_snd; /**< Master port for null sound. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r582 r632 340 340 341 341 /* Create sound port if none is created yet */ 342 if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL) { 342 if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL && 343 !pjsua_var.no_snd) 344 { 343 345 status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 344 346 if (status != PJ_SUCCESS) { … … 572 574 573 575 /* 576 * Add arbitrary media port to PJSUA's conference bridge. 577 */ 578 PJ_DEF(pj_status_t) pjsua_conf_add_port( pj_pool_t *pool, 579 pjmedia_port *port, 580 pjsua_conf_port_id *p_id) 581 { 582 pj_status_t status; 583 584 status = pjmedia_conf_add_port(pjsua_var.mconf, pool, 585 port, NULL, (unsigned*)p_id); 586 if (status != PJ_SUCCESS) { 587 if (p_id) 588 *p_id = PJSUA_INVALID_ID; 589 } 590 591 return status; 592 } 593 594 595 /* 596 * Remove arbitrary slot from the conference bridge. 597 */ 598 PJ_DEF(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id id) 599 { 600 return pjmedia_conf_remove_port(pjsua_var.mconf, (unsigned)id); 601 } 602 603 604 /* 574 605 * Establish unidirectional media flow from souce to sink. 575 606 */ … … 963 994 964 995 996 997 /* 998 * Use no device! 999 */ 1000 PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void) 1001 { 1002 /* Close existing sound device */ 1003 close_snd_dev(); 1004 1005 pjsua_var.no_snd = PJ_TRUE; 1006 return pjmedia_conf_get_master_port(pjsua_var.mconf); 1007 } 1008 1009 1010 965 1011 /***************************************************************************** 966 1012 * Codecs.
Note: See TracChangeset
for help on using the changeset viewer.