Index: pjproject/trunk/pjsip-apps/build/Samples-vc.mak
===================================================================
--- pjproject/trunk/pjsip-apps/build/Samples-vc.mak	(revision 411)
+++ pjproject/trunk/pjsip-apps/build/Samples-vc.mak	(revision 412)
@@ -6,7 +6,7 @@
 
 !if "$(BUILD_MODE)" == "debug"
-BUILD_FLAGS = /MTd /Od /Zi
+BUILD_FLAGS = /MTd /Od /Zi /W4
 !else
-BUILD_FLAGS = /Ox /MD /DNDEBUG
+BUILD_FLAGS = /Ox /MD /DNDEBUG /W4
 !endif
 
Index: pjproject/trunk/pjsip-apps/src/samples/confsample.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/confsample.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/confsample.c	(revision 412)
@@ -185,5 +185,5 @@
 
 #if RECORDER
-    status = pjmedia_file_writer_port_create( pool, "confrecord.wav",
+    status = pjmedia_wav_writer_port_create(  pool, "confrecord.wav",
 					      clock_rate, channel_count,
 					      samples_per_frame, 
@@ -205,7 +205,8 @@
 
 	/* Load the WAV file to file port. */
-	status = pjmedia_file_player_port_create( 
+	status = pjmedia_wav_player_port_create( 
 			pool,		    /* pool.	    */
 			argv[i+pj_optind],  /* filename	    */
+			0,		    /* use default ptime */
 			0,		    /* flags	    */
 			0,		    /* buf size	    */
Index: pjproject/trunk/pjsip-apps/src/samples/level.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/level.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/level.c	(revision 412)
@@ -45,4 +45,6 @@
 {
     char errmsg[PJ_ERR_MSG_SIZE];
+
+    PJ_UNUSED_ARG(sender);
 
     pj_strerror(status, errmsg, sizeof(errmsg));
@@ -97,6 +99,7 @@
 
     /* Create file media port from the WAV file */
-    status = pjmedia_file_player_port_create( pool,	/* memory pool	    */
+    status = pjmedia_wav_player_port_create(  pool,	/* memory pool	    */
 					      argv[1],	/* file to play	    */
+					      0,	/* use default ptime*/
 					      0,	/* flags	    */
 					      0,	/* default buffer   */
Index: pjproject/trunk/pjsip-apps/src/samples/playfile.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/playfile.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/playfile.c	(revision 412)
@@ -77,4 +77,7 @@
 
 
+    PJ_UNUSED_ARG(argc);
+
+
     /* Must init PJLIB first: */
     status = pj_init();
@@ -100,6 +103,7 @@
 
     /* Create file media port from the WAV file */
-    status = pjmedia_file_player_port_create( pool,	/* memory pool	    */
+    status = pjmedia_wav_player_port_create(  pool,	/* memory pool	    */
 					      argv[1],	/* file to play	    */
+					      20,	/* ptime.	    */
 					      0,	/* flags	    */
 					      0,	/* default buffer   */
@@ -116,5 +120,5 @@
 		 pool,				    /* pool		    */
 		 -1,				    /* use default dev.	    */
-		 file_port->info.sample_rate,	    /* clock rate.	    */
+		 file_port->info.clock_rate,	    /* clock rate.	    */
 		 file_port->info.channel_count,	    /* # of channels.	    */
 		 file_port->info.samples_per_frame, /* samples per frame.   */
Index: pjproject/trunk/pjsip-apps/src/samples/playsine.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/playsine.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/playsine.c	(revision 412)
@@ -48,4 +48,6 @@
 {
     char errmsg[PJ_ERR_MSG_SIZE];
+
+    PJ_UNUSED_ARG(sender);
 
     pj_strerror(status, errmsg, sizeof(errmsg));
@@ -128,5 +130,5 @@
     port->info.need_info = 0;
     port->info.pt = 0xFF;
-    port->info.sample_rate = sampling_rate;
+    port->info.clock_rate = sampling_rate;
     port->info.samples_per_frame = sampling_rate * 20 / 1000 * channel_count;
     port->info.bytes_per_frame = port->info.samples_per_frame * 2;
@@ -230,5 +232,5 @@
 		 pool,				    /* pool		    */
 		 -1,				    /* use default dev.	    */
-		 sine_port->info.sample_rate,	    /* clock rate.	    */
+		 sine_port->info.clock_rate,	    /* clock rate.	    */
 		 sine_port->info.channel_count,	    /* # of channels.	    */
 		 sine_port->info.samples_per_frame, /* samples per frame.   */
Index: pjproject/trunk/pjsip-apps/src/samples/recfile.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/recfile.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/recfile.c	(revision 412)
@@ -105,5 +105,5 @@
 
     /* Create WAVE file writer port. */
-    status = pjmedia_file_writer_port_create( pool, argv[1],
+    status = pjmedia_wav_writer_port_create(  pool, argv[1],
 					      CLOCK_RATE,
 					      NCHANNELS,
@@ -121,5 +121,5 @@
 		 pool,				    /* pool		    */
 		 -1,				    /* use default dev.	    */
-		 file_port->info.sample_rate,	    /* clock rate.	    */
+		 file_port->info.clock_rate,	    /* clock rate.	    */
 		 file_port->info.channel_count,	    /* # of channels.	    */
 		 file_port->info.samples_per_frame, /* samples per frame.   */
Index: pjproject/trunk/pjsip-apps/src/samples/resampleplay.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/resampleplay.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/resampleplay.c	(revision 412)
@@ -109,6 +109,6 @@
 
     /* Create the file port. */
-    status = pjmedia_file_player_port_create( pool, argv[pj_optind], 0,
-					      0, 0, &file_port);
+    status = pjmedia_wav_player_port_create( pool, argv[pj_optind], 0, 0,
+					     0, 0, &file_port);
     if (status != PJ_SUCCESS) {
 	app_perror(THIS_FILE, "Unable to open file", status);
@@ -129,10 +129,10 @@
     /* Create the resample port. */
     status = pjmedia_resample_port_create( pool, 1, 1,
-					   file_port->info.sample_rate,
+					   file_port->info.clock_rate,
 					   sampling_rate,
 					   channel_count,
 					   (unsigned)(
 					   samples_per_frame * 1.0 *
-					    file_port->info.sample_rate / 
+					    file_port->info.clock_rate / 
 					    sampling_rate),
 					   &resample_port);
@@ -187,5 +187,5 @@
 
     printf("Playing %s at sampling rate %d (original file sampling rate=%d)\n",
-	   argv[pj_optind], sampling_rate, file_port->info.sample_rate);
+	   argv[pj_optind], sampling_rate, file_port->info.clock_rate);
     puts("");
     puts("Press <ENTER> to stop playing and quit");
Index: pjproject/trunk/pjsip-apps/src/samples/simpleua.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/simpleua.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/simpleua.c	(revision 412)
@@ -420,4 +420,6 @@
 				   pjsip_event *e)
 {
+    PJ_UNUSED_ARG(e);
+
     if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
 
@@ -442,4 +444,6 @@
 {
     /* To be done... */
+    PJ_UNUSED_ARG(inv);
+    PJ_UNUSED_ARG(e);
 }
 
@@ -634,5 +638,5 @@
 		    inv->pool,				/* pool		    */
 		    -1,					/* sound dev id	    */
-		    media_port->info.sample_rate,	/* clock rate	    */
+		    media_port->info.clock_rate,	/* clock rate	    */
 		    media_port->info.channel_count,	/* channel count    */
 		    media_port->info.samples_per_frame, /* samples per frame*/
@@ -643,5 +647,5 @@
 	app_perror( THIS_FILE, "Unable to create sound player", status);
 	PJ_LOG(3,(THIS_FILE, "%d %d %d %d",
-	    	    media_port->info.sample_rate,	/* clock rate	    */
+	    	    media_port->info.clock_rate,	/* clock rate	    */
 		    media_port->info.channel_count,	/* channel count    */
 		    media_port->info.samples_per_frame, /* samples per frame*/
@@ -660,5 +664,5 @@
 		    inv->pool,				/* pool		    */
 		    -1,					/* sound dev id	    */
-		    media_port->info.sample_rate,	/* clock rate	    */
+		    media_port->info.clock_rate,	/* clock rate	    */
 		    media_port->info.channel_count,	/* channel count    */
 		    media_port->info.samples_per_frame, /* samples per frame*/
Index: pjproject/trunk/pjsip-apps/src/samples/siprtp.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/siprtp.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/siprtp.c	(revision 412)
@@ -1239,5 +1239,5 @@
     }
 
-    audio->clock_rate = audio->si.fmt.sample_rate;
+    audio->clock_rate = audio->si.fmt.clock_rate;
     audio->samples_per_frame = audio->clock_rate * codec_desc->ptime / 1000;
     audio->bytes_per_frame = codec_desc->bit_rate * codec_desc->ptime / 1000 / 8;
Index: pjproject/trunk/pjsip-apps/src/samples/sndinfo.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/sndinfo.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/sndinfo.c	(revision 412)
@@ -74,8 +74,8 @@
 }
 
-static int clock_rate;
-static int play_counter;
-static int rec_counter;
-static int min_delay = 0xFFFF, max_delay;
+static unsigned clock_rate;
+static unsigned play_counter;
+static unsigned rec_counter;
+static unsigned min_delay = 0xFFFF, max_delay;
 static char play_delays[1000];
 static pj_uint32_t last_play_timestamp, last_rec_timestamp;
@@ -85,4 +85,10 @@
 {
     static pj_timestamp last_cb;
+
+
+    PJ_UNUSED_ARG(user_data);
+    PJ_UNUSED_ARG(output);
+    PJ_UNUSED_ARG(size);
+
 
     ++play_counter;
@@ -93,5 +99,5 @@
     } else if (play_counter <= PJ_ARRAY_SIZE(play_delays)) {
 	pj_timestamp now;
-	int delay;
+	unsigned delay;
 
 	pj_get_timestamp(&now);
@@ -105,5 +111,5 @@
 	last_cb = now;
 
-	play_delays[play_counter-1] = delay;
+	play_delays[play_counter-1] = (char)delay;
     }
 
@@ -114,4 +120,10 @@
 			  const void *input, unsigned size)
 {
+
+    PJ_UNUSED_ARG(size);
+    PJ_UNUSED_ARG(input);
+    PJ_UNUSED_ARG(user_data);
+
+
     ++rec_counter;
 
@@ -249,5 +261,5 @@
 	
 	int dev_id;
-	pjmedia_dir dir;
+	pjmedia_dir dir = PJMEDIA_DIR_NONE;
 	int nchannel;
 	int bits;
Index: pjproject/trunk/pjsip-apps/src/samples/streamutil.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/streamutil.c	(revision 411)
+++ pjproject/trunk/pjsip-apps/src/samples/streamutil.c	(revision 412)
@@ -32,7 +32,5 @@
  "\n"
  " Options:\n"
- "  --codec=CODEC         Set the codec name. Valid codec names are:	\n"
- "                        pcma, pcmu, gsm, speexnb, speexwb, speexuwb.	\n"
- "                        (default: pcma).				\n"
+ "  --codec=CODEC         Set the codec name.                           \n"
  "  --local-port=PORT     Set local RTP port (default=4000)		\n"
  "  --remote=IP:PORT      Set the remote peer. If this option is set,	\n"
@@ -65,20 +63,4 @@
 
 
-struct codec
-{
-    char    *name;
-    char    *encoding_name;
-    int	     pt;
-    int	     clock_rate;
-} codec[] = 
-{
-    { "pcma",	  "pcma",  PJMEDIA_RTP_PT_PCMA, 8000 },
-    { "pcmu",	  "pcmu",  PJMEDIA_RTP_PT_PCMU, 8000 },
-    { "gsm",	  "gsm",   PJMEDIA_RTP_PT_GSM, 8000 },
-    { "speexnb",  "speex", 120, 8000 },
-    { "speexwb",  "speex", 121, 16000 },
-    { "speexuwb", "speex", 122, 32000 },
-};
-
 
 /* Prototype */
@@ -102,4 +84,7 @@
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
 
+    status = pjmedia_codec_l16_init(med_endpt, 0);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+
     return PJ_SUCCESS;
 }
@@ -111,5 +96,5 @@
 static pj_status_t create_stream( pj_pool_t *pool,
 				  pjmedia_endpt *med_endpt,
-				  unsigned codec_index,
+				  const pjmedia_codec_info *codec_info,
 				  pjmedia_dir dir,
 				  pj_uint16_t local_port,
@@ -128,9 +113,6 @@
     info.type = PJMEDIA_TYPE_AUDIO;
     info.dir = dir;
-    info.fmt.encoding_name = pj_str(codec[codec_index].encoding_name);
-    info.fmt.type = PJMEDIA_TYPE_AUDIO;
-    info.fmt.sample_rate = codec[codec_index].clock_rate;
-    info.fmt.pt = codec[codec_index].pt;
-    info.tx_pt = codec[codec_index].pt;
+    pj_memcpy(&info.fmt, codec_info, sizeof(pjmedia_codec_info));
+    info.tx_pt = codec_info->pt;
     info.ssrc = pj_rand();
     
@@ -199,4 +181,12 @@
 }
 
+
+/*
+ * usage()
+ */
+static void usage()
+{
+    puts(desc);
+}
 
 /*
@@ -218,8 +208,9 @@
 
     /* Default values */
-    int codec_index = 0;
+    const pjmedia_codec_info *codec_info;
     pjmedia_dir dir = PJMEDIA_DIR_DECODING;
     pj_sockaddr_in remote_addr;
     pj_uint16_t local_port = 4000;
+    char *codec_id = NULL;
     char *rec_file = NULL;
     char *play_file = NULL;
@@ -234,4 +225,5 @@
 	OPT_SEND_ONLY	= 's',
 	OPT_RECV_ONLY	= 'i',
+	OPT_HELP	= 'h',
     };
 
@@ -245,4 +237,5 @@
 	{ "send-only",      0, 0, OPT_SEND_ONLY },
 	{ "recv-only",      0, 0, OPT_RECV_ONLY },
+	{ "help",	    0, 0, OPT_HELP },
 	{ NULL, 0, 0, 0 },
     };
@@ -262,23 +255,9 @@
     /* Parse arguments */
     pj_optind = 0;
-    while((c=pj_getopt_long(argc,argv, "", long_options, &option_index))!=-1) {
+    while((c=pj_getopt_long(argc,argv, "h", long_options, &option_index))!=-1) {
 
 	switch (c) {
 	case OPT_CODEC:
-	    {
-		unsigned i;
-		for (i=0; i<PJ_ARRAY_SIZE(codec); ++i) {
-		    if (pj_ansi_stricmp(pj_optarg, codec[i].name)==0) {
-			break;
-		    }
-		}
-
-		if (i == PJ_ARRAY_SIZE(codec)) {
-		    printf("Error: unknown codec %s\n", pj_optarg);
-		    return 1;
-		}
-
-		codec_index = i;
-	    }
+	    codec_id = pj_optarg;
 	    break;
 
@@ -323,4 +302,8 @@
 	    dir = PJMEDIA_DIR_DECODING;
 	    break;
+
+	case OPT_HELP:
+	    usage();
+	    return 1;
 
 	default:
@@ -370,6 +353,24 @@
 
 
+    /* Find which codec to use. */
+    if (codec_id) {
+	unsigned count = 1;
+	pj_str_t str_codec_id = pj_str(codec_id);
+	pjmedia_codec_mgr *codec_mgr = pjmedia_endpt_get_codec_mgr(med_endpt);
+	status = pjmedia_codec_mgr_find_codecs_by_id( codec_mgr,
+						      &str_codec_id, &count,
+						      &codec_info, NULL);
+	if (status != PJ_SUCCESS) {
+	    printf("Error: unable to find codec %s\n", codec_id);
+	    return 1;
+	}
+    } else {
+	/* Default to pcmu */
+	pjmedia_codec_mgr_get_codec_info( pjmedia_endpt_get_codec_mgr(med_endpt),
+					  0, &codec_info);
+    }
+
     /* Create stream based on program arguments */
-    status = create_stream(pool, med_endpt, codec_index, dir, local_port, 
+    status = create_stream(pool, med_endpt, codec_info, dir, local_port, 
 			   &remote_addr, &stream);
     if (status != PJ_SUCCESS)
@@ -383,7 +384,10 @@
 
     if (play_file) {
-
-	status = pjmedia_file_player_port_create(pool, play_file, 0,
-						 -1, NULL, &play_file_port);
+	unsigned wav_ptime;
+
+	wav_ptime = stream_port->info.samples_per_frame * 1000 /
+		    stream_port->info.clock_rate;
+	status = pjmedia_wav_player_port_create(pool, play_file, wav_ptime,
+						0, -1, NULL, &play_file_port);
 	if (status != PJ_SUCCESS) {
 	    app_perror(THIS_FILE, "Unable to use file", status);
@@ -410,5 +414,5 @@
 	if (dir == PJMEDIA_DIR_ENCODING_DECODING)
 	    status = pjmedia_snd_port_create(pool, -1, -1, 
-					stream_port->info.sample_rate,
+					stream_port->info.clock_rate,
 					stream_port->info.channel_count,
 					stream_port->info.samples_per_frame,
@@ -417,5 +421,5 @@
 	else if (dir == PJMEDIA_DIR_ENCODING)
 	    status = pjmedia_snd_port_create_rec(pool, -1, 
-					stream_port->info.sample_rate,
+					stream_port->info.clock_rate,
 					stream_port->info.channel_count,
 					stream_port->info.samples_per_frame,
@@ -424,5 +428,5 @@
 	else
 	    status = pjmedia_snd_port_create_player(pool, -1, 
-					stream_port->info.sample_rate,
+					stream_port->info.clock_rate,
 					stream_port->info.channel_count,
 					stream_port->info.samples_per_frame,
@@ -577,10 +581,10 @@
    	(int)port->info.encoding_name.slen,
 	port->info.encoding_name.ptr,
-	port->info.sample_rate,
-	port->info.samples_per_frame * 1000 / port->info.sample_rate,
-	good_number(bps, port->info.bytes_per_frame * port->info.sample_rate /
-		    port->info.sample_rate),
+	port->info.clock_rate,
+	port->info.samples_per_frame * 1000 / port->info.clock_rate,
+	good_number(bps, port->info.bytes_per_frame * port->info.clock_rate /
+		    port->info.samples_per_frame),
 	good_number(ipbps, (port->info.bytes_per_frame+32) * 
-			    port->info.sample_rate / port->info.sample_rate));
+			    port->info.clock_rate / port->info.clock_rate));
 
     if (stat.rx.update_cnt == 0)
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 411)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 412)
@@ -663,4 +663,19 @@
 #endif /* PJMEDIA_HAS_GSM_CODEC */
 
+#if PJMEDIA_HAS_L16_CODEC
+	/* Register L16 */
+	status = pjmedia_codec_l16_init(pjsua.med_endpt, 0);
+	if (status != PJ_SUCCESS) {
+	    pjsua_perror(THIS_FILE, "Error initializing L16 codec",
+		         status);
+	    return status;
+	}
+
+	pjsua.codec_arg[pjsua.codec_cnt] = pj_str("l16");
+	pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_l16_deinit;
+	pjsua.codec_cnt++;
+#endif /* PJMEDIA_HAS_L16_CODEC */
+
+
 #if PJMEDIA_HAS_G711_CODEC
 	/* Register PCMA and PCMU */
@@ -731,4 +746,21 @@
 	    }
 #endif	/* PJMEDIA_HAS_GSM_CODEC */
+
+#if PJMEDIA_HAS_L16_CODEC
+	    /* Is it l16? */
+	    else if (!pj_stricmp2(&pjsua.codec_arg[i], "l16")) {
+
+		status = pjmedia_codec_l16_init(pjsua.med_endpt, 0);
+		if (status != PJ_SUCCESS) {
+		    pjsua_perror(THIS_FILE, "Error initializing L16 codec",
+			         status);
+		    return status;
+		}
+
+		pjsua.codec_deinit[i] = &pjmedia_codec_l16_deinit;
+
+		pjsua.clock_rate = 44100;
+	    }
+#endif	/* PJMEDIA_HAS_L16_CODEC */
 
 #if PJMEDIA_HAS_G711_CODEC
@@ -795,6 +827,6 @@
 
 	/* Create the file player port. */
-	status = pjmedia_file_player_port_create( pjsua.pool, pjsua.wav_file,
-						  0, -1, NULL, 
+	status = pjmedia_wav_player_port_create(  pjsua.pool, pjsua.wav_file,
+						  0, 0, -1, NULL, 
 						  &pjsua.file_port);
 	if (status != PJ_SUCCESS) {
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c	(revision 411)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c	(revision 412)
@@ -676,5 +676,5 @@
 		  info.stream_info[i].fmt.encoding_name.slen,
 		  info.stream_info[i].fmt.encoding_name.ptr,
-		  info.stream_info[i].fmt.sample_rate / 1000,
+		  info.stream_info[i].fmt.clock_rate / 1000,
 		  dir,
 		  rem_addr, rem_port));
