From 9b44f51f9e162f47a951d3e933e0b0e462db576b Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 19 Nov 2008 14:48:48 +0000 Subject: Small modifications to level.c sample to print out the timeline and linear level git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2369 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/level.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pjsip-apps/src/samples/level.c b/pjsip-apps/src/samples/level.c index 4d4d7ee0..2183675c 100644 --- a/pjsip-apps/src/samples/level.c +++ b/pjsip-apps/src/samples/level.c @@ -72,7 +72,7 @@ static int app_perror( const char *sender, const char *title, */ int main(int argc, char *argv[]) { - enum { NSAMPLES = 160, COUNT=100 }; + enum { NSAMPLES = 640, COUNT=100 }; pj_caching_pool cp; pjmedia_endpt *med_endpt; pj_pool_t *pool; @@ -123,10 +123,19 @@ int main(int argc, char *argv[]) return 1; } + if (file_port->info.samples_per_frame > NSAMPLES) { + app_perror(THIS_FILE, "WAV clock rate is too big", PJ_EINVAL); + return 1; + } + + puts("Time\tPCMU\tLinear"); + puts("------------------------"); + for (i=0; iinfo.samples_per_frame); level = pjmedia_linear2ulaw(level32) ^ 0xFF; - printf("%d ", level); + ms = i * 1000 * file_port->info.samples_per_frame / + file_port->info.clock_rate; + printf("%03d.%03d\t%7d\t%7d\n", + ms/1000, ms%1000, level, level32); } puts(""); -- cgit v1.2.3