- Timestamp:
- Apr 5, 2012 7:22:30 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r4024 r4025 3583 3583 puts("| vid acc cap ID Set default capture device for current acc |"); 3584 3584 puts("| vid acc rend ID Set default renderer device for current acc |"); 3585 puts("| vid call rx on|off N Enable/disable video rxfor stream N in curr call |");3586 puts("| vid call tx on|off N Enable/disable video txfor stream N in curr call |");3585 puts("| vid call rx on|off N Enable/disable video RX for stream N in curr call |"); 3586 puts("| vid call tx on|off N Enable/disable video TX for stream N in curr call |"); 3587 3587 puts("| vid call add Add video stream for current call |"); 3588 3588 puts("| vid call enable|disable N Enable/disable stream #N in current call |"); … … 3592 3592 puts("| vid dev prev on|off ID Enable/disable preview for specified device ID |"); 3593 3593 puts("| vid codec list List video codecs |"); 3594 puts("| vid codec prio PT PRIO Set codec with pt PT priority to PRIO |"); 3594 puts("| vid codec prio ID PRIO Set codec ID priority to PRIO |"); 3595 puts("| vid codec fps ID NUM DEN Set codec ID framerate to (NUM/DEN) fps |"); 3596 puts("| vid codec bw ID AVG MAX Set codec ID bitrate to AVG & MAX kbps |"); 3595 3597 puts("| vid win list List all active video windows |"); 3596 3598 puts("| vid win arrange Auto arrange windows |"); … … 4249 4251 4250 4252 } else if (strcmp(argv[1], "codec")==0) { 4251 pjmedia_vid_codec_info ci[PJMEDIA_CODEC_MGR_MAX_CODECS]; 4252 unsigned prio[PJMEDIA_CODEC_MGR_MAX_CODECS]; 4253 unsigned count = PJMEDIA_CODEC_MGR_MAX_CODECS; 4253 pjsua_codec_info ci[PJMEDIA_CODEC_MGR_MAX_CODECS]; 4254 unsigned count = PJ_ARRAY_SIZE(ci); 4254 4255 pj_status_t status; 4255 4256 4256 4257 if (argc==3 && strcmp(argv[2], "list")==0) { 4257 status = pj media_vid_codec_mgr_enum_codecs(NULL, &count, ci, prio);4258 status = pjsua_vid_enum_codecs(ci, &count); 4258 4259 if (status != PJ_SUCCESS) { 4259 4260 PJ_PERROR(1,(THIS_FILE, status, "Error enumerating codecs")); … … 4261 4262 unsigned i; 4262 4263 PJ_LOG(3,(THIS_FILE, "Found %d video codecs:", count)); 4263 PJ_LOG(3,(THIS_FILE, " PT Prio Name"));4264 PJ_LOG(3,(THIS_FILE, "------------------------- "));4264 PJ_LOG(3,(THIS_FILE, "codec id prio fps br(kbps)")); 4265 PJ_LOG(3,(THIS_FILE, "----------------------------------")); 4265 4266 for (i=0; i<count; ++i) { 4266 PJ_LOG(3,(THIS_FILE, "% 3d % 3d %.*s", ci[i].pt, prio[i], 4267 (int)ci[i].encoding_name.slen, 4268 ci[i].encoding_name.ptr)); 4267 pjmedia_vid_codec_param cp; 4268 pjmedia_video_format_detail *vfd; 4269 4270 status = pjsua_vid_codec_get_param(&ci[i].codec_id, &cp); 4271 if (status != PJ_SUCCESS) 4272 continue; 4273 4274 vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt, 4275 PJ_TRUE); 4276 PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f %d/%d", 4277 (int)ci[i].codec_id.slen, ci[i].codec_id.ptr, 4278 13-(int)ci[i].codec_id.slen, " ", 4279 ci[i].priority, 4280 (vfd->fps.num*1.0/vfd->fps.denum), 4281 vfd->avg_bps/1000, vfd->max_bps/1000)); 4269 4282 } 4270 4283 } 4271 4284 } else if (argc==5 && strcmp(argv[2], "prio")==0) { 4272 int pt = atoi(argv[3]); 4273 int prio = atoi(argv[4]); 4274 const pjmedia_vid_codec_info *pci; 4275 4276 status = pjmedia_vid_codec_mgr_get_codec_info(NULL, pt, &pci); 4277 if (status != PJ_SUCCESS) { 4278 PJ_PERROR(1,(THIS_FILE, status, "Unable to find codec")); 4279 } else { 4280 char codec_id[40]; 4281 if (pjmedia_vid_codec_info_to_id(pci, codec_id, 4282 sizeof(codec_id)) == NULL) 4283 { 4284 PJ_PERROR(1,(THIS_FILE, status, "Unable to get codec id")); 4285 } else { 4286 pj_str_t cid = pj_str(codec_id); 4287 status = pjsua_vid_codec_set_priority(&cid, 4288 (pj_uint8_t)prio); 4289 } 4290 } 4291 4285 pj_str_t cid; 4286 int prio; 4287 cid = pj_str(argv[3]); 4288 prio = atoi(argv[4]); 4289 status = pjsua_vid_codec_set_priority(&cid, (pj_uint8_t)prio); 4290 if (status != PJ_SUCCESS) 4291 PJ_PERROR(1,(THIS_FILE, status, "Set codec priority error")); 4292 } else if (argc==6 && strcmp(argv[2], "fps")==0) { 4293 pjmedia_vid_codec_param cp; 4294 pj_str_t cid; 4295 int M, N; 4296 cid = pj_str(argv[3]); 4297 M = atoi(argv[4]); 4298 N = atoi(argv[5]); 4299 status = pjsua_vid_codec_get_param(&cid, &cp); 4300 if (status == PJ_SUCCESS) { 4301 cp.enc_fmt.det.vid.fps.num = M; 4302 cp.enc_fmt.det.vid.fps.denum = N; 4303 status = pjsua_vid_codec_set_param(&cid, &cp); 4304 } 4305 if (status != PJ_SUCCESS) 4306 PJ_PERROR(1,(THIS_FILE, status, "Set codec framerate error")); 4307 } else if (argc==6 && strcmp(argv[2], "bw")==0) { 4308 pjmedia_vid_codec_param cp; 4309 pj_str_t cid; 4310 int M, N; 4311 cid = pj_str(argv[3]); 4312 M = atoi(argv[4]); 4313 N = atoi(argv[5]); 4314 status = pjsua_vid_codec_get_param(&cid, &cp); 4315 if (status == PJ_SUCCESS) { 4316 cp.enc_fmt.det.vid.avg_bps = M * 1000; 4317 cp.enc_fmt.det.vid.max_bps = N * 1000; 4318 status = pjsua_vid_codec_set_param(&cid, &cp); 4319 } 4320 if (status != PJ_SUCCESS) 4321 PJ_PERROR(1,(THIS_FILE, status, "Set codec bitrate error")); 4292 4322 } else 4293 4323 goto on_error;
Note: See TracChangeset
for help on using the changeset viewer.