siproc

git clone git://xatko.vsos.ethz.ch/siproc.git
Log | Files | Refs | README | LICENSE

parameters.cpp (1347B)


      1 #include <pjsua2.hpp>
      2 #include <string.h>
      3 
      4 using namespace pj;
      5 
      6 int main(int argc, char **argv){
      7 	bool codecs=false;
      8 	bool aud_dev=false;
      9 	if(argc == 1){
     10 		codecs = true;
     11 		aud_dev = true;
     12 	}
     13 	else{
     14 		for(int i=1; i<argc; i++){
     15 			if(strcasecmp(argv[i],"codecs") == 0){
     16 				codecs = true;
     17 			}
     18 			if(strcasecmp(argv[i],"audio-devices") == 0){
     19 				aud_dev = true;
     20 			}
     21 		}
     22 	}
     23 
     24 	Endpoint ep;
     25 
     26 	ep.libCreate();
     27 	EpConfig ep_cfg;
     28 	ep_cfg.logConfig.level = -10;
     29 	ep.libInit(ep_cfg);
     30 	pjmedia_endpt *medept = pjsua_get_pjmedia_endpt();
     31 	
     32 	if(codecs){
     33 		printf("\nCodecs:\n");
     34 		printf("Priority\tCodec\n");
     35 		pjmedia_codec_mgr *cmgr= pjmedia_endpt_get_codec_mgr(medept);
     36 		unsigned cnt=64;
     37 		pjmedia_codec_info *info=new pjmedia_codec_info[cnt];
     38 		unsigned *prios=new unsigned[cnt];
     39 		pjmedia_codec_mgr_enum_codecs(cmgr, &cnt, info, prios);
     40 		for(unsigned i=0; i<cnt; i++){
     41 			pj_str_t s=info[i].encoding_name;
     42 			printf("%d\t%s\n", prios[i], pj_strbuf(&s));
     43 		}
     44 	}
     45 	
     46 	if(aud_dev){
     47 		printf("\nAudio Devices:\n");
     48 		printf("Driver\tName\t#Input\t#Output\n");
     49 		AudDevManager &adm = ep.audDevManager();
     50 		AudioDevInfoVector adevs = adm.enumDev();
     51 		for(unsigned int i = 0; i<adevs.size(); i++){
     52 			AudioDevInfo *dev = adevs[i];
     53 			printf("%s\t%s\t%d\t%d\n", dev->driver.c_str(), dev->name.c_str(), dev->inputCount, dev->outputCount);
     54 		}
     55 	}
     56 	return 0;
     57 }