Home --> Documentations --> PJMEDIA Reference
This is a very simple example to use the WAV File Player, to directly read the samples from the file.
This file is pjsip-apps/src/samples/level.c
33static const char *desc =
38 " Read PCM WAV file and display the audio level the first 100 frames. \n"
39 " Each frame is assumed to have 160 samples. \n"
44 " The WAV file SHOULD have a 16bit mono samples. ";
52#define THIS_FILE "level.c"
56static int app_perror( const char *sender, const char *title,
65 printf( "%s: %s [code=%d]\n", title, errmsg, status);
73int main( int argc, char *argv[])
75 enum { NSAMPLES = 640, COUNT=100 };
122 app_perror(THIS_FILE, "Unable to use WAV file", status);
127 app_perror(THIS_FILE, "WAV clock rate is too big", PJ_EINVAL);
131 puts( "Time\tPCMU\tLinear");
132 puts( "------------------------");
134 for (i=0; i<COUNT; ++i) {
142 frm. size = sizeof(framebuf);
148 level = pjmedia_linear2ulaw(level32) ^ 0xFF;
152 printf( "%03d.%03d\t%7d\t%7d\n",
153 ms/1000, ms%1000, level, level32);
pj_status_t pjmedia_endpt_create(pj_pool_factory *pf, pj_ioqueue_t *ioqueue, unsigned worker_cnt, pjmedia_endpt **p_endpt) Definition: endpoint.h:127
pj_status_t pjmedia_endpt_destroy(pjmedia_endpt *endpt) Definition: endpoint.h:168
pj_status_t pj_init(void)
void pj_caching_pool_destroy(pj_caching_pool *ch_pool)
void pj_caching_pool_init(pj_caching_pool *ch_pool, const pj_pool_factory_policy *policy, pj_size_t max_capacity)
pj_pool_factory_policy pj_pool_factory_default_policy
pj_pool_t * pj_pool_create(pj_pool_factory *factory, const char *name, pj_size_t initial_size, pj_size_t increment_size, pj_pool_callback *callback)
void pj_pool_release(pj_pool_t *pool)
#define PJ_ASSERT_RETURN(expr, retval)
#define PJ_UNUSED_ARG(arg)
pj_str_t pj_strerror(pj_status_t statcode, char *buf, pj_size_t bufsize)
PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.
|