- Timestamp:
- Apr 5, 2012 4:41:24 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r4023 r4024 140 140 /* AVI to play */ 141 141 unsigned avi_cnt; 142 pj_str_t avi[MAX_AVI]; 142 struct { 143 pj_str_t path; 144 pjmedia_vid_dev_index dev_id; 145 pjsua_conf_port_id slot; 146 } avi[MAX_AVI]; 143 147 pj_bool_t avi_auto_play; 144 pjmedia_vid_dev_index avi_dev_id;145 pjsua_conf_port_id avi_slot; 148 int avi_def_idx; 149 146 150 } app_config; 147 151 … … 411 415 cfg->ring_slot = PJSUA_INVALID_ID; 412 416 413 cfg->avi_dev_id = PJMEDIA_VID_INVALID_DEV;414 cfg->avi_slot = PJSUA_INVALID_ID;415 416 417 for (i=0; i<PJ_ARRAY_SIZE(cfg->acc_cfg); ++i) 417 418 pjsua_acc_config_default(&cfg->acc_cfg[i]); … … 423 424 cfg->vid.vrender_dev = PJMEDIA_VID_DEFAULT_RENDER_DEV; 424 425 cfg->aud_cnt = 1; 426 427 cfg->avi_def_idx = PJSUA_INVALID_ID; 425 428 } 426 429 … … 1518 1521 return -1; 1519 1522 } 1520 app_config.avi[app_config.avi_cnt++] = pj_str(pj_optarg);1523 app_config.avi[app_config.avi_cnt++].path = pj_str(pj_optarg); 1521 1524 break; 1522 1525 … … 2112 2115 } 2113 2116 for (i=0; i<config->avi_cnt; ++i) { 2114 pj_ansi_sprintf(line, "--play-avi %s\n", config->avi[i].p tr);2117 pj_ansi_sprintf(line, "--play-avi %s\n", config->avi[i].path.ptr); 2115 2118 pj_strcat2(&cfg, line); 2116 2119 } … … 2828 2831 /* Stream AVI, if desired */ 2829 2832 if (app_config.avi_auto_play && 2830 app_config.avi_slot != PJSUA_INVALID_ID) 2833 app_config.avi_def_idx != PJSUA_INVALID_ID && 2834 app_config.avi[app_config.avi_def_idx].slot != PJSUA_INVALID_ID) 2831 2835 { 2832 pjsua_conf_connect(app_config.avi_slot, call_conf_slot); 2836 pjsua_conf_connect(app_config.avi[app_config.avi_def_idx].slot, 2837 call_conf_slot); 2833 2838 disconnect_mic = PJ_TRUE; 2834 2839 } … … 4023 4028 4024 4029 if (app_config.avi_auto_play && 4025 app_config.avi_dev_id != PJMEDIA_VID_INVALID_DEV) 4030 app_config.avi_def_idx != PJSUA_INVALID_ID && 4031 app_config.avi[app_config.avi_def_idx].dev_id != PJMEDIA_VID_INVALID_DEV) 4026 4032 { 4027 acc_cfg->vid_cap_dev = app_config.avi _dev_id;4033 acc_cfg->vid_cap_dev = app_config.avi[app_config.avi_def_idx].dev_id; 4028 4034 } 4029 4035 } … … 5705 5711 unsigned strm_idx, strm_cnt; 5706 5712 5713 app_config.avi[i].dev_id = PJMEDIA_VID_INVALID_DEV; 5714 app_config.avi[i].slot = PJSUA_INVALID_ID; 5715 5707 5716 pjmedia_avi_dev_param_default(&avdp); 5708 avdp.path = app_config.avi[i] ;5717 avdp.path = app_config.avi[i].path; 5709 5718 5710 5719 status = pjmedia_avi_dev_alloc(avi_factory, &avdp, &avid); … … 5718 5727 PJ_LOG(4,(THIS_FILE, "AVI player %.*s created, dev_id=%d", 5719 5728 (int)avdp.title.slen, avdp.title.ptr, avid)); 5720 app_config.avi_dev_id = avid; 5729 5730 app_config.avi[i].dev_id = avid; 5731 if (app_config.avi_def_idx == PJSUA_INVALID_ID) 5732 app_config.avi_def_idx = i; 5721 5733 5722 5734 strm_cnt = pjmedia_avi_streams_get_num_streams(avdp.avi_streams); … … 5741 5753 (int)avdp.title.slen, avdp.title.ptr, 5742 5754 slot)); 5743 app_config.avi _slot = slot;5755 app_config.avi[i].slot = slot; 5744 5756 } 5745 5757 } else { … … 6037 6049 } 6038 6050 #endif 6051 6052 /* Close avi devs and ports */ 6053 for (i=0; i<app_config.avi_cnt; ++i) { 6054 if (app_config.avi[i].slot != PJSUA_INVALID_ID) 6055 pjsua_conf_remove_port(app_config.avi[i].slot); 6056 if (app_config.avi[i].dev_id != PJMEDIA_VID_INVALID_DEV) 6057 pjmedia_avi_dev_free(app_config.avi[i].dev_id); 6058 } 6039 6059 6040 6060 /* Close ringback port */
Note: See TracChangeset
for help on using the changeset viewer.