siproc

A primitive SIP client that spawns processes for each call
git clone git://xatko.vsos.ethz.ch/siproc.git
Log | Files | Refs | README | LICENSE

commit b6d4feddc709c7e750a2c94bdf921304d52d6357
parent 1065214275194a326077a15e2f2d8b7530c29217
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date:   Sat, 16 Nov 2019 17:53:58 +0100

Add the siproc-parameters program, printing system information

This is needed to e.g. find out with which device name to call ARECORD

Diffstat:
MMakefile | 3+++
Asrc/parameters.cpp | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -12,6 +12,9 @@ MANPREFIX ?= /usr/share/man siproc: src/siproc.o $(CPP) $(_CFLAGS) -o $@ $^ $(_LDFLAGS) +siproc-parameters: src/parameters.o + $(CPP) $(_CFLAGS) -o $@ $^ $(_LDFLAGS) + %.o: %.cpp $(CPP) $(_CFLAGS) -c -o $@ $^ diff --git a/src/parameters.cpp b/src/parameters.cpp @@ -0,0 +1,57 @@ +#include <pjsua2.hpp> +#include <string.h> + +using namespace pj; + +int main(int argc, char **argv){ + bool codecs=false; + bool aud_dev=false; + if(argc == 1){ + codecs = true; + aud_dev = true; + } + else{ + for(int i=1; i<argc; i++){ + if(strcasecmp(argv[i],"codecs") == 0){ + codecs = true; + } + if(strcasecmp(argv[i],"audio-devices") == 0){ + aud_dev = true; + } + } + } + + Endpoint ep; + + ep.libCreate(); + EpConfig ep_cfg; + ep_cfg.logConfig.level = -10; + ep.libInit(ep_cfg); + pjmedia_endpt *medept = pjsua_get_pjmedia_endpt(); + + if(codecs){ + printf("\nCodecs:\n"); + printf("Priority\tCodec\n"); + pjmedia_codec_mgr *cmgr= pjmedia_endpt_get_codec_mgr(medept); + unsigned cnt=64; + pjmedia_codec_info *info=new pjmedia_codec_info[cnt]; + unsigned *prios=new unsigned[cnt]; + pjmedia_codec_mgr_enum_codecs(cmgr, &cnt, info, prios); + for(unsigned i=0; i<cnt; i++){ + pj_str_t s=info[i].encoding_name; + printf("%d\t%s\n", prios[i], pj_strbuf(&s)); + } + } + + if(aud_dev){ + printf("\nAudio Devices:\n"); + printf("Driver\tName\t#Input\t#Output\n"); + AudDevManager &adm = ep.audDevManager(); + AudioDevInfoVector adevs = adm.enumDev(); + for(unsigned int i = 0; i<adevs.size(); i++){ + AudioDevInfo *dev = adevs[i]; + printf("%s\t%s\t%d\t%d\n", dev->driver.c_str(), dev->name.c_str(), dev->inputCount, dev->outputCount); + } + } + return 0; +}