Index: pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/config.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/config.h	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/config.h	(revision 3425)
@@ -981,8 +981,8 @@
 /**
  * Maximum video frame size.
- * Default: 16kB
- */
-#ifndef PJMEDIA_MAX_VIDEO_FRAME_SIZE			
-#  define PJMEDIA_MAX_VIDEO_FRAME_SIZE			(1<<14)
+ * Default: 128kB
+ */
+#ifndef PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE
+#  define PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE	    (1<<17)
 #endif
 
Index: pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/format.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/format.h	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/format.h	(revision 3425)
@@ -182,4 +182,5 @@
     PJMEDIA_FORMAT_H261     = PJMEDIA_FORMAT_PACK('H', '2', '6', '1'),
     PJMEDIA_FORMAT_H263     = PJMEDIA_FORMAT_PACK('H', '2', '6', '3'),
+    PJMEDIA_FORMAT_H263P    = PJMEDIA_FORMAT_PACK('P', '2', '6', '3'),
 
     PJMEDIA_FORMAT_MJPEG    = PJMEDIA_FORMAT_PACK('M', 'J', 'P', 'G'),
@@ -187,4 +188,5 @@
     PJMEDIA_FORMAT_MPEG2VIDEO = PJMEDIA_FORMAT_PACK('M', 'P', '2', 'V'),
     PJMEDIA_FORMAT_MPEG4    = PJMEDIA_FORMAT_PACK('M', 'P', 'G', '4'),
+    PJMEDIA_FORMAT_XVID     = PJMEDIA_FORMAT_PACK('x', 'v', 'i', 'd'),
 
 } pjmedia_format_id;
Index: pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_codec.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_codec.h	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_codec.h	(revision 3425)
@@ -86,4 +86,16 @@
 
 /**
+ * Duplicate video codec parameter.
+ *
+ * @param pool	    The pool.
+ * @param src	    The video codec parameter to be duplicated.
+ *
+ * @return	    Duplicated codec parameter.
+ */
+PJ_DECL(pjmedia_vid_codec_param*) pjmedia_vid_codec_param_clone(
+					pj_pool_t *pool, 
+					const pjmedia_vid_codec_param *src);
+
+/**
  * Enumeration of video codec events.
  */
@@ -517,4 +529,5 @@
 					    unsigned *prio);
 
+
 /**
  * Get codec info for the specified static payload type.
@@ -531,4 +544,21 @@
 				      unsigned pt,
 				      const pjmedia_vid_codec_info **info);
+
+
+/**
+ * Get codec info for the specified format ID.
+ *
+ * @param mgr	    The codec manager instance. If NULL, the default codec
+ *		    manager instance will be used.
+ * @param fmt_id    Format ID. See #pjmedia_format_id
+ * @param info	    Pointer to receive codec info.
+ *
+ * @return	    PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) 
+pjmedia_vid_codec_mgr_get_codec_info2(pjmedia_vid_codec_mgr *mgr,
+				      pjmedia_format_id fmt_id,
+				      const pjmedia_vid_codec_info **info);
+
 
 /**
Index: pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_stream.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_stream.h	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_stream.h	(revision 3425)
@@ -89,4 +89,5 @@
 					 will be calculated from RTP.	    */
     unsigned		tx_pt;	    /**< Outgoing codec paylaod type.	    */
+    unsigned		rx_pt;	    /**< Incoming codec paylaod type.	    */
     pj_uint32_t		ssrc;	    /**< RTP SSRC.			    */
     pj_uint32_t		rtp_ts;	    /**< Initial RTP timestamp.		    */
@@ -221,4 +222,52 @@
 
 /**
+ * Get the stream statistics. See also #pjmedia_stream_get_stat_jbuf()
+ *
+ * @param stream	The video stream.
+ * @param stat		Media stream statistics.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_stream_get_stat(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_rtcp_stat *stat);
+
+/**
+ * Reset the video stream statistics.
+ *
+ * @param stream	The video stream.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_stream_reset_stat(pjmedia_vid_stream *stream);
+
+
+/**
+ * Get current jitter buffer state. See also #pjmedia_stream_get_stat()
+ *
+ * @param stream	The video stream.
+ * @param state		Jitter buffer state.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_stream_get_stat_jbuf(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_jb_state *state);
+
+
+/**
+ * Get the stream info.
+ *
+ * @param stream	The video stream.
+ * @param info		Video stream info.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_stream_get_info(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_vid_stream_info *info);
+
+
+/**
  * Start the video stream. This will start the appropriate channels
  * in the video stream, depending on the video direction that was set
@@ -233,43 +282,4 @@
 
 /**
- * Get the stream statistics. See also #pjmedia_stream_get_stat_jbuf()
- *
- * @param stream	The video stream.
- * @param stat		Media stream statistics.
- *
- * @return		PJ_SUCCESS on success.
- */
-PJ_DECL(pj_status_t) pjmedia_vid_stream_get_stat(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_rtcp_stat *stat);
-
-/**
- * Reset the video stream statistics.
- *
- * @param stream	The video stream.
- *
- * @return		PJ_SUCCESS on success.
- */
-PJ_DECL(pj_status_t) pjmedia_vid_stream_reset_stat(pjmedia_vid_stream *stream);
-
-
-/**
- * Get current jitter buffer state. See also #pjmedia_stream_get_stat()
- *
- * @param stream	The video stream.
- * @param state		Jitter buffer state.
- *
- * @return		PJ_SUCCESS on success.
- */
-PJ_DECL(pj_status_t) pjmedia_vid_stream_get_stat_jbuf(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_jb_state *state);
-
-
-PJ_DECL(pj_status_t) pjmedia_vid_stream_get_param(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_rtcp_stat *stat);
-
-/**
  * Pause the individual channel in the stream.
  *
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3425)
@@ -206,4 +206,5 @@
     /* Predefined info */
     pjmedia_vid_codec_info       info;
+    pjmedia_format_id		 base_fmt_id;
     func_packetize		 packetize;
     func_unpacketize		 unpacketize;
@@ -246,13 +247,27 @@
 {
     {
-	{PJMEDIA_FORMAT_H263,	{"H263",4},	PJMEDIA_RTP_PT_H263},
+	{PJMEDIA_FORMAT_H263P,	{"H263-1998",9},    PJMEDIA_RTP_PT_H263},
+	PJMEDIA_FORMAT_H263,
 	&h263_packetize, &h263_unpacketize, &h263_parse_fmtp,
 	{2, { {{"CIF",3}, {"2",1}}, {{"QCIF",4}, {"1",1}}, } },
     },
     {
-	{PJMEDIA_FORMAT_H261,	{"H261",4},	PJMEDIA_RTP_PT_H261},
+	{PJMEDIA_FORMAT_H263,	{"H263",4},	    PJMEDIA_RTP_PT_H263},
+	0,
+	&h263_packetize, &h263_unpacketize, &h263_parse_fmtp,
+	{2, { {{"CIF",3}, {"2",1}}, {{"QCIF",4}, {"1",1}}, } },
     },
     {
-	{PJMEDIA_FORMAT_MJPEG,	{"JPEG",4},	PJMEDIA_RTP_PT_JPEG},
+	{PJMEDIA_FORMAT_H261,	{"H261",4},	    PJMEDIA_RTP_PT_H261},
+    },
+    {
+	{PJMEDIA_FORMAT_MJPEG,	{"JPEG",4},	    PJMEDIA_RTP_PT_JPEG},
+    },
+    {
+	{PJMEDIA_FORMAT_MPEG4,	{"MP4V",4},	    PJMEDIA_RTP_PT_MPV},
+    },
+    {
+	{PJMEDIA_FORMAT_XVID,	{"XVID",4},	    PJMEDIA_RTP_PT_MPV},
+	PJMEDIA_FORMAT_MPEG4,
     },
 };
@@ -448,5 +463,5 @@
 
 
-static const ffmpeg_codec_desc* find_codec_info(
+static const ffmpeg_codec_desc* find_codec_desc_by_info(
 			const pjmedia_vid_codec_info *info)
 {
@@ -469,5 +484,5 @@
 
 
-static int find_codec_info_idx_by_fmt_id(pjmedia_format_id fmt_id)
+static int find_codec_idx_by_fmt_id(pjmedia_format_id fmt_id)
 {
     int i;
@@ -490,4 +505,5 @@
     AVCodec *c;
     pj_status_t status;
+    unsigned i;
 
     if (ffmpeg_factory.pool != NULL) {
@@ -533,4 +549,5 @@
          */
 
+	//PJ_LOG(3, (THIS_FILE, "%s", c->name));
 	status = CodecID_to_pjmedia_format_id(c->id, &fmt_id);
 	/* Skip if format ID is unknown */
@@ -538,5 +555,5 @@
 	    continue;
 
-	codec_info_idx = find_codec_info_idx_by_fmt_id(fmt_id);
+	codec_info_idx = find_codec_idx_by_fmt_id(fmt_id);
 	/* Skip if codec is unwanted by this wrapper (not listed in 
 	 * the codec info array)
@@ -635,4 +652,57 @@
     }
 
+    /* Init unassigned encoder/decoder description from base codec */
+    for (i = 0; i < PJ_ARRAY_SIZE(codec_desc); ++i) {
+	ffmpeg_codec_desc *desc = &codec_desc[i];
+
+	if (desc->base_fmt_id && (!desc->dec || !desc->enc)) {
+	    ffmpeg_codec_desc *base_desc = NULL;
+	    int base_desc_idx;
+	    pjmedia_dir copied_dir = PJMEDIA_DIR_NONE;
+
+	    base_desc_idx = find_codec_idx_by_fmt_id(desc->base_fmt_id);
+	    if (base_desc_idx != -1)
+		base_desc = &codec_desc[base_desc_idx];
+	    if (!base_desc || !base_desc->enabled)
+		continue;
+
+	    /* Copy description from base codec */
+	    if (!desc->info.dec_fmt_id_cnt) {
+		desc->info.dec_fmt_id_cnt = base_desc->info.dec_fmt_id_cnt;
+		pj_memcpy(desc->info.dec_fmt_id, base_desc->info.dec_fmt_id, 
+			  sizeof(pjmedia_format_id)*desc->info.dec_fmt_id_cnt);
+	    }
+	    if (!desc->info.fps_cnt) {
+		desc->info.fps_cnt = base_desc->info.fps_cnt;
+		pj_memcpy(desc->info.fps, base_desc->info.fps, 
+			  sizeof(desc->info.fps[0])*desc->info.fps_cnt);
+	    }
+	    if (!desc->info.clock_rate) {
+		desc->info.clock_rate = base_desc->info.clock_rate;
+	    }
+	    if (!desc->dec && base_desc->dec) {
+		copied_dir |= PJMEDIA_DIR_DECODING;
+		desc->dec = base_desc->dec;
+	    }
+	    if (!desc->enc && base_desc->enc) {
+		copied_dir |= PJMEDIA_DIR_ENCODING;
+		desc->enc = base_desc->enc;
+	    }
+
+	    desc->info.dir |= copied_dir;
+	    desc->enabled = (desc->info.dir != PJMEDIA_DIR_NONE);
+
+	    if (copied_dir != PJMEDIA_DIR_NONE) {
+		const char *dir_name[] = {NULL, "encoder", "decoder", "codec"};
+		PJ_LOG(5, (THIS_FILE, "The %.*s %s is using base codec (%.*s)",
+			   desc->info.encoding_name.slen,
+			   desc->info.encoding_name.ptr,
+			   dir_name[copied_dir],
+			   base_desc->info.encoding_name.slen,
+			   base_desc->info.encoding_name.ptr));
+	    }
+        }
+    }
+
     /* Register codec factory to codec manager. */
     status = pjmedia_vid_codec_mgr_register_factory(mgr, 
@@ -691,5 +761,5 @@
     PJ_ASSERT_RETURN(info, PJ_EINVAL);
 
-    desc = find_codec_info(info);
+    desc = find_codec_desc_by_info(info);
     if (!desc) {
         return PJMEDIA_CODEC_EUNSUP;
@@ -711,5 +781,5 @@
     PJ_ASSERT_RETURN(info && attr, PJ_EINVAL);
 
-    desc = find_codec_info(info);
+    desc = find_codec_desc_by_info(info);
     if (!desc) {
         return PJMEDIA_CODEC_EUNSUP;
@@ -742,14 +812,18 @@
 				       pjmedia_vid_codec_info codecs[])
 {
-    unsigned i;
+    unsigned i, max_cnt;
 
     PJ_ASSERT_RETURN(codecs && *count > 0, PJ_EINVAL);
     PJ_ASSERT_RETURN(factory == &ffmpeg_factory.base, PJ_EINVAL);
 
-    *count = PJ_MIN(*count, PJ_ARRAY_SIZE(codec_desc));
-
-    for (i=0; i<*count; ++i) {
-        pj_memcpy(&codecs[i], &codec_desc[i].info, 
-		  sizeof(pjmedia_vid_codec_info));
+    max_cnt = PJ_MIN(*count, PJ_ARRAY_SIZE(codec_desc));
+    *count = 0;
+
+    for (i=0; i<max_cnt; ++i) {
+	if (codec_desc[i].enabled) {
+	    pj_memcpy(&codecs[*count], &codec_desc[i].info, 
+		      sizeof(pjmedia_vid_codec_info));
+	    (*count)++;
+	}
     }
 
@@ -773,5 +847,5 @@
     PJ_ASSERT_RETURN(factory == &ffmpeg_factory.base, PJ_EINVAL);
 
-    desc = find_codec_info(info);
+    desc = find_codec_desc_by_info(info);
     if (!desc) {
         return PJMEDIA_CODEC_EUNSUP;
@@ -928,7 +1002,8 @@
 
             /* Decoding only attributes */
-	    // this setting will be automatically fetched from the bitstream.
-            //ctx->coded_width = ff->param.dec_fmt.det.vid.size.w;
-            //ctx->coded_height = ff->param.dec_fmt.det.vid.size.h;
+
+	    /* Width/height may be overriden by ffmpeg after first decoding. */
+            ctx->width = ctx->coded_width = ff->param.dec_fmt.det.vid.size.w;
+            ctx->height = ctx->coded_height = ff->param.dec_fmt.det.vid.size.h;
 
             /* For decoder, be more flexible */
@@ -1199,5 +1274,5 @@
 
     /* Validate output buffer size */
-    PJ_ASSERT_RETURN(ff->dec_vafp.framebytes <= output_buf_len, PJ_ETOOSMALL);
+    //PJ_ASSERT_RETURN(ff->dec_vafp.framebytes <= output_buf_len, PJ_ETOOSMALL);
 
     /* Init frame to receive the decoded data, the ffmpeg codec context will
@@ -1311,6 +1386,6 @@
 
 	/* Check provided buffer size after format changed */
-	if (vafp->framebytes > output_buf_len)
-	    return PJ_ETOOSMALL;
+	//if (vafp->framebytes > output_buf_len)
+	    //return PJ_ETOOSMALL;
 
 	/* Get the decoded data */
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/avi_player.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/avi_player.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/avi_player.c	(revision 3425)
@@ -340,4 +340,5 @@
             if (avi_hdr.strl_hdr[i].flags & AVISF_VIDEO_PALCHANGES ||
                 (avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_MJPEG &&
+                 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_XVID &&
                  avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_UYVY &&
                  avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_YUY2 &&
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/ffmpeg_util.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 3425)
@@ -52,10 +52,14 @@
 } ffmpeg_codec_table[] =
 {
-    {PJMEDIA_FORMAT_H261,  CODEC_ID_H261},
-    {PJMEDIA_FORMAT_H263,  CODEC_ID_H263},
-    {PJMEDIA_FORMAT_MPEG1VIDEO,  CODEC_ID_MPEG1VIDEO},
-    {PJMEDIA_FORMAT_MPEG2VIDEO,  CODEC_ID_MPEG2VIDEO},
-    {PJMEDIA_FORMAT_MPEG4,  CODEC_ID_MPEG4},    
-    {PJMEDIA_FORMAT_MJPEG,  CODEC_ID_MJPEG},
+    {PJMEDIA_FORMAT_H261,	CODEC_ID_H261},
+    {PJMEDIA_FORMAT_H263,	CODEC_ID_H263},
+    {PJMEDIA_FORMAT_H263P,	CODEC_ID_H263P},
+    {PJMEDIA_FORMAT_MPEG1VIDEO,	CODEC_ID_MPEG1VIDEO},
+    {PJMEDIA_FORMAT_MPEG2VIDEO, CODEC_ID_MPEG2VIDEO},
+    {PJMEDIA_FORMAT_MPEG4,	CODEC_ID_MPEG4},
+    {PJMEDIA_FORMAT_MJPEG,	CODEC_ID_MJPEG},
+#if LIBAVCODEC_VERSION_MAJOR < 53
+    {PJMEDIA_FORMAT_XVID,	CODEC_ID_XVID},
+#endif
 };
 
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream.c	(revision 3425)
@@ -3035,5 +3035,5 @@
 
     /* Media type must be audio */
-    if (pj_stricmp(&local_m->desc.media, &ID_AUDIO) == 0)
+    if (pj_stricmp(&local_m->desc.media, &ID_AUDIO) != 0)
 	return PJMEDIA_EINVALIMEDIATYPE;
 
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_codec.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_codec.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_codec.c	(revision 3425)
@@ -69,4 +69,36 @@
 
 /*
+ * Duplicate video codec parameter.
+ */
+PJ_DEF(pjmedia_vid_codec_param*) pjmedia_vid_codec_param_clone(
+					pj_pool_t *pool, 
+					const pjmedia_vid_codec_param *src)
+{
+    pjmedia_vid_codec_param *p;
+    unsigned i;
+
+    PJ_ASSERT_RETURN(pool && src, NULL);
+
+    p = PJ_POOL_ZALLOC_T(pool, pjmedia_vid_codec_param);
+
+    /* Update codec param */
+    pj_memcpy(p, src, sizeof(pjmedia_vid_codec_param));
+    for (i = 0; i < src->dec_fmtp.cnt; ++i) {
+	pj_strdup(pool, &p->dec_fmtp.param[i].name, 
+		  &src->dec_fmtp.param[i].name);
+	pj_strdup(pool, &p->dec_fmtp.param[i].val, 
+		  &src->dec_fmtp.param[i].val);
+    }
+    for (i = 0; i < src->enc_fmtp.cnt; ++i) {
+	pj_strdup(pool, &p->enc_fmtp.param[i].name, 
+		  &src->enc_fmtp.param[i].name);
+	pj_strdup(pool, &p->enc_fmtp.param[i].val, 
+		  &src->enc_fmtp.param[i].val);
+    }
+
+    return p;
+}
+
+/*
  * Initialize codec manager.
  */
@@ -306,4 +338,33 @@
 
 
+PJ_DEF(pj_status_t) pjmedia_vid_codec_mgr_get_codec_info2(
+				    pjmedia_vid_codec_mgr *mgr,
+				    pjmedia_format_id fmt_id,
+				    const pjmedia_vid_codec_info **p_info)
+{
+    unsigned i;
+
+    PJ_ASSERT_RETURN(p_info, PJ_EINVAL);
+
+    if (!mgr) mgr = def_vid_codec_mgr;
+    PJ_ASSERT_RETURN(mgr, PJ_EINVAL);
+
+    pj_mutex_lock(mgr->mutex);
+
+    for (i=0; i<mgr->codec_cnt; ++i) {
+	if (mgr->codec_desc[i].info.fmt_id == fmt_id) {
+	    *p_info = &mgr->codec_desc[i].info;
+
+	    pj_mutex_unlock(mgr->mutex);
+	    return PJ_SUCCESS;
+	}
+    }
+
+    pj_mutex_unlock(mgr->mutex);
+
+    return PJMEDIA_CODEC_EUNSUP;
+}
+
+
 /*
  * Convert codec info struct into a unique codec identifier.
@@ -633,21 +694,9 @@
     }
 
-    p = PJ_POOL_ZALLOC_T(pool, pjmedia_vid_codec_param);
-    p = codec_desc->def_param;
-
-    /* Update codec param */
-    pj_memcpy(p, param, sizeof(pjmedia_vid_codec_param));
-    for (i = 0; i < param->dec_fmtp.cnt; ++i) {
-	pj_strdup(pool, &p->dec_fmtp.param[i].name, 
-		  &param->dec_fmtp.param[i].name);
-	pj_strdup(pool, &p->dec_fmtp.param[i].val, 
-		  &param->dec_fmtp.param[i].val);
-    }
-    for (i = 0; i < param->enc_fmtp.cnt; ++i) {
-	pj_strdup(pool, &p->enc_fmtp.param[i].name, 
-		  &param->enc_fmtp.param[i].name);
-	pj_strdup(pool, &p->enc_fmtp.param[i].val, 
-		  &param->enc_fmtp.param[i].val);
-    }
+    /* Update codec default param */
+    p = pjmedia_vid_codec_param_clone(pool, param);
+    if (!p)
+	return PJ_EINVAL;
+    codec_desc->def_param = p;
 
     pj_mutex_unlock(mgr->mutex);
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_stream.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_stream.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_stream.c	(revision 3425)
@@ -85,4 +85,5 @@
     pjmedia_endpt	    *endpt;	    /**< Media endpoint.	    */
     pjmedia_vid_codec_mgr   *codec_mgr;	    /**< Codec manager.		    */
+    pjmedia_vid_stream_info  info;	    /**< Stream info.		    */
 
     pjmedia_vid_channel	    *enc;	    /**< Encoding channel.	    */
@@ -129,13 +130,9 @@
 
 #if TRACE_JB
-    pj_oshandle_t	    trace_jb_fd;	    /**< Jitter tracing file handle.*/
-    char		   *trace_jb_buf;	    /**< Jitter tracing buffer.	    */
+    pj_oshandle_t	     trace_jb_fd;   /**< Jitter tracing file handle.*/
+    char		    *trace_jb_buf;  /**< Jitter tracing buffer.	    */
 #endif
 
-    pjmedia_vid_codec	    *codec;	            /**< Codec instance being used. */
-    pjmedia_vid_codec_info   codec_info;           /**< Codec param.		    */
-    pjmedia_vid_codec_param  codec_param;          /**< Codec param.		    */
-
-    pjmedia_vid_stream_info     info;
+    pjmedia_vid_codec	    *codec;	    /**< Codec instance being used. */
 };
 
@@ -627,9 +624,5 @@
 	status = pjmedia_jbuf_reset(stream->jb);
 	PJ_LOG(4,(channel->port.info.name.ptr, "Jitter buffer reset"));
-
     } else {
-
-	/* Video stream */
-
 	/* Just put the payload into jitter buffer */
 	pjmedia_jbuf_put_frame3(stream->jb, payload, payloadlen, 0, 
@@ -928,8 +921,9 @@
     if (frame->bit_info & PJMEDIA_VID_CODEC_EVENT_FMT_CHANGED) {
 	/* Update param from codec */
-	stream->codec->op->get_param(stream->codec, &stream->codec_param);
+	stream->codec->op->get_param(stream->codec, stream->info.codec_param);
 
 	/* Update decoding channel port info */
-	stream->dec->port.info.fmt = stream->codec_param.dec_fmt;
+	pjmedia_format_copy(&stream->dec->port.info.fmt,
+			    &stream->info.codec_param->dec_fmt);
     }
     
@@ -965,8 +959,8 @@
     /* Init vars */
     if (dir==PJMEDIA_DIR_DECODING) {
-	type_name = "vstrmdec";
+	type_name = "vstdec";
 	fmt = &info->codec_param->dec_fmt;
     } else {
-	type_name = "vstrmenc";
+	type_name = "vstenc";
 	fmt = &info->codec_param->enc_fmt;
     }
@@ -1054,4 +1048,7 @@
     PJ_ASSERT_RETURN(stream != NULL, PJ_ENOMEM);
 
+    /* Copy stream info */
+    pj_memcpy(&stream->info, info, sizeof(*info));
+
     /* Get codec manager */
     stream->codec_mgr = pjmedia_vid_codec_mgr_instance();
@@ -1064,5 +1061,4 @@
 
     /* Create and initialize codec: */
-    stream->codec_info = info->codec_info;
     status = pjmedia_vid_codec_mgr_alloc_codec(stream->codec_mgr, 
 					       &info->codec_info,
@@ -1073,16 +1069,25 @@
 
     /* Get codec param: */
-    if (info->codec_param)
-	stream->codec_param = *info->codec_param;
-    else {
+    if (info->codec_param) {
+	stream->info.codec_param = pjmedia_vid_codec_param_clone(
+							pool,
+							info->codec_param);
+    } else {
+	pjmedia_vid_codec_param def_param;
+
 	status = pjmedia_vid_codec_mgr_get_default_param(stream->codec_mgr, 
 						         &info->codec_info,
-						         &stream->codec_param);
+						         &def_param);
 	if (status != PJ_SUCCESS)
 	    return status;
+	stream->info.codec_param = pjmedia_vid_codec_param_clone(
+							pool,
+							&def_param);
+	pj_assert(stream->info.codec_param);
     }
 
     vfd_enc = pjmedia_format_get_video_format_detail(
-                                            &stream->codec_param.enc_fmt, 1);
+					&stream->info.codec_param->enc_fmt,
+					PJ_TRUE);
 
     /* Init stream: */
@@ -1117,6 +1122,7 @@
 
     /* Init codec param */
-    stream->codec_param.dir = info->dir;
-    stream->codec_param.enc_mtu = PJMEDIA_MAX_MTU - sizeof(pjmedia_rtp_hdr);
+    stream->info.codec_param->dir = info->dir;
+    stream->info.codec_param->enc_mtu = PJMEDIA_MAX_MTU - 
+					sizeof(pjmedia_rtp_hdr);
 
     /* Init and open the codec. */
@@ -1124,5 +1130,5 @@
     if (status != PJ_SUCCESS)
 	return status;
-    status = stream->codec->op->open(stream->codec, &stream->codec_param);
+    status = stream->codec->op->open(stream->codec, stream->info.codec_param);
     if (status != PJ_SUCCESS)
 	return status;
@@ -1140,7 +1146,7 @@
     /* Validate the frame size */
     if (stream->frame_size == 0 || 
-	stream->frame_size > PJMEDIA_MAX_VIDEO_FRAME_SIZE)
+	stream->frame_size > PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE)
     {
-	stream->frame_size = PJMEDIA_MAX_VIDEO_FRAME_SIZE;
+	stream->frame_size = PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE;
     }
 
@@ -1151,5 +1157,5 @@
     /* Create decoder channel */
     status = create_channel( pool, stream, PJMEDIA_DIR_DECODING, 
-			     info->codec_info.pt, info, &stream->dec);
+			     info->rx_pt, info, &stream->dec);
     if (status != PJ_SUCCESS)
 	return status;
@@ -1408,4 +1414,75 @@
 
 /*
+ * Get stream statistics.
+ */
+PJ_DEF(pj_status_t) pjmedia_vid_stream_get_stat(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_rtcp_stat *stat)
+{
+    PJ_ASSERT_RETURN(stream && stat, PJ_EINVAL);
+
+    pj_memcpy(stat, &stream->rtcp.stat, sizeof(pjmedia_rtcp_stat));
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Reset the stream statistics in the middle of a stream session.
+ */
+PJ_DEF(pj_status_t) pjmedia_vid_stream_reset_stat(pjmedia_vid_stream *stream)
+{
+    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
+
+    pjmedia_rtcp_init_stat(&stream->rtcp.stat);
+
+    return PJ_SUCCESS;
+}
+
+
+#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
+/*
+ * Get stream extended statistics.
+ */
+PJ_DEF(pj_status_t) pjmedia_stream_get_stat_xr(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_rtcp_xr_stat *stat)
+{
+    PJ_ASSERT_RETURN(stream && stat, PJ_EINVAL);
+
+    if (stream->rtcp.xr_enabled) {
+	pj_memcpy(stat, &stream->rtcp.xr_session.stat,
+		  sizeof(pjmedia_rtcp_xr_stat));
+	return PJ_SUCCESS;
+    }
+    return PJ_ENOTFOUND;
+}
+#endif
+
+/*
+ * Get jitter buffer state.
+ */
+PJ_DEF(pj_status_t) pjmedia_vid_stream_get_stat_jbuf(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_jb_state *state)
+{
+    PJ_ASSERT_RETURN(stream && state, PJ_EINVAL);
+    return pjmedia_jbuf_get_state(stream->jb, state);
+}
+
+
+/*
+ * Get the stream info.
+ */
+PJ_DEF(pj_status_t) pjmedia_vid_stream_get_info(
+					    const pjmedia_vid_stream *stream,
+					    pjmedia_vid_stream_info *info)
+{
+    PJ_ASSERT_RETURN(stream && info, PJ_EINVAL);
+    pj_memcpy(info, &stream->info, sizeof(*info));
+    return PJ_SUCCESS;
+}
+
+
+/*
  * Start stream.
  */
@@ -1434,61 +1511,4 @@
 }
 
-
-/*
- * Get stream statistics.
- */
-PJ_DEF(pj_status_t) pjmedia_vid_stream_get_stat(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_rtcp_stat *stat)
-{
-    PJ_ASSERT_RETURN(stream && stat, PJ_EINVAL);
-
-    pj_memcpy(stat, &stream->rtcp.stat, sizeof(pjmedia_rtcp_stat));
-    return PJ_SUCCESS;
-}
-
-
-/*
- * Reset the stream statistics in the middle of a stream session.
- */
-PJ_DEF(pj_status_t) pjmedia_vid_stream_reset_stat(pjmedia_vid_stream *stream)
-{
-    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
-
-    pjmedia_rtcp_init_stat(&stream->rtcp.stat);
-
-    return PJ_SUCCESS;
-}
-
-
-#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
-/*
- * Get stream extended statistics.
- */
-PJ_DEF(pj_status_t) pjmedia_stream_get_stat_xr(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_rtcp_xr_stat *stat)
-{
-    PJ_ASSERT_RETURN(stream && stat, PJ_EINVAL);
-
-    if (stream->rtcp.xr_enabled) {
-	pj_memcpy(stat, &stream->rtcp.xr_session.stat,
-		  sizeof(pjmedia_rtcp_xr_stat));
-	return PJ_SUCCESS;
-    }
-    return PJ_ENOTFOUND;
-}
-#endif
-
-/*
- * Get jitter buffer state.
- */
-PJ_DEF(pj_status_t) pjmedia_vid_stream_get_stat_jbuf(
-					    const pjmedia_vid_stream *stream,
-					    pjmedia_jb_state *state)
-{
-    PJ_ASSERT_RETURN(stream && state, PJ_EINVAL);
-    return pjmedia_jbuf_get_state(stream->jb, state);
-}
 
 /*
@@ -1579,4 +1599,5 @@
      */
     pt = pj_strtoul(&local_m->desc.fmt[0]);
+    si->rx_pt = pt;
     if (pt < 96) {
 	const pjmedia_vid_codec_info *p_info;
@@ -1660,5 +1681,5 @@
 
     /* Get local fmtp for our decoder. */
-    pjmedia_stream_info_parse_fmtp(pool, local_m, pt,
+    pjmedia_stream_info_parse_fmtp(pool, local_m, si->rx_pt,
 				   &si->codec_param->dec_fmtp);
 
@@ -1718,5 +1739,5 @@
 
     /* Media type must be audio */
-    if (pj_stricmp(&local_m->desc.media, &ID_VIDEO) == 0)
+    if (pj_stricmp(&local_m->desc.media, &ID_VIDEO) != 0)
 	return PJMEDIA_EINVALIMEDIATYPE;
 
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_codec_test.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_codec_test.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_codec_test.c	(revision 3425)
@@ -21,16 +21,19 @@
 {
     codec_port_data_t *port_data = (codec_port_data_t*)port->port_data.pdata;
-    pjmedia_vid_codec *codec = port_data->codec;
-    pjmedia_frame enc_frame;
     pj_status_t status;
 
-    enc_frame.buf = port_data->enc_buf;
-    enc_frame.size = port_data->enc_buf_size;
-
 #if !BYPASS_CODEC
-    status = codec->op->encode(codec, frame, enc_frame.size, &enc_frame);
-    if (status != PJ_SUCCESS) goto on_error;
-    status = codec->op->decode(codec, &enc_frame, frame->size, frame);
-    if (status != PJ_SUCCESS) goto on_error;
+    {
+	pjmedia_vid_codec *codec = port_data->codec;
+	pjmedia_frame enc_frame;
+
+	enc_frame.buf = port_data->enc_buf;
+	enc_frame.size = port_data->enc_buf_size;
+
+	status = codec->op->encode(codec, frame, enc_frame.size, &enc_frame);
+	if (status != PJ_SUCCESS) goto on_error;
+	status = codec->op->decode(codec, &enc_frame, frame->size, frame);
+	if (status != PJ_SUCCESS) goto on_error;
+    }
 #endif
 
@@ -88,4 +91,5 @@
                               pjmedia_format_id raw_fmt_id)
 {
+    const pj_str_t port_name = {"codec", 5};
 
     pjmedia_vid_codec *codec=NULL;
@@ -163,4 +167,48 @@
     }
 
+    /* Prepare codec */
+    {
+        pj_str_t codec_id_st;
+        unsigned info_cnt = 1;
+        const pjmedia_vid_codec_info *codec_info;
+
+        /* Lookup codec */
+        pj_cstr(&codec_id_st, codec_id);
+        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL, &codec_id_st, 
+                                                         &info_cnt, 
+                                                         &codec_info, NULL);
+        if (status != PJ_SUCCESS) {
+            rc = 245; goto on_return;
+        }
+        status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info,
+                                                         &codec_param);
+        if (status != PJ_SUCCESS) {
+            rc = 246; goto on_return;
+        }
+
+#if !BYPASS_CODEC
+
+        /* Open codec */
+        status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info,
+                                                   &codec);
+        if (status != PJ_SUCCESS) {
+	    rc = 250; goto on_return;
+        }
+
+        status = codec->op->init(codec, pool);
+        if (status != PJ_SUCCESS) {
+	    rc = 251; goto on_return;
+        }
+
+	codec_param.dec_fmt.id = raw_fmt_id;
+        status = codec->op->open(codec, &codec_param);
+        if (status != PJ_SUCCESS) {
+	    rc = 252; goto on_return;
+        }
+
+#endif /* !BYPASS_CODEC */
+    }
+
+
     pjmedia_vid_port_param_default(&vport_param);
 
@@ -171,4 +219,5 @@
 	rc = 220; goto on_return;
     }
+    pjmedia_format_copy(&vport_param.vidparam.fmt, &codec_param.dec_fmt);
     vport_param.vidparam.fmt.id = raw_fmt_id;
     vport_param.vidparam.dir = PJMEDIA_DIR_CAPTURE;
@@ -201,74 +250,22 @@
     }
 
-    /* Prepare codec */
-    {
-        pj_str_t codec_id_st;
-        unsigned info_cnt = 1;
-        const pjmedia_vid_codec_info *codec_info;
-        pj_str_t port_name = {"codec", 5};
-        pj_uint8_t *enc_buf = NULL;
-        pj_size_t enc_buf_size = 0;
-
-
-        /* Lookup codec */
-        pj_cstr(&codec_id_st, codec_id);
-        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL, &codec_id_st, 
-                                                         &info_cnt, 
-                                                         &codec_info, NULL);
-        if (status != PJ_SUCCESS) {
-            rc = 245; goto on_return;
-        }
-        status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info,
-                                                         &codec_param);
-        if (status != PJ_SUCCESS) {
-            rc = 246; goto on_return;
-        }
-
-        pjmedia_format_copy(&codec_param.dec_fmt, &vport_param.vidparam.fmt);
-
-#if !BYPASS_CODEC
-
-        /* Open codec */
-        status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info,
-                                                   &codec);
-        if (status != PJ_SUCCESS) {
-	    rc = 250; goto on_return;
-        }
-
-        status = codec->op->init(codec, pool);
-        if (status != PJ_SUCCESS) {
-	    rc = 251; goto on_return;
-        }
-
-        status = codec->op->open(codec, &codec_param);
-        if (status != PJ_SUCCESS) {
-	    rc = 252; goto on_return;
-        }
-
-        /* Alloc encoding buffer */
-        enc_buf_size =  codec_param.dec_fmt.det.vid.size.w *
-                        codec_param.dec_fmt.det.vid.size.h * 4
-                        + 16; /*< padding, just in case */
-        enc_buf = pj_pool_alloc(pool,enc_buf_size);
-
-#endif /* !BYPASS_CODEC */
-
-        /* Init codec port */
-        pj_bzero(&codec_port, sizeof(codec_port));
-        status = pjmedia_port_info_init2(&codec_port.info, &port_name, 0x1234,
-                                         PJMEDIA_DIR_ENCODING, 
-                                         &codec_param.dec_fmt);
-        if (status != PJ_SUCCESS) {
-	    rc = 260; goto on_return;
-        }
-        codec_port_data.codec = codec;
-        codec_port_data.dn_port = pjmedia_vid_port_get_passive_port(renderer);
-        codec_port_data.enc_buf = enc_buf;
-        codec_port_data.enc_buf_size = enc_buf_size;
-
-        codec_port.put_frame = &codec_put_frame;
-        codec_port.port_data.pdata = &codec_port_data;
-    }
-
+    /* Init codec port */
+    pj_bzero(&codec_port, sizeof(codec_port));
+    status = pjmedia_port_info_init2(&codec_port.info, &port_name, 0x1234,
+                                     PJMEDIA_DIR_ENCODING, 
+                                     &codec_param.dec_fmt);
+    if (status != PJ_SUCCESS) {
+	rc = 260; goto on_return;
+    }
+
+    codec_port_data.codec = codec;
+    codec_port_data.dn_port = pjmedia_vid_port_get_passive_port(renderer);
+    codec_port_data.enc_buf_size = codec_param.dec_fmt.det.vid.size.w *
+				   codec_param.dec_fmt.det.vid.size.h * 4;
+    codec_port_data.enc_buf = pj_pool_alloc(pool, 
+					    codec_port_data.enc_buf_size);
+
+    codec_port.put_frame = &codec_put_frame;
+    codec_port.port_data.pdata = &codec_port_data;
 
     /* Connect capture to codec port */
@@ -280,13 +277,25 @@
     }
 
-    PJ_LOG(3, (THIS_FILE, "  starting codec test:  %c%c%c%c<->%s %dx%d",
+#if BYPASS_CODEC
+    PJ_LOG(3, (THIS_FILE, "  starting loopback test: %c%c%c%c %dx%d",
+        ((raw_fmt_id & 0x000000FF) >> 0),
+        ((raw_fmt_id & 0x0000FF00) >> 8),
+        ((raw_fmt_id & 0x00FF0000) >> 16),
+        ((raw_fmt_id & 0xFF000000) >> 24),
+        codec_param.dec_fmt.det.vid.size.w,
+        codec_param.dec_fmt.det.vid.size.h
+        ));
+#else
+    PJ_LOG(3, (THIS_FILE, "  starting codec test: %c%c%c%c<->%.*s %dx%d",
         ((codec_param.dec_fmt.id & 0x000000FF) >> 0),
         ((codec_param.dec_fmt.id & 0x0000FF00) >> 8),
         ((codec_param.dec_fmt.id & 0x00FF0000) >> 16),
         ((codec_param.dec_fmt.id & 0xFF000000) >> 24),
-        codec_id, 
+	codec_info->encoding_name.slen,
+	codec_info->encoding_name.ptr,
         codec_param.dec_fmt.det.vid.size.w,
         codec_param.dec_fmt.det.vid.size.h
         ));
+#endif
 
     /* Start streaming.. */
@@ -328,4 +337,8 @@
     int rc = 0;
     pj_status_t status;
+    int orig_log_level;
+    
+    orig_log_level = pj_log_get_level();
+    pj_log_set_level(6);
 
     PJ_LOG(3, (THIS_FILE, "Performing video codec tests.."));
@@ -345,5 +358,5 @@
 	goto on_return;
 
-    rc = encode_decode_test(pool, "mjpeg", 0);
+    rc = encode_decode_test(pool, "h263", 0);
     if (rc != 0)
 	goto on_return;
@@ -353,4 +366,5 @@
     pjmedia_vid_subsys_shutdown();
     pj_pool_release(pool);
+    pj_log_set_level(orig_log_level);
 
     return rc;
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_dev_test.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_dev_test.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_dev_test.c	(revision 3425)
@@ -58,5 +58,5 @@
 }
 
-static pj_status_t vid_event_cb(pjmedia_vid_stream *stream,
+static pj_status_t vid_event_cb(pjmedia_vid_dev_stream *stream,
 				void *user_data,
 				pjmedia_vid_event *event)
Index: pjproject/branches/projects/2.0-dev/pjproject-vs8.sln
===================================================================
--- pjproject/branches/projects/2.0-dev/pjproject-vs8.sln	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjproject-vs8.sln	(revision 3425)
@@ -109,23 +109,22 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpjproject", "pjsip-apps\build\libpjproject.vcproj", "{23D7679C-764C-4E02-8B29-BB882CEEEFE2}"
 	ProjectSection(ProjectDependencies) = postProject
+		{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
+		{2A3F241E-682C-47E1-9543-DC28708B406A} = {2A3F241E-682C-47E1-9543-DC28708B406A}
+		{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
+		{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
+		{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
+		{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
+		{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
+		{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
+		{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
+		{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
+		{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
+		{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
+		{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
+		{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
+		{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
+		{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
+		{A1989FF3-9894-40F4-B5A6-6EA364476E45} = {A1989FF3-9894-40F4-B5A6-6EA364476E45}
 		{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
-		{A1989FF3-9894-40F4-B5A6-6EA364476E45} = {A1989FF3-9894-40F4-B5A6-6EA364476E45}
-		{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
-		{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
-		{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
-		{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
-		{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
-		{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
-		{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
-		{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
-		{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
-		{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
-		{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
-		{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
-		{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
-		{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
-		{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
-		{2A3F241E-682C-47E1-9543-DC28708B406A} = {2A3F241E-682C-47E1-9543-DC28708B406A}
-		{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
 	EndProjectSection
 EndProject
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples-vc.mak
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples-vc.mak	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples-vc.mak	(revision 3425)
@@ -89,5 +89,5 @@
 	  $(BINDIR)\strerror.exe \
 	  $(BINDIR)\tonegen.exe \
-	  $(BINDIR)\vstreamutil.exe
+	  $(BINDIR)\vid_streamutil.exe
 
 
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples.mak
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples.mak	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/build/Samples.mak	(revision 3425)
@@ -41,5 +41,5 @@
 	   strerror \
 	   tonegen \
-	   vstreamutil
+	   vid_streamutil
 
 EXES := $(foreach file, $(SAMPLES), $(BINDIR)/$(file)$(HOST_EXE))
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/build/samples.vcproj
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/build/samples.vcproj	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/build/samples.vcproj	(revision 3425)
@@ -137,4 +137,160 @@
 		</Configuration>
 		<Configuration
+			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
@@ -239,4 +395,160 @@
 		</Configuration>
 		<Configuration
+			Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug-Static|Win32"
 			OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
@@ -341,4 +653,160 @@
 		</Configuration>
 		<Configuration
+			Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release-Dynamic|Win32"
 			OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
@@ -443,4 +911,160 @@
 		</Configuration>
 		<Configuration
+			Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
 			Name="Debug-Dynamic|Win32"
 			OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
@@ -545,4 +1169,160 @@
 		</Configuration>
 		<Configuration
+			Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
+			IntermediateDirectory="$(OutDir)"
+			ConfigurationType="0"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			BuildLogFile=""
+			>
+			<Tool
+				Name="VCNMakeTool"
+				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
+				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
+				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
+				Output="All samples"
+				PreprocessorDefinitions=""
+				IncludeSearchPath=""
+				ForcedIncludes=""
+				AssemblySearchPath=""
+				ForcedUsingAssemblies=""
+				CompileAsManaged=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release-Static|Win32"
 			OutputDirectory=".\output\$(ProjectName)-i386-$(PlatformName)-vs8-$(ConfigurationName)"
@@ -622,784 +1402,4 @@
 				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 /a"
 				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-static VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-static VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=release-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6std-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm6pro-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5ppc-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
-				Output="All samples"
-				PreprocessorDefinitions=""
-				IncludeSearchPath=""
-				ForcedIncludes=""
-				AssemblySearchPath=""
-				ForcedUsingAssemblies=""
-				CompileAsManaged=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				ExecutionBucket="7"
-			/>
-			<Tool
-				Name="VCCodeSignTool"
-			/>
-			<DeploymentTool
-				ForceDirty="-1"
-				RemoteDirectory=""
-				RegisterOutput="0"
-				AdditionalFiles=""
-			/>
-			<DebuggerTool
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
-			OutputDirectory=".\output\$(ProjectName)-wm5sp-$(PlatformName)-vs8-$(ConfigurationName)"
-			IntermediateDirectory="$(OutDir)"
-			ConfigurationType="0"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			BuildLogFile=""
-			>
-			<Tool
-				Name="VCNMakeTool"
-				BuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8"
-				ReBuildCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 /a"
-				CleanCommandLine="nmake /NOLOGO /S /f Samples-vc.mak BUILD_MODE=debug-dynamic VC_VER=8 clean"
 				Output="All samples"
 				PreprocessorDefinitions=""
@@ -1715,5 +1715,5 @@
 			</File>
 			<File
-				RelativePath="..\src\samples\vstreamutil.c"
+				RelativePath="..\src\samples\vid_streamutil.c"
 				>
 			</File>
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/aviplay.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/aviplay.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/aviplay.c	(revision 3425)
@@ -86,4 +86,5 @@
                   {PJMEDIA_FORMAT_H263 , "h263" ,
                    PJ_FALSE, 0},
+		  {PJMEDIA_FORMAT_XVID , "xvid"},
                  };
 
@@ -106,5 +107,5 @@
 } codec_port_data_t;
 
-static pj_status_t avi_event_cb(pjmedia_vid_stream *stream,
+static pj_status_t avi_event_cb(pjmedia_vid_dev_stream *stream,
 				void *user_data,
 				pjmedia_vid_event *event)
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/simpleua.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/simpleua.c	(revision 3424)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/simpleua.c	(revision 3425)
@@ -68,9 +68,17 @@
 
 /* Settings */
-#define AF	    pj_AF_INET()     /* Change to pj_AF_INET6() for IPv6.
+#define AF		pj_AF_INET() /* Change to pj_AF_INET6() for IPv6.
 				      * PJ_HAS_IPV6 must be enabled and
 				      * your system must support IPv6.  */
-#define SIP_PORT    5060	     /* Listening SIP port		*/
-#define RTP_PORT    4000	     /* RTP port			*/
+#if 0
+#define SIP_PORT	5080	     /* Listening SIP port		*/
+#define RTP_PORT	5000	     /* RTP port			*/
+#else
+#define SIP_PORT	5060	     /* Listening SIP port		*/
+#define RTP_PORT	4000	     /* RTP port			*/
+#endif
+
+#define MAX_MEDIA_CNT	2	     /* Media count, set to 1 for audio
+				      * only or 2 for audio and video	*/
 
 /*
@@ -83,12 +91,20 @@
 
 static pjmedia_endpt	    *g_med_endpt;   /* Media endpoint.		*/
-static pjmedia_transport_info g_med_tpinfo; /* Socket info for media	*/
-static pjmedia_transport    *g_med_transport;/* Media stream transport	*/
+
+static pjmedia_transport_info g_med_tpinfo[MAX_MEDIA_CNT]; 
+					    /* Socket info for media	*/
+static pjmedia_transport    *g_med_transport[MAX_MEDIA_CNT];
+					    /* Media stream transport	*/
+static pjmedia_sock_info     g_sock_info[MAX_MEDIA_CNT];  
+					    /* Socket info array	*/
 
 /* Call variables: */
 static pjsip_inv_session    *g_inv;	    /* Current invite session.	*/
-static pjmedia_session	    *g_med_session; /* Call's media session.	*/
+static pjmedia_stream       *g_med_stream;  /* Call's audio stream.	*/
+static pjmedia_vid_stream   *g_med_vstream; /* Call's video stream.	*/
 static pjmedia_snd_port	    *g_snd_player;  /* Call's sound player	*/
 static pjmedia_snd_port	    *g_snd_rec;	    /* Call's sound recorder.	*/
+static pjmedia_vid_port	    *g_vid_capturer;/* Call's video capturer.	*/
+static pjmedia_vid_port	    *g_vid_renderer;/* Call's video renderer.	*/
 
 
@@ -137,4 +153,66 @@
 
 
+/* Notification on incoming messages */
+static pj_bool_t logging_on_rx_msg(pjsip_rx_data *rdata)
+{
+    PJ_LOG(4,(THIS_FILE, "RX %d bytes %s from %s %s:%d:\n"
+			 "%.*s\n"
+			 "--end msg--",
+			 rdata->msg_info.len,
+			 pjsip_rx_data_get_info(rdata),
+			 rdata->tp_info.transport->type_name,
+			 rdata->pkt_info.src_name,
+			 rdata->pkt_info.src_port,
+			 (int)rdata->msg_info.len,
+			 rdata->msg_info.msg_buf));
+    
+    /* Always return false, otherwise messages will not get processed! */
+    return PJ_FALSE;
+}
+
+/* Notification on outgoing messages */
+static pj_status_t logging_on_tx_msg(pjsip_tx_data *tdata)
+{
+    
+    /* Important note:
+     *	tp_info field is only valid after outgoing messages has passed
+     *	transport layer. So don't try to access tp_info when the module
+     *	has lower priority than transport layer.
+     */
+
+    PJ_LOG(4,(THIS_FILE, "TX %d bytes %s to %s %s:%d:\n"
+			 "%.*s\n"
+			 "--end msg--",
+			 (tdata->buf.cur - tdata->buf.start),
+			 pjsip_tx_data_get_info(tdata),
+			 tdata->tp_info.transport->type_name,
+			 tdata->tp_info.dst_name,
+			 tdata->tp_info.dst_port,
+			 (int)(tdata->buf.cur - tdata->buf.start),
+			 tdata->buf.start));
+
+    /* Always return success, otherwise message will not get sent! */
+    return PJ_SUCCESS;
+}
+
+/* The module instance. */
+static pjsip_module msg_logger = 
+{
+    NULL, NULL,				/* prev, next.		*/
+    { "mod-msg-log", 13 },		/* Name.		*/
+    -1,					/* Id			*/
+    PJSIP_MOD_PRIORITY_TRANSPORT_LAYER-1,/* Priority	        */
+    NULL,				/* load()		*/
+    NULL,				/* start()		*/
+    NULL,				/* stop()		*/
+    NULL,				/* unload()		*/
+    &logging_on_rx_msg,			/* on_rx_request()	*/
+    &logging_on_rx_msg,			/* on_rx_response()	*/
+    &logging_on_tx_msg,			/* on_tx_request.	*/
+    &logging_on_tx_msg,			/* on_tx_response()	*/
+    NULL,				/* on_tsx_state()	*/
+
+};
+
 
 /*
@@ -146,5 +224,7 @@
 int main(int argc, char *argv[])
 {
+    pj_pool_t *pool;
     pj_status_t status;
+    unsigned i;
 
     /* Must init PJLIB first: */
@@ -152,4 +232,5 @@
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
 
+    pj_log_set_level(5);
 
     /* Then init PJLIB-UTIL: */
@@ -263,4 +344,10 @@
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
 
+    /*
+     * Register message logger module.
+     */
+    status = pjsip_endpt_register_module( g_endpt, &msg_logger);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
 
     /* 
@@ -285,4 +372,20 @@
 #endif
 
+
+    /* Init video subsystem */
+    pool = pjmedia_endpt_create_pool(g_med_endpt, "Video subsystem", 512, 512);
+    status = pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+    status = pjmedia_converter_mgr_create(pool, NULL);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+    status = pjmedia_vid_codec_mgr_create(pool, NULL);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+    status = pjmedia_vid_subsys_init(&cp.factory);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Init ffmpeg video codecs */
+    status = pjmedia_codec_ffmpeg_init(NULL, &cp.factory);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
     
     /* 
@@ -291,19 +394,24 @@
      * opt to re-use the same media transport for subsequent calls.
      */
-    status = pjmedia_transport_udp_create3(g_med_endpt, AF, NULL, NULL, 
-				           RTP_PORT, 0, &g_med_transport);
-    if (status != PJ_SUCCESS) {
-	app_perror(THIS_FILE, "Unable to create media transport", status);
-	return 1;
-    }
-
-    /* 
-     * Get socket info (address, port) of the media transport. We will
-     * need this info to create SDP (i.e. the address and port info in
-     * the SDP).
-     */
-    pjmedia_transport_info_init(&g_med_tpinfo);
-    pjmedia_transport_get_info(g_med_transport, &g_med_tpinfo);
-
+    for (i = 0; i < PJ_ARRAY_SIZE(g_med_transport); ++i) {
+	status = pjmedia_transport_udp_create3(g_med_endpt, AF, NULL, NULL, 
+					       RTP_PORT + i*2, 0, 
+					       &g_med_transport[i]);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to create media transport", status);
+	    return 1;
+	}
+
+	/* 
+	 * Get socket info (address, port) of the media transport. We will
+	 * need this info to create SDP (i.e. the address and port info in
+	 * the SDP).
+	 */
+	pjmedia_transport_info_init(&g_med_tpinfo[i]);
+	pjmedia_transport_get_info(g_med_transport[i], &g_med_tpinfo[i]);
+
+	pj_memcpy(&g_sock_info[i], &g_med_tpinfo[i].sock_info,
+		  sizeof(pjmedia_sock_info));
+    }
 
     /*
@@ -367,7 +475,6 @@
 	status = pjmedia_endpt_create_sdp( g_med_endpt,	    /* the media endpt	*/
 					   dlg->pool,	    /* pool.		*/
-					   1,		    /* # of streams	*/
-					   &g_med_tpinfo.sock_info,   
-							    /* RTP sock info	*/
+					   MAX_MEDIA_CNT,	    /* # of streams	*/
+					   g_sock_info,     /* RTP sock info	*/
 					   &local_sdp);	    /* the SDP result	*/
 	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
@@ -440,4 +547,6 @@
     /* On exit, dump current memory usage: */
     dump_pool_usage(THIS_FILE, &cp);
+
+    pj_pool_release(pool);
 
     return 0;
@@ -575,7 +684,6 @@
      */
 
-    status = pjmedia_endpt_create_sdp( g_med_endpt, rdata->tp_info.pool, 1,
-				       &g_med_tpinfo.sock_info, 
-				       &local_sdp);
+    status = pjmedia_endpt_create_sdp( g_med_endpt, rdata->tp_info.pool,
+				       MAX_MEDIA_CNT, g_sock_info, &local_sdp);
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, PJ_TRUE);
 
@@ -640,5 +748,5 @@
 				  pj_status_t status)
 {
-    pjmedia_session_info sess_info;
+    pjmedia_stream_info stream_info;
     const pjmedia_sdp_session *local_sdp;
     const pjmedia_sdp_session *remote_sdp;
@@ -663,33 +771,36 @@
 
 
-    /* Create session info based on the two SDPs. 
-     * We only support one stream per session for now.
-     */
-    status = pjmedia_session_info_from_sdp(inv->dlg->pool, g_med_endpt, 
-					   1, &sess_info, 
-					   local_sdp, remote_sdp);
+    /* Create stream info based on the media audio SDP. */
+    status = pjmedia_stream_info_from_sdp(&stream_info, inv->dlg->pool,
+					  g_med_endpt,
+					  local_sdp, remote_sdp, 0);
     if (status != PJ_SUCCESS) {
-	app_perror( THIS_FILE, "Unable to create media session", status);
+	app_perror(THIS_FILE,"Unable to create audio stream info",status);
 	return;
     }
 
-    /* If required, we can also change some settings in the session info,
+    /* If required, we can also change some settings in the stream info,
      * (such as jitter buffer settings, codec settings, etc) before we
-     * create the session.
-     */
-
-    /* Create new media session, passing the two SDPs, and also the
+     * create the stream.
+     */
+
+    /* Create new audio media stream, passing the stream info, and also the
      * media socket that we created earlier.
-     * The media session is active immediately.
-     */
-    status = pjmedia_session_create( g_med_endpt, &sess_info,
-				     &g_med_transport, NULL, &g_med_session );
+     */
+    status = pjmedia_stream_create(g_med_endpt, inv->dlg->pool, &stream_info,
+				   g_med_transport[0], NULL, &g_med_stream);
     if (status != PJ_SUCCESS) {
-	app_perror( THIS_FILE, "Unable to create media session", status);
+	app_perror( THIS_FILE, "Unable to create audio stream", status);
 	return;
     }
 
-
-    /* Get the media port interface of the first stream in the session. 
+    /* Start the audio stream */
+    status = pjmedia_stream_start(g_med_stream);
+    if (status != PJ_SUCCESS) {
+	app_perror( THIS_FILE, "Unable to start audio stream", status);
+	return;
+    }
+
+    /* Get the media port interface of the audio stream. 
      * Media port interface is basicly a struct containing get_frame() and
      * put_frame() function. With this media port interface, we can attach
@@ -697,5 +808,5 @@
      * player/recorder device.
      */
-    pjmedia_session_get_port(g_med_session, 0, &media_port);
+    pjmedia_stream_get_port(g_med_stream, &media_port);
 
 
@@ -746,4 +857,147 @@
     status = pjmedia_snd_port_connect(g_snd_rec, media_port);
 
+
+    /* Get the media port interface of the second stream in the session,
+     * which is video stream. With this media port interface, we can attach
+     * the port directly to a renderer/capture video device.
+     */
+    if (local_sdp->media_count > 1) {
+	pjmedia_vid_stream_info vstream_info;
+	pjmedia_vid_port_param vport_param;
+
+	/* Create stream info based on the media video SDP. */
+	status = pjmedia_vid_stream_info_from_sdp(&vstream_info,
+						  inv->dlg->pool, g_med_endpt,
+						  local_sdp, remote_sdp, 1);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE,"Unable to create video stream info",status);
+	    return;
+	}
+
+	/* If required, we can also change some settings in the stream info,
+	 * (such as jitter buffer settings, codec settings, etc) before we
+	 * create the video stream.
+	 */
+
+	/* Create new video media stream, passing the stream info, and also the
+	 * media socket that we created earlier.
+	 */
+	status = pjmedia_vid_stream_create(g_med_endpt, inv->dlg->pool,
+					   &vstream_info, g_med_transport[1],
+					   NULL, &g_med_vstream);
+	if (status != PJ_SUCCESS) {
+	    app_perror( THIS_FILE, "Unable to create video stream", status);
+	    return;
+	}
+
+	/* Start the video stream */
+	status = pjmedia_vid_stream_start(g_med_vstream);
+	if (status != PJ_SUCCESS) {
+	    app_perror( THIS_FILE, "Unable to start video stream", status);
+	    return;
+	}
+
+
+	if (vstream_info.dir & PJMEDIA_DIR_DECODING) {
+	    status = pjmedia_vid_dev_default_param(
+				inv->pool, PJMEDIA_VID_DEFAULT_RENDER_DEV,
+				&vport_param.vidparam);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to get default param of video "
+			   "renderer device", status);
+		return;
+	    }
+
+	    /* Get renderer format from decoding format in stream info */
+	    pjmedia_format_copy(&vport_param.vidparam.fmt, 
+				&vstream_info.codec_param->dec_fmt);
+	    vport_param.vidparam.dir = PJMEDIA_DIR_RENDER;
+	    vport_param.active = PJ_TRUE;
+
+	    /* Create renderer */
+	    status = pjmedia_vid_port_create(inv->pool, &vport_param, 
+					     &g_vid_renderer);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to create video renderer device",
+			   status);
+		return;
+	    }
+
+	    /* Get video stream port for decoding direction */
+	    pjmedia_vid_stream_get_port(g_med_vstream, PJMEDIA_DIR_DECODING,
+					&media_port);
+
+	    /* Connect renderer to media_port */
+	    status = pjmedia_vid_port_connect(g_vid_renderer, media_port, 
+					      PJ_FALSE);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to connect renderer to stream",
+			   status);
+		return;
+	    }
+	}
+
+	/* Create capturer */
+	if (vstream_info.dir & PJMEDIA_DIR_ENCODING) {
+	    status = pjmedia_vid_dev_default_param(
+				inv->pool, PJMEDIA_VID_DEFAULT_CAPTURE_DEV,
+				&vport_param.vidparam);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to get default param of video "
+			   "capture device", status);
+		return;
+	    }
+
+	    /* Get renderer capturer from encoding format in stream info */
+	    pjmedia_format_copy(&vport_param.vidparam.fmt, 
+				&vstream_info.codec_param->enc_fmt);
+
+	    /* Capturer format ID should be copied from decoder format ID? */
+	    vport_param.vidparam.fmt.id = vstream_info.codec_param->dec_fmt.id;
+	    vport_param.vidparam.dir = PJMEDIA_DIR_CAPTURE;
+	    vport_param.active = PJ_TRUE;
+
+	    /* Create capturer */
+	    status = pjmedia_vid_port_create(inv->pool, &vport_param, 
+					     &g_vid_capturer);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to create video capture device",
+			   status);
+		return;
+	    }
+
+	    /* Get video stream port for decoding direction */
+	    pjmedia_vid_stream_get_port(g_med_vstream, PJMEDIA_DIR_ENCODING,
+					&media_port);
+
+	    /* Connect capturer to media_port */
+	    status = pjmedia_vid_port_connect(g_vid_capturer, media_port, 
+					      PJ_FALSE);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to connect capturer to stream",
+			   status);
+		return;
+	    }
+	}
+
+	/* Start streaming */
+	if (g_vid_renderer) {
+	    status = pjmedia_vid_port_start(g_vid_renderer);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to start video renderer",
+			   status);
+		return;
+	    }
+	}
+	if (g_vid_capturer) {
+	    status = pjmedia_vid_port_start(g_vid_capturer);
+	    if (status != PJ_SUCCESS) {
+		app_perror(THIS_FILE, "Unable to start video capturer",
+			   status);
+		return;
+	    }
+	}
+    }
+
     /* Done with media. */
 }
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c	(revision 3425)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c	(revision 3425)
@@ -0,0 +1,907 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+
+
+/**
+ * \page page_pjmedia_samples_vid_streamutil_c Samples: Video Streaming
+ *
+ * This example mainly demonstrates how to stream video to remote
+ * peer using RTP.
+ *
+ * This file is pjsip-apps/src/samples/vid_streamutil.c
+ *
+ * \includelineno vid_streamutil.c
+ */
+
+#include <pjlib.h>
+#include <pjlib-util.h>
+#include <pjmedia.h>
+#include <pjmedia-codec.h>
+#include <pjmedia/transport_srtp.h>
+
+#include <stdlib.h>	/* atoi() */
+#include <stdio.h>
+
+#include "util.h"
+
+
+static const char *desc = 
+ " vid_streamutil                                                       \n"
+ "\n"
+ " PURPOSE:                                                             \n"
+ "  Demonstrate how to use pjmedia video stream component to		\n"
+ "  transmit/receive RTP packets to/from video device/file.		\n"
+ "\n"
+ "\n"
+ " USAGE:                                                               \n"
+ "  vid_streamutil [options]                                            \n"
+ "\n"
+ "\n"
+ " Options:                                                             \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"
+ "                        the program will transmit RTP audio to the    \n"
+ "                        specified address. (default: recv only)       \n"
+ "  --play-file=AVI       Send video from the AVI file instead of from  \n"
+ "                        the video device.                             \n"
+ "  --send-recv           Set stream direction to bidirectional.        \n"
+ "  --send-only           Set stream direction to send only             \n"
+ "  --recv-only           Set stream direction to recv only (default)   \n"
+ 
+ "  --send-width          Video width to be sent                        \n"
+ "  --send-height         Video height to be sent                       \n"
+ "                        --send-width and --send-height not applicable \n"
+ "                        for file streaming (see --play-file)          \n"
+
+ "  --send-pt             Payload type for sending                      \n"
+ "  --recv-pt             Payload type for receiving                    \n"
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ "  --use-srtp[=NAME]     Enable SRTP with crypto suite NAME            \n"
+ "                        e.g: AES_CM_128_HMAC_SHA1_80 (default),       \n"
+ "                             AES_CM_128_HMAC_SHA1_32                  \n"
+ "                        Use this option along with the TX & RX keys,  \n"
+ "                        formated of 60 hex digits (e.g: E148DA..)     \n"
+ "  --srtp-tx-key         SRTP key for transmiting                      \n"
+ "  --srtp-rx-key         SRTP key for receiving                        \n"
+#endif
+
+ "\n"
+;
+
+#define THIS_FILE	"vid_streamutil.c"
+
+#define HAS_LOCAL_RENDERER_FOR_PLAY_FILE    1
+#define DEF_RENDERER_WIDTH		    0
+#define DEF_RENDERER_HEIGHT		    0
+
+/* Prototype */
+static void print_stream_stat(pjmedia_vid_stream *stream,
+			      const pjmedia_vid_codec_param *codec_param);
+
+/* Prototype for LIBSRTP utility in file datatypes.c */
+int hex_string_to_octet_string(char *raw, char *hex, int len);
+
+/* 
+ * Register all codecs. 
+ */
+static pj_status_t init_codecs(pj_pool_factory *pf)
+{
+    pj_status_t status;
+
+    /* To suppress warning about unused var when all codecs are disabled */
+    PJ_UNUSED_ARG(status);
+
+#if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC != 0
+    status = pjmedia_codec_ffmpeg_init(NULL, pf);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+#endif
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t create_file_player( pj_pool_t *pool,
+				       const char *file_name,
+				       pjmedia_port **p_play_port)
+{
+    pjmedia_avi_streams *avi_streams;
+    pjmedia_avi_stream *vid_stream;
+    pjmedia_port *play_port;
+    pj_status_t status;
+
+    status = pjmedia_avi_player_create_streams(pool, file_name, 0, &avi_streams);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    vid_stream = pjmedia_avi_streams_get_stream_by_media(avi_streams,
+                                                         0,
+                                                         PJMEDIA_TYPE_VIDEO);
+    if (!vid_stream)
+	return PJ_ENOTFOUND;
+
+    play_port = pjmedia_avi_stream_get_port(vid_stream);
+    pj_assert(play_port);
+
+    *p_play_port = play_port;
+
+    return PJ_SUCCESS;
+}
+
+/* 
+ * Create stream based on the codec, dir, remote address, etc. 
+ */
+static pj_status_t create_stream( pj_pool_t *pool,
+				  pjmedia_endpt *med_endpt,
+				  const pjmedia_vid_codec_info *codec_info,
+                                  pjmedia_vid_codec_param *codec_param,
+				  pjmedia_dir dir,
+				  pj_int8_t rx_pt,
+				  pj_int8_t tx_pt,
+				  pj_uint16_t local_port,
+				  const pj_sockaddr_in *rem_addr,
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+				  pj_bool_t use_srtp,
+				  const pj_str_t *crypto_suite,
+				  const pj_str_t *srtp_tx_key,
+				  const pj_str_t *srtp_rx_key,
+#endif
+				  pjmedia_vid_stream **p_stream )
+{
+    pjmedia_vid_stream_info info;
+    pjmedia_transport *transport = NULL;
+    pj_status_t status;
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    pjmedia_transport *srtp_tp = NULL;
+#endif
+
+    /* Reset stream info. */
+    pj_bzero(&info, sizeof(info));
+
+    /* Initialize stream info formats */
+    info.type = PJMEDIA_TYPE_VIDEO;
+    info.dir = dir;
+    info.codec_info = *codec_info;
+    info.tx_pt = (tx_pt == -1)? codec_info->pt : tx_pt;
+    info.rx_pt = (rx_pt == -1)? codec_info->pt : rx_pt;
+    info.ssrc = pj_rand();
+    if (codec_param)
+        info.codec_param = codec_param;
+    
+#if PJMEDIA_HAS_RTCP_XR && PJMEDIA_STREAM_ENABLE_XR
+    /* Set default RTCP XR enabled/disabled */
+    info.rtcp_xr_enabled = PJ_TRUE;
+#endif
+
+    /* Copy remote address */
+    pj_memcpy(&info.rem_addr, rem_addr, sizeof(pj_sockaddr_in));
+
+    /* If remote address is not set, set to an arbitrary address
+     * (otherwise stream will assert).
+     */
+    if (info.rem_addr.addr.sa_family == 0) {
+	const pj_str_t addr = pj_str("127.0.0.1");
+	pj_sockaddr_in_init(&info.rem_addr.ipv4, &addr, 0);
+    }
+
+    /* Create media transport */
+    status = pjmedia_transport_udp_create(med_endpt, NULL, local_port,
+					  0, &transport);
+    if (status != PJ_SUCCESS)
+	return status;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* Check if SRTP enabled */
+    if (use_srtp) {
+	pjmedia_srtp_crypto tx_plc, rx_plc;
+
+	status = pjmedia_transport_srtp_create(med_endpt, transport, 
+					       NULL, &srtp_tp);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	pj_bzero(&tx_plc, sizeof(pjmedia_srtp_crypto));
+	pj_bzero(&rx_plc, sizeof(pjmedia_srtp_crypto));
+
+	tx_plc.key = *srtp_tx_key;
+	tx_plc.name = *crypto_suite;
+	rx_plc.key = *srtp_rx_key;
+	rx_plc.name = *crypto_suite;
+	
+	status = pjmedia_transport_srtp_start(srtp_tp, &tx_plc, &rx_plc);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	transport = srtp_tp;
+    }
+#endif
+
+    /* Now that the stream info is initialized, we can create the 
+     * stream.
+     */
+
+    status = pjmedia_vid_stream_create( med_endpt, pool, &info, 
+					transport, 
+					NULL, p_stream);
+
+    if (status != PJ_SUCCESS) {
+	app_perror(THIS_FILE, "Error creating stream", status);
+	pjmedia_transport_close(transport);
+	return status;
+    }
+
+
+    return PJ_SUCCESS;
+}
+
+
+typedef struct play_file_data
+{
+    const char *file_name;
+    pjmedia_port *play_port;
+    pjmedia_port *stream_port;
+    pjmedia_vid_codec *decoder;
+    pjmedia_port *renderer;
+    void *read_buf;
+    pj_size_t read_buf_size;
+    void *dec_buf;
+    pj_size_t dec_buf_size;
+} play_file_data;
+
+
+static void clock_cb(const pj_timestamp *ts, void *user_data)
+{
+    play_file_data *play_file = (play_file_data*)user_data;
+    pjmedia_frame read_frame, write_frame;
+    pj_status_t status;
+
+    PJ_UNUSED_ARG(ts);
+
+    /* Read frame from file */
+    read_frame.buf = play_file->read_buf;
+    read_frame.size = play_file->read_buf_size;
+    pjmedia_port_get_frame(play_file->play_port, &read_frame);
+
+    /* Decode frame, if needed */
+    if (play_file->decoder) {
+	pjmedia_vid_codec *decoder = play_file->decoder;
+
+	write_frame.buf = play_file->dec_buf;
+	write_frame.size = play_file->dec_buf_size;
+	status = decoder->op->decode(decoder, &read_frame, write_frame.size,
+				     &write_frame);
+	if (status != PJ_SUCCESS)
+	    return;
+    } else {
+	write_frame = read_frame;
+    }
+
+    /* Display frame locally */
+    if (play_file->renderer)
+	pjmedia_port_put_frame(play_file->renderer, &write_frame);
+
+    /* Send frame */
+    pjmedia_port_put_frame(play_file->stream_port, &write_frame);
+}
+
+
+/*
+ * usage()
+ */
+static void usage()
+{
+    puts(desc);
+}
+
+/*
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+    pj_caching_pool cp;
+    pjmedia_endpt *med_endpt;
+    pj_pool_t *pool;
+    pjmedia_vid_stream *stream = NULL;
+    pjmedia_port *enc_port, *dec_port;
+    pj_status_t status; 
+
+    pjmedia_vid_port *capture=NULL, *renderer=NULL;
+    pjmedia_vid_port_param vpp;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* SRTP variables */
+    pj_bool_t use_srtp = PJ_FALSE;
+    char tmp_tx_key[64];
+    char tmp_rx_key[64];
+    pj_str_t  srtp_tx_key = {NULL, 0};
+    pj_str_t  srtp_rx_key = {NULL, 0};
+    pj_str_t  srtp_crypto_suite = {NULL, 0};
+    int	tmp_key_len;
+#endif
+
+    /* Default values */
+    const pjmedia_vid_codec_info *codec_info;
+    pjmedia_vid_codec_param codec_param;
+    pjmedia_dir dir = PJMEDIA_DIR_DECODING;
+    pj_sockaddr_in remote_addr;
+    pj_uint16_t local_port = 4000;
+    char *codec_id = NULL;
+    pjmedia_rect_size tx_size = {0};
+    pj_int8_t rx_pt = -1, tx_pt = -1;
+
+    play_file_data play_file = { NULL };
+    pjmedia_port *play_port = NULL;
+    pjmedia_vid_codec *play_decoder = NULL;
+    pjmedia_clock *play_clock = NULL;
+
+    enum {
+	OPT_CODEC	= 'c',
+	OPT_LOCAL_PORT	= 'p',
+	OPT_REMOTE	= 'r',
+	OPT_PLAY_FILE	= 'f',
+	OPT_SEND_RECV	= 'b',
+	OPT_SEND_ONLY	= 's',
+	OPT_RECV_ONLY	= 'i',
+	OPT_SEND_WIDTH	= 'W',
+	OPT_SEND_HEIGHT	= 'H',
+	OPT_RECV_PT	= 't',
+	OPT_SEND_PT	= 'T',
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	OPT_USE_SRTP	= 'S',
+#endif
+	OPT_SRTP_TX_KEY	= 'x',
+	OPT_SRTP_RX_KEY	= 'y',
+	OPT_HELP	= 'h',
+    };
+
+    struct pj_getopt_option long_options[] = {
+	{ "codec",	    1, 0, OPT_CODEC },
+	{ "local-port",	    1, 0, OPT_LOCAL_PORT },
+	{ "remote",	    1, 0, OPT_REMOTE },
+	{ "play-file",	    1, 0, OPT_PLAY_FILE },
+	{ "send-recv",      0, 0, OPT_SEND_RECV },
+	{ "send-only",      0, 0, OPT_SEND_ONLY },
+	{ "recv-only",      0, 0, OPT_RECV_ONLY },
+	{ "send-width",     1, 0, OPT_SEND_WIDTH },
+	{ "send-height",    1, 0, OPT_SEND_HEIGHT },
+	{ "recv-pt",        1, 0, OPT_RECV_PT },
+	{ "send-pt",        1, 0, OPT_SEND_PT },
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	{ "use-srtp",	    2, 0, OPT_USE_SRTP },
+	{ "srtp-tx-key",    1, 0, OPT_SRTP_TX_KEY },
+	{ "srtp-rx-key",    1, 0, OPT_SRTP_RX_KEY },
+#endif
+	{ "help",	    0, 0, OPT_HELP },
+	{ NULL, 0, 0, 0 },
+    };
+
+    int c;
+    int option_index;
+
+
+    pj_bzero(&remote_addr, sizeof(remote_addr));
+
+
+    /* init PJLIB : */
+    status = pj_init();
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    /* Parse arguments */
+    pj_optind = 0;
+    while((c=pj_getopt_long(argc,argv, "h", long_options, &option_index))!=-1)
+    {
+	switch (c) {
+	case OPT_CODEC:
+	    codec_id = pj_optarg;
+	    break;
+
+	case OPT_LOCAL_PORT:
+	    local_port = (pj_uint16_t) atoi(pj_optarg);
+	    if (local_port < 1) {
+		printf("Error: invalid local port %s\n", pj_optarg);
+		return 1;
+	    }
+	    break;
+
+	case OPT_REMOTE:
+	    {
+		pj_str_t ip = pj_str(strtok(pj_optarg, ":"));
+		pj_uint16_t port = (pj_uint16_t) atoi(strtok(NULL, ":"));
+
+		status = pj_sockaddr_in_init(&remote_addr, &ip, port);
+		if (status != PJ_SUCCESS) {
+		    app_perror(THIS_FILE, "Invalid remote address", status);
+		    return 1;
+		}
+	    }
+	    break;
+
+	case OPT_PLAY_FILE:
+	    play_file.file_name = pj_optarg;
+	    break;
+
+	case OPT_SEND_RECV:
+	    dir = PJMEDIA_DIR_ENCODING_DECODING;
+	    break;
+
+	case OPT_SEND_ONLY:
+	    dir = PJMEDIA_DIR_ENCODING;
+	    break;
+
+	case OPT_RECV_ONLY:
+	    dir = PJMEDIA_DIR_DECODING;
+	    break;
+
+	case OPT_SEND_WIDTH:
+	    tx_size.w = (unsigned)atoi(pj_optarg);
+	    break;
+
+	case OPT_SEND_HEIGHT:
+	    tx_size.h = (unsigned)atoi(pj_optarg);
+	    break;
+
+	case OPT_RECV_PT:
+	    rx_pt = (pj_int8_t)atoi(pj_optarg);
+	    break;
+
+	case OPT_SEND_PT:
+	    tx_pt = (pj_int8_t)atoi(pj_optarg);
+	    break;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	case OPT_USE_SRTP:
+	    use_srtp = PJ_TRUE;
+	    if (pj_optarg) {
+		pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg));
+	    } else {
+		srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80");
+	    }
+	    break;
+
+	case OPT_SRTP_TX_KEY:
+	    tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, 
+						     strlen(pj_optarg));
+	    pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2);
+	    break;
+
+	case OPT_SRTP_RX_KEY:
+	    tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg,
+						     strlen(pj_optarg));
+	    pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2);
+	    break;
+#endif
+
+	case OPT_HELP:
+	    usage();
+	    return 1;
+
+	default:
+	    printf("Invalid options %s\n", argv[pj_optind]);
+	    return 1;
+	}
+
+    }
+
+
+    /* Verify arguments. */
+    if (dir & PJMEDIA_DIR_ENCODING) {
+	if (remote_addr.sin_addr.s_addr == 0) {
+	    printf("Error: remote address must be set\n");
+	    return 1;
+	}
+    }
+
+    if (play_file.file_name != NULL && dir != PJMEDIA_DIR_ENCODING) {
+	printf("Direction is set to --send-only because of --play-file\n");
+	dir = PJMEDIA_DIR_ENCODING;
+    }
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* SRTP validation */
+    if (use_srtp) {
+	if (!srtp_tx_key.slen || !srtp_rx_key.slen)
+	{
+	    printf("Error: Key for each SRTP stream direction must be set\n");
+	    return 1;
+	}
+    }
+#endif
+
+    /* Must create a pool factory before we can allocate any memory. */
+    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
+
+    /* 
+     * Initialize media endpoint.
+     * This will implicitly initialize PJMEDIA too.
+     */
+    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Create memory pool for application purpose */
+    pool = pj_pool_create( &cp.factory,	    /* pool factory	    */
+			   "app",	    /* pool name.	    */
+			   4000,	    /* init size	    */
+			   4000,	    /* increment size	    */
+			   NULL		    /* callback on error    */
+			   );
+
+    /* Init video format manager */
+    pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
+
+    /* Init video converter manager */
+    pjmedia_converter_mgr_create(pool, NULL);
+
+    /* Init video codec manager */
+    pjmedia_vid_codec_mgr_create(pool, NULL);
+
+    /* Init video subsystem */
+    pjmedia_vid_subsys_init(&cp.factory);
+
+    /* Register all supported codecs */
+    status = init_codecs(&cp.factory);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    /* Find which codec to use. */
+    if (codec_id) {
+	unsigned count = 1;
+	pj_str_t str_codec_id = pj_str(codec_id);
+
+        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL,
+						         &str_codec_id, &count,
+						         &codec_info, NULL);
+	if (status != PJ_SUCCESS) {
+	    printf("Error: unable to find codec %s\n", codec_id);
+	    return 1;
+	}
+    } else {
+        static pjmedia_vid_codec_info info[1];
+        unsigned count = PJ_ARRAY_SIZE(info);
+
+	/* Default to first codec */
+	pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, NULL);
+        codec_info = &info[0];
+    }
+
+    /* Get codec default param for info */
+    status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info, 
+				                     &codec_param);
+    pj_assert(status == PJ_SUCCESS);
+    
+    /* Set outgoing video size */
+    if (tx_size.w && tx_size.h)
+        codec_param.enc_fmt.det.vid.size = tx_size;
+
+#if DEF_RENDERER_WIDTH && DEF_RENDERER_HEIGHT
+    /* Set incoming video size */
+    codec_param.dec_fmt.det.vid.size.w = DEF_RENDERER_WIDTH;
+    codec_param.dec_fmt.det.vid.size.h = DEF_RENDERER_HEIGHT;
+#endif
+
+    if (play_file.file_name) {
+	pjmedia_video_format_detail *file_vfd;
+
+	/* Create file player */
+	status = create_file_player(pool, play_file.file_name, &play_port);
+	if (status != PJ_SUCCESS)
+	    goto on_exit;
+
+	/* Collect format info */
+	file_vfd = pjmedia_format_get_video_format_detail(&play_port->info.fmt,
+							  PJ_TRUE);
+	PJ_LOG(2, (THIS_FILE, "Reading video stream %dx%d %c%c%c%c @%.2dfps",
+		   file_vfd->size.w, file_vfd->size.h,
+		   ((play_port->info.fmt.id & 0x000000FF) >> 0),
+		   ((play_port->info.fmt.id & 0x0000FF00) >> 8),
+		   ((play_port->info.fmt.id & 0x00FF0000) >> 16),
+		   ((play_port->info.fmt.id & 0xFF000000) >> 24),
+		   file_vfd->fps.num/file_vfd->fps.denum));
+
+	/* Allocate file read buffer */
+	play_file.read_buf_size = PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE;
+	play_file.read_buf = pj_pool_zalloc(pool, play_file.read_buf_size);
+
+	/* Create decoder, if the file and the stream uses different codec */
+	if (codec_info->fmt_id != (pjmedia_format_id)play_port->info.fmt.id) {
+	    const pjmedia_video_format_info *dec_vfi;
+	    pjmedia_video_apply_fmt_param dec_vafp = {0};
+	    const pjmedia_vid_codec_info *codec_info2;
+	    pjmedia_vid_codec_param codec_param2;
+
+	    /* Find decoder */
+	    status = pjmedia_vid_codec_mgr_get_codec_info2(NULL,
+							   play_port->info.fmt.id,
+							   &codec_info2);
+	    if (status != PJ_SUCCESS)
+		goto on_exit;
+
+	    /* Init decoder */
+	    status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info2,
+						       &play_decoder);
+	    if (status != PJ_SUCCESS)
+		goto on_exit;
+
+	    status = play_decoder->op->init(play_decoder, pool);
+	    if (status != PJ_SUCCESS)
+		goto on_exit;
+
+	    /* Open decoder */
+	    status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info2,
+							     &codec_param2);
+	    if (status != PJ_SUCCESS)
+		goto on_exit;
+
+	    status = play_decoder->op->open(play_decoder, &codec_param2);
+	    if (status != PJ_SUCCESS)
+		goto on_exit;
+
+	    /* Get decoder format info and apply param */
+	    dec_vfi = pjmedia_get_video_format_info(NULL,
+						    codec_info2->dec_fmt_id[0]);
+	    if (!dec_vfi || !dec_vfi->apply_fmt) {
+		status = PJ_ENOTSUP;
+		goto on_exit;
+	    }
+	    dec_vafp.size = file_vfd->size;
+	    (*dec_vfi->apply_fmt)(dec_vfi, &dec_vafp);
+
+	    /* Allocate buffer to receive decoder output */
+	    play_file.dec_buf_size = dec_vafp.framebytes;
+	    play_file.dec_buf = pj_pool_zalloc(pool, play_file.dec_buf_size);
+	}
+
+	/* Create player clock */
+	status = pjmedia_clock_create2(pool, PJMEDIA_PTIME(&file_vfd->fps),
+				       codec_info->clock_rate,
+				       PJMEDIA_CLOCK_NO_HIGHEST_PRIO,
+				       &clock_cb, &play_file, &play_clock);
+	if (status != PJ_SUCCESS)
+	    goto on_exit;
+
+	/* Override stream codec param for encoding direction */
+	codec_param.enc_fmt.det.vid.size = file_vfd->size;
+	codec_param.enc_fmt.det.vid.fps  = file_vfd->fps;
+
+    } else {
+        pjmedia_vid_port_param_default(&vpp);
+
+        /* Set as active for all video devices */
+        vpp.active = PJ_TRUE;
+
+	/* Create video device port. */
+        if (dir & PJMEDIA_DIR_ENCODING) {
+            /* Create capture */
+            status = pjmedia_vid_dev_default_param(
+					pool,
+					0,//PJMEDIA_VID_DEFAULT_CAPTURE_DEV,
+					&vpp.vidparam);
+            if (status != PJ_SUCCESS)
+	        goto on_exit;
+
+            pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
+            vpp.vidparam.dir = PJMEDIA_DIR_CAPTURE;
+            
+            status = pjmedia_vid_port_create(pool, &vpp, &capture);
+            if (status != PJ_SUCCESS)
+	        goto on_exit;
+        }
+	
+        if (dir & PJMEDIA_DIR_DECODING) {
+            /* Create renderer */
+            status = pjmedia_vid_dev_default_param(
+					pool,
+					1,//PJMEDIA_VID_DEFAULT_RENDER_DEV,
+					&vpp.vidparam);
+            if (status != PJ_SUCCESS)
+	        goto on_exit;
+
+            pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
+            vpp.vidparam.dir = PJMEDIA_DIR_RENDER;
+            vpp.vidparam.disp_size = vpp.vidparam.fmt.det.vid.size;
+
+            status = pjmedia_vid_port_create(pool, &vpp, &renderer);
+            if (status != PJ_SUCCESS)
+	        goto on_exit;
+        }
+    }
+
+    /* Create stream based on program arguments */
+    status = create_stream(pool, med_endpt, codec_info, &codec_param,
+                           dir, rx_pt, tx_pt, local_port, &remote_addr, 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+			   use_srtp, &srtp_crypto_suite, 
+			   &srtp_tx_key, &srtp_rx_key,
+#endif
+			   &stream);
+    if (status != PJ_SUCCESS)
+	goto on_exit;
+
+    /* Get the port interface of the stream */
+    status = pjmedia_vid_stream_get_port(stream, PJMEDIA_DIR_ENCODING,
+				         &enc_port);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    status = pjmedia_vid_stream_get_port(stream, PJMEDIA_DIR_DECODING,
+				         &dec_port);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Start streaming */
+    status = pjmedia_vid_stream_start(stream);
+    if (status != PJ_SUCCESS)
+        goto on_exit;
+
+    /* Start renderer */
+    if (renderer) {
+        status = pjmedia_vid_port_connect(renderer, dec_port, PJ_FALSE);
+        if (status != PJ_SUCCESS)
+	    goto on_exit;
+        status = pjmedia_vid_port_start(renderer);
+        if (status != PJ_SUCCESS)
+            goto on_exit;
+    }
+
+    /* Start capture */
+    if (capture) {
+        status = pjmedia_vid_port_connect(capture, enc_port, PJ_FALSE);
+        if (status != PJ_SUCCESS)
+	    goto on_exit;
+        status = pjmedia_vid_port_start(capture);
+        if (status != PJ_SUCCESS)
+            goto on_exit;
+    }
+
+    /* Start playing file */
+    if (play_file.file_name) {
+
+#if HAS_LOCAL_RENDERER_FOR_PLAY_FILE
+        /* Create local renderer */
+        pjmedia_vid_port_param_default(&vpp);
+        vpp.active = PJ_FALSE;
+        status = pjmedia_vid_dev_default_param(
+				pool,
+				1,//PJMEDIA_VID_DEFAULT_RENDER_DEV,
+				&vpp.vidparam);
+        if (status != PJ_SUCCESS)
+	    goto on_exit;
+
+        vpp.vidparam.dir = PJMEDIA_DIR_RENDER;
+        pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
+	vpp.vidparam.fmt.det.vid.size = play_port->info.fmt.det.vid.size;
+	vpp.vidparam.fmt.det.vid.fps = play_port->info.fmt.det.vid.fps;
+        vpp.vidparam.disp_size = vpp.vidparam.fmt.det.vid.size;
+
+	status = pjmedia_vid_port_create(pool, &vpp, &renderer);
+        if (status != PJ_SUCCESS)
+	    goto on_exit;
+        status = pjmedia_vid_port_start(renderer);
+        if (status != PJ_SUCCESS)
+            goto on_exit;
+#endif
+
+	/* Init play file data */
+	play_file.play_port = play_port;
+	play_file.stream_port = enc_port;
+	play_file.decoder = play_decoder;
+	if (renderer) {
+	    play_file.renderer = pjmedia_vid_port_get_passive_port(renderer);
+	}
+
+	status = pjmedia_clock_start(play_clock);
+	if (status != PJ_SUCCESS)
+	    goto on_exit;
+    }
+
+    /* Done */
+
+    if (dir == PJMEDIA_DIR_DECODING)
+	printf("Stream is active, dir is recv-only, local port is %d\n",
+	       local_port);
+    else if (dir == PJMEDIA_DIR_ENCODING)
+	printf("Stream is active, dir is send-only, sending to %s:%d\n",
+	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_ntohs(remote_addr.sin_port));
+    else
+	printf("Stream is active, send/recv, local port is %d, "
+	       "sending to %s:%d\n",
+	       local_port,
+	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_ntohs(remote_addr.sin_port));
+
+    if (dir & PJMEDIA_DIR_ENCODING)
+	PJ_LOG(2, (THIS_FILE, "Sending %dx%d %.*s @%.2dfps",
+		   codec_param.enc_fmt.det.vid.size.w,
+		   codec_param.enc_fmt.det.vid.size.h,
+		   codec_info->encoding_name.slen,
+		   codec_info->encoding_name.ptr,
+		   codec_param.enc_fmt.det.vid.fps.num/
+		   codec_param.enc_fmt.det.vid.fps.denum));
+
+    for (;;) {
+	char tmp[10];
+
+	puts("");
+	puts("Commands:");
+	puts("  q     Quit");
+	puts("");
+
+	printf("Command: "); fflush(stdout);
+
+	if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
+	    puts("EOF while reading stdin, will quit now..");
+	    break;
+	}
+
+	if (tmp[0] == 'q')
+	    break;
+
+    }
+
+
+
+    /* Start deinitialization: */
+on_exit:
+
+    /* Stop and destroy file clock */
+    if (play_clock) {
+	pjmedia_clock_stop(play_clock);
+	pjmedia_clock_destroy(play_clock);
+    }
+
+    /* Destroy file reader/player */
+    if (play_port)
+	pjmedia_port_destroy(play_port);
+
+    /* Destroy file decoder */
+    if (play_decoder)
+	play_decoder->op->close(play_decoder);
+
+    /* Destroy video devices */
+    if (capture)
+	pjmedia_vid_port_destroy(capture);
+    if (renderer)
+	pjmedia_vid_port_destroy(renderer);
+
+    /* Destroy stream */
+    if (stream) {
+	pjmedia_transport *tp;
+
+	tp = pjmedia_vid_stream_get_transport(stream);
+	pjmedia_vid_stream_destroy(stream);
+	
+	pjmedia_transport_close(tp);
+    }
+
+    /* Shutdown video subsystem */
+    pjmedia_vid_subsys_shutdown();
+
+    /* Release application pool */
+    pj_pool_release( pool );
+
+    /* Destroy media endpoint. */
+    pjmedia_endpt_destroy( med_endpt );
+
+    /* Destroy pool factory */
+    pj_caching_pool_destroy( &cp );
+
+    /* Shutdown PJLIB */
+    pj_shutdown();
+
+    return (status == PJ_SUCCESS) ? 0 : 1;
+}
Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vstreamutil.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vstreamutil.c	(revision 3424)
+++ 	(revision )
@@ -1,1259 +1,0 @@
-/* $Id$ */
-/* 
- * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
- * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
- */
-
-
-/**
- * \page page_pjmedia_samples_streamutil_c Samples: Remote Streaming
- *
- * This example mainly demonstrates how to stream media file to remote
- * peer using RTP.
- *
- * This file is pjsip-apps/src/samples/streamutil.c
- *
- * \includelineno streamutil.c
- */
-
-#include <pjlib.h>
-#include <pjlib-util.h>
-#include <pjmedia.h>
-#include <pjmedia-codec.h>
-#include <pjmedia/transport_srtp.h>
-
-#include <stdlib.h>	/* atoi() */
-#include <stdio.h>
-
-#include "util.h"
-
-
-static const char *desc = 
- " streamutil								\n"
- "									\n"
- " PURPOSE:								\n"
- "  Demonstrate how to use pjmedia stream component to transmit/receive \n"
- "  RTP packets to/from sound device.		    			\n"
- "\n"
- "\n"
- " USAGE:								\n"
- "  streamutil [options]                                                \n"
- "\n"
- "\n"
- " Options:\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"
- "                        the program will transmit RTP audio to the	\n"
- "                        specified address. (default: recv only)	\n"
- /*
- "  --play-file=WAV       Send audio from the WAV file instead of from	\n"
- "                        the sound device.				\n"
- "  --record-file=WAV     Record incoming audio to WAV file instead of	\n"
- "                        playing it to sound device.			\n"
- */
- "  --send-recv           Set stream direction to bidirectional.        \n"
- "  --send-only           Set stream direction to send only		\n"
- "  --recv-only           Set stream direction to recv only (default)   \n"
-
- "  --recv-width          Video width to be received                    \n"
- "  --recv-height         Video height to be received                   \n"
- "  --recv-pt             Payload type for receiving                    \n"
-
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
- "  --use-srtp[=NAME]     Enable SRTP with crypto suite NAME            \n"
- "                        e.g: AES_CM_128_HMAC_SHA1_80 (default),       \n"
- "                             AES_CM_128_HMAC_SHA1_32                  \n"
- "                        Use this option along with the TX & RX keys,  \n"
- "                        formated of 60 hex digits (e.g: E148DA..)      \n"
- "  --srtp-tx-key         SRTP key for transmiting                      \n"
- "  --srtp-rx-key         SRTP key for receiving                        \n"
-#endif
-
- "\n"
-;
-
-
-
-
-#define THIS_FILE	"stream.c"
-
-
-
-/* Prototype */
-static void print_stream_stat(pjmedia_stream *stream, 
-			      const pjmedia_codec_param *codec_param);
-
-/* Prototype for LIBSRTP utility in file datatypes.c */
-int hex_string_to_octet_string(char *raw, char *hex, int len);
-
-/* 
- * Register all codecs. 
- */
-static pj_status_t init_codecs(pj_pool_factory *pf)
-{
-    pj_status_t status;
-
-    /* To suppress warning about unused var when all codecs are disabled */
-    PJ_UNUSED_ARG(status);
-
-#if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC != 0
-    status = pjmedia_codec_ffmpeg_init(NULL, pf);
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
-#endif
-
-    return PJ_SUCCESS;
-}
-
-
-/* 
- * Create stream based on the codec, dir, remote address, etc. 
- */
-static pj_status_t create_stream( pj_pool_t *pool,
-				  pjmedia_endpt *med_endpt,
-				  const pjmedia_vid_codec_info *codec_info,
-                                  pjmedia_vid_codec_param *codec_param,
-				  pjmedia_dir dir,
-				  pj_uint16_t local_port,
-				  const pj_sockaddr_in *rem_addr,
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-				  pj_bool_t use_srtp,
-				  const pj_str_t *crypto_suite,
-				  const pj_str_t *srtp_tx_key,
-				  const pj_str_t *srtp_rx_key,
-#endif
-				  pjmedia_stream **p_stream )
-{
-    pjmedia_stream_info info;
-    pjmedia_transport *transport = NULL;
-    pj_status_t status;
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-    pjmedia_transport *srtp_tp = NULL;
-#endif
-
-
-    /* Reset stream info. */
-    pj_bzero(&info, sizeof(info));
-
-
-    /* Initialize stream info formats */
-    info.type = PJMEDIA_TYPE_VIDEO;
-    info.dir = dir;
-    info.vid_codec_info = *codec_info;
-    info.tx_pt = codec_info->pt;
-    info.ssrc = pj_rand();
-    if (codec_param)
-        info.vid_codec_param = codec_param;
-    
-#if PJMEDIA_HAS_RTCP_XR && PJMEDIA_STREAM_ENABLE_XR
-    /* Set default RTCP XR enabled/disabled */
-    info.rtcp_xr_enabled = PJ_TRUE;
-#endif
-
-    /* Copy remote address */
-    pj_memcpy(&info.rem_addr, rem_addr, sizeof(pj_sockaddr_in));
-
-    /* If remote address is not set, set to an arbitrary address
-     * (otherwise stream will assert).
-     */
-    if (info.rem_addr.addr.sa_family == 0) {
-	const pj_str_t addr = pj_str("127.0.0.1");
-	pj_sockaddr_in_init(&info.rem_addr.ipv4, &addr, 0);
-    }
-
-    /* Create media transport */
-    status = pjmedia_transport_udp_create(med_endpt, NULL, local_port,
-					  0, &transport);
-    if (status != PJ_SUCCESS)
-	return status;
-
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-    /* Check if SRTP enabled */
-    if (use_srtp) {
-	pjmedia_srtp_crypto tx_plc, rx_plc;
-
-	status = pjmedia_transport_srtp_create(med_endpt, transport, 
-					       NULL, &srtp_tp);
-	if (status != PJ_SUCCESS)
-	    return status;
-
-	pj_bzero(&tx_plc, sizeof(pjmedia_srtp_crypto));
-	pj_bzero(&rx_plc, sizeof(pjmedia_srtp_crypto));
-
-	tx_plc.key = *srtp_tx_key;
-	tx_plc.name = *crypto_suite;
-	rx_plc.key = *srtp_rx_key;
-	rx_plc.name = *crypto_suite;
-	
-	status = pjmedia_transport_srtp_start(srtp_tp, &tx_plc, &rx_plc);
-	if (status != PJ_SUCCESS)
-	    return status;
-
-	transport = srtp_tp;
-    }
-#endif
-
-    /* Now that the stream info is initialized, we can create the 
-     * stream.
-     */
-
-    status = pjmedia_stream_create( med_endpt, pool, &info, 
-				    transport, 
-				    NULL, p_stream);
-
-    if (status != PJ_SUCCESS) {
-	app_perror(THIS_FILE, "Error creating stream", status);
-	pjmedia_transport_close(transport);
-	return status;
-    }
-
-
-    return PJ_SUCCESS;
-}
-
-
-/*
- * usage()
- */
-static void usage()
-{
-    puts(desc);
-}
-
-/*
- * main()
- */
-int main(int argc, char *argv[])
-{
-    pj_caching_pool cp;
-    pjmedia_endpt *med_endpt;
-    pj_pool_t *pool;
-    pjmedia_port *rec_file_port = NULL, *play_file_port = NULL;
-    pjmedia_master_port *master_port = NULL;
-    pjmedia_stream *stream = NULL;
-    pjmedia_port *stream_port;
-    char tmp[10];
-    pj_status_t status; 
-
-    pjmedia_vid_port *capture=NULL, *renderer=NULL;
-    pjmedia_vid_port_param vpp;
-
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-    /* SRTP variables */
-    pj_bool_t use_srtp = PJ_FALSE;
-    char tmp_tx_key[64];
-    char tmp_rx_key[64];
-    pj_str_t  srtp_tx_key = {NULL, 0};
-    pj_str_t  srtp_rx_key = {NULL, 0};
-    pj_str_t  srtp_crypto_suite = {NULL, 0};
-    int	tmp_key_len;
-#endif
-
-    /* Default values */
-    const pjmedia_vid_codec_info *codec_info;
-    pjmedia_vid_codec_param codec_param;
-    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;
-    pjmedia_rect_size rx_size = {0};
-    pj_int8_t rx_pt = -1;
-
-    enum {
-	OPT_CODEC	= 'c',
-	OPT_LOCAL_PORT	= 'p',
-	OPT_REMOTE	= 'r',
-	OPT_PLAY_FILE	= 'I',
-	OPT_RECORD_FILE	= 'O',
-	OPT_SEND_RECV	= 'b',
-	OPT_SEND_ONLY	= 's',
-	OPT_RECV_ONLY	= 'i',
-	OPT_RECV_WIDTH	= 'W',
-	OPT_RECV_HEIGHT	= 'H',
-	OPT_RECV_PT	= 't',
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-	OPT_USE_SRTP	= 'S',
-#endif
-	OPT_SRTP_TX_KEY	= 'x',
-	OPT_SRTP_RX_KEY	= 'y',
-	OPT_HELP	= 'h',
-    };
-
-    struct pj_getopt_option long_options[] = {
-	{ "codec",	    1, 0, OPT_CODEC },
-	{ "local-port",	    1, 0, OPT_LOCAL_PORT },
-	{ "remote",	    1, 0, OPT_REMOTE },
-	{ "play-file",	    1, 0, OPT_PLAY_FILE },
-	{ "record-file",    1, 0, OPT_RECORD_FILE },
-	{ "send-recv",      0, 0, OPT_SEND_RECV },
-	{ "send-only",      0, 0, OPT_SEND_ONLY },
-	{ "recv-only",      0, 0, OPT_RECV_ONLY },
-	{ "recv-width",     1, 0, OPT_RECV_WIDTH },
-	{ "recv-height",    1, 0, OPT_RECV_HEIGHT },
-	{ "recv-pt",        1, 0, OPT_RECV_PT },
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-	{ "use-srtp",	    2, 0, OPT_USE_SRTP },
-	{ "srtp-tx-key",    1, 0, OPT_SRTP_TX_KEY },
-	{ "srtp-rx-key",    1, 0, OPT_SRTP_RX_KEY },
-#endif
-	{ "help",	    0, 0, OPT_HELP },
-	{ NULL, 0, 0, 0 },
-    };
-
-    int c;
-    int option_index;
-
-
-    pj_bzero(&remote_addr, sizeof(remote_addr));
-
-
-    /* init PJLIB : */
-    status = pj_init();
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
-
-    /* Parse arguments */
-    pj_optind = 0;
-    while((c=pj_getopt_long(argc,argv, "h", long_options, &option_index))!=-1) {
-
-	switch (c) {
-	case OPT_CODEC:
-	    codec_id = pj_optarg;
-	    break;
-
-	case OPT_LOCAL_PORT:
-	    local_port = (pj_uint16_t) atoi(pj_optarg);
-	    if (local_port < 1) {
-		printf("Error: invalid local port %s\n", pj_optarg);
-		return 1;
-	    }
-	    break;
-
-	case OPT_REMOTE:
-	    {
-		pj_str_t ip = pj_str(strtok(pj_optarg, ":"));
-		pj_uint16_t port = (pj_uint16_t) atoi(strtok(NULL, ":"));
-
-		status = pj_sockaddr_in_init(&remote_addr, &ip, port);
-		if (status != PJ_SUCCESS) {
-		    app_perror(THIS_FILE, "Invalid remote address", status);
-		    return 1;
-		}
-	    }
-	    break;
-
-	case OPT_PLAY_FILE:
-	    play_file = pj_optarg;
-	    break;
-
-	case OPT_RECORD_FILE:
-	    rec_file = pj_optarg;
-	    break;
-
-	case OPT_SEND_RECV:
-	    dir = PJMEDIA_DIR_ENCODING_DECODING;
-	    break;
-
-	case OPT_SEND_ONLY:
-	    dir = PJMEDIA_DIR_ENCODING;
-	    break;
-
-	case OPT_RECV_ONLY:
-	    dir = PJMEDIA_DIR_DECODING;
-	    break;
-
-	case OPT_RECV_WIDTH:
-	    rx_size.w = (unsigned)atoi(pj_optarg);
-	    break;
-
-	case OPT_RECV_HEIGHT:
-	    rx_size.h = (unsigned)atoi(pj_optarg);
-	    break;
-
-	case OPT_RECV_PT:
-	    rx_pt = (pj_int8_t)atoi(pj_optarg);
-	    break;
-
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-	case OPT_USE_SRTP:
-	    use_srtp = PJ_TRUE;
-	    if (pj_optarg) {
-		pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg));
-	    } else {
-		srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80");
-	    }
-	    break;
-
-	case OPT_SRTP_TX_KEY:
-	    tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, strlen(pj_optarg));
-	    pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2);
-	    break;
-
-	case OPT_SRTP_RX_KEY:
-	    tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, strlen(pj_optarg));
-	    pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2);
-	    break;
-#endif
-
-	case OPT_HELP:
-	    usage();
-	    return 1;
-
-	default:
-	    printf("Invalid options %s\n", argv[pj_optind]);
-	    return 1;
-	}
-
-    }
-
-
-    /* Verify arguments. */
-    if (dir & PJMEDIA_DIR_ENCODING) {
-	if (remote_addr.sin_addr.s_addr == 0) {
-	    printf("Error: remote address must be set\n");
-	    return 1;
-	}
-    }
-
-    if (play_file != NULL && dir != PJMEDIA_DIR_ENCODING) {
-	printf("Direction is set to --send-only because of --play-file\n");
-	dir = PJMEDIA_DIR_ENCODING;
-    }
-
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-    /* SRTP validation */
-    if (use_srtp) {
-	if (!srtp_tx_key.slen || !srtp_rx_key.slen)
-	{
-	    printf("Error: Key for each SRTP stream direction must be set\n");
-	    return 1;
-	}
-    }
-#endif
-
-    /* Must create a pool factory before we can allocate any memory. */
-    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
-
-    /* 
-     * Initialize media endpoint.
-     * This will implicitly initialize PJMEDIA too.
-     */
-    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
-    /* Create memory pool for application purpose */
-    pool = pj_pool_create( &cp.factory,	    /* pool factory	    */
-			   "app",	    /* pool name.	    */
-			   4000,	    /* init size	    */
-			   4000,	    /* increment size	    */
-			   NULL		    /* callback on error    */
-			   );
-
-    /* Init video format manager */
-    pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
-
-    /* Init video codec manager */
-    pjmedia_vid_codec_mgr_create(pool, NULL);
-
-    /* Init video subsystem */
-    pjmedia_vid_subsys_init(&cp.factory);
-
-    /* Register all supported codecs */
-    status = init_codecs(&cp.factory);
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
-
-    /* Find which codec to use. */
-    if (codec_id) {
-	unsigned count = 1;
-	pj_str_t str_codec_id = pj_str(codec_id);
-
-        status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL,
-						         &str_codec_id, &count,
-						         &codec_info, NULL);
-	if (status != PJ_SUCCESS) {
-	    printf("Error: unable to find codec %s\n", codec_id);
-	    return 1;
-	}
-    } else {
-        static pjmedia_vid_codec_info info[1];
-        unsigned count = PJ_ARRAY_SIZE(info);
-
-	/* Default to first codec */
-	pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, NULL);
-        codec_info = &info[0];
-    }
-
-    /* Get codec default param for info */
-    status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info, 
-				                     &codec_param);
-    /* Should be ok, as create_stream() above succeeded */
-    pj_assert(status == PJ_SUCCESS);
-    if (rx_pt >= 0)
-        codec_param.pt = rx_pt;
-    if (rx_size.w && rx_size.h)
-        codec_param.dec_fmt.det.vid.size = rx_size;
-
-    /* Create stream based on program arguments */
-    status = create_stream(pool, med_endpt, codec_info, &codec_param,
-                           dir, local_port, &remote_addr, 
-#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
-			   use_srtp, &srtp_crypto_suite, 
-			   &srtp_tx_key, &srtp_rx_key,
-#endif
-			   &stream);
-    if (status != PJ_SUCCESS)
-	goto on_exit;
-
-    /* Get the port interface of the stream */
-    status = pjmedia_stream_get_port( stream, &stream_port);
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
-
-    if (play_file) {
-        /*
-	unsigned wav_ptime;
-
-	wav_ptime = PJMEDIA_PIA_PTIME(&stream_port->info);
-	status = pjmedia_wav_player_port_create(pool, play_file, wav_ptime,
-						0, -1, &play_file_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Unable to use file", status);
-	    goto on_exit;
-	}
-
-	status = pjmedia_master_port_create(pool, play_file_port, stream_port,
-					    0, &master_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Unable to create master port", status);
-	    goto on_exit;
-	}
-
-	status = pjmedia_master_port_start(master_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Error starting master port", status);
-	    goto on_exit;
-	}
-
-	printf("Playing from WAV file %s..\n", play_file);
-        */
-
-    } else if (rec_file) {
-        /*
-
-	status = pjmedia_wav_writer_port_create(pool, rec_file,
-					        PJMEDIA_PIA_SRATE(&stream_port->info),
-					        PJMEDIA_PIA_CCNT(&stream_port->info),
-					        PJMEDIA_PIA_SPF(&stream_port->info),
-					        PJMEDIA_PIA_BITS(&stream_port->info),
-						0, 0, &rec_file_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Unable to use file", status);
-	    goto on_exit;
-	}
-
-	status = pjmedia_master_port_create(pool, stream_port, rec_file_port, 
-					    0, &master_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Unable to create master port", status);
-	    goto on_exit;
-	}
-
-	status = pjmedia_master_port_start(master_port);
-	if (status != PJ_SUCCESS) {
-	    app_perror(THIS_FILE, "Error starting master port", status);
-	    goto on_exit;
-	}
-
-	printf("Recording to WAV file %s..\n", rec_file);
-        */
-	
-    } else {
-
-        pjmedia_vid_port_param_default(&vpp);
-
-        /* Set as active for all video devices */
-        vpp.active = PJ_TRUE;
-
-	/* Create video device port. */
-        if (dir & PJMEDIA_DIR_ENCODING) {
-            /* Create capture */
-            status = pjmedia_vid_dev_default_param(pool,
-                                                   0,//PJMEDIA_VID_DEFAULT_CAPTURE_DEV,
-					           &vpp.vidparam);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-
-            pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
-            vpp.vidparam.dir = PJMEDIA_DIR_CAPTURE;
-            
-            status = pjmedia_vid_port_create(pool, &vpp, &capture);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-
-            status = pjmedia_vid_port_connect(capture, stream_port, PJ_FALSE);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-        }
-	
-        if (dir & PJMEDIA_DIR_DECODING) {
-            /* Create renderer */
-            status = pjmedia_vid_dev_default_param(pool,
-                                                   1,//PJMEDIA_VID_DEFAULT_RENDER_DEV,
-					           &vpp.vidparam);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-
-            pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
-            vpp.vidparam.dir = PJMEDIA_DIR_RENDER;
-            vpp.vidparam.disp_size = vpp.vidparam.fmt.det.vid.size;
-
-            status = pjmedia_vid_port_create(pool, &vpp, &renderer);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-
-            status = pjmedia_vid_port_connect(renderer, stream_port, PJ_FALSE);
-            if (status != PJ_SUCCESS)
-	        goto on_exit;
-        }
-    }
-
-    /* Start streaming */
-    status = pjmedia_stream_start(stream);
-    if (status != PJ_SUCCESS)
-        goto on_exit;
-    if (renderer) {
-        status = pjmedia_vid_port_start(renderer);
-        if (status != PJ_SUCCESS)
-            goto on_exit;
-    }
-    if (capture) {
-        status = pjmedia_vid_port_start(capture);
-        if (status != PJ_SUCCESS)
-            goto on_exit;
-    }
-
-
-    /* Done */
-
-    if (dir == PJMEDIA_DIR_DECODING)
-	printf("Stream is active, dir is recv-only, local port is %d\n",
-	       local_port);
-    else if (dir == PJMEDIA_DIR_ENCODING)
-	printf("Stream is active, dir is send-only, sending to %s:%d\n",
-	       pj_inet_ntoa(remote_addr.sin_addr),
-	       pj_ntohs(remote_addr.sin_port));
-    else
-	printf("Stream is active, send/recv, local port is %d, "
-	       "sending to %s:%d\n",
-	       local_port,
-	       pj_inet_ntoa(remote_addr.sin_addr),
-	       pj_ntohs(remote_addr.sin_port));
-
-
-    for (;;) {
-
-	puts("");
-	puts("Commands:");
-	puts("  s     Display media statistics");
-	puts("  q     Quit");
-	puts("");
-
-	printf("Command: "); fflush(stdout);
-
-	if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
-	    puts("EOF while reading stdin, will quit now..");
-	    break;
-	}
-
-	if (tmp[0] == 's')
-	    ;//print_stream_stat(stream, &codec_param);
-	else if (tmp[0] == 'q')
-	    break;
-
-    }
-
-
-
-    /* Start deinitialization: */
-on_exit:
-
-    /* Destroy video devices */
-    if (capture)
-	pjmedia_vid_port_destroy(capture);
-    if (renderer)
-	pjmedia_vid_port_destroy(renderer);
-
-    /* If there is master port, then we just need to destroy master port
-     * (it will recursively destroy upstream and downstream ports, which
-     * in this case are file_port and stream_port).
-     */
-    if (master_port) {
-	pjmedia_master_port_destroy(master_port, PJ_TRUE);
-	play_file_port = NULL;
-	stream = NULL;
-    }
-
-    /* Destroy stream */
-    if (stream) {
-	pjmedia_transport *tp;
-
-	tp = pjmedia_stream_get_transport(stream);
-	pjmedia_stream_destroy(stream);
-	
-	pjmedia_transport_close(tp);
-    }
-
-    /* Destroy file ports */
-    if (play_file_port)
-	pjmedia_port_destroy( play_file_port );
-    if (rec_file_port)
-	pjmedia_port_destroy( rec_file_port );
-
-    /* Shutdown video subsystem */
-    pjmedia_vid_subsys_shutdown();
-
-    /* Release application pool */
-    pj_pool_release( pool );
-
-    /* Destroy media endpoint. */
-    pjmedia_endpt_destroy( med_endpt );
-
-    /* Destroy pool factory */
-    pj_caching_pool_destroy( &cp );
-
-    /* Shutdown PJLIB */
-    pj_shutdown();
-
-
-    return (status == PJ_SUCCESS) ? 0 : 1;
-}
-
-
-
-
-static const char *good_number(char *buf, pj_int32_t val)
-{
-    if (val < 1000) {
-	pj_ansi_sprintf(buf, "%d", val);
-    } else if (val < 1000000) {
-	pj_ansi_sprintf(buf, "%d.%dK", 
-			val / 1000,
-			(val % 1000) / 100);
-    } else {
-	pj_ansi_sprintf(buf, "%d.%02dM", 
-			val / 1000000,
-			(val % 1000000) / 10000);
-    }
-
-    return buf;
-}
-
-
-#define SAMPLES_TO_USEC(usec, samples, clock_rate) \
-    do { \
-	if (samples <= 4294) \
-	    usec = samples * 1000000 / clock_rate; \
-	else { \
-	    usec = samples * 1000 / clock_rate; \
-	    usec *= 1000; \
-	} \
-    } while(0)
-
-#define PRINT_VOIP_MTC_VAL(s, v) \
-    if (v == 127) \
-	sprintf(s, "(na)"); \
-    else \
-	sprintf(s, "%d", v)
-
-
-/*
- * Print stream statistics
- */
-static void print_stream_stat(pjmedia_stream *stream,
-			      const pjmedia_codec_param *codec_param)
-{
-    char duration[80], last_update[80];
-    char bps[16], ipbps[16], packets[16], bytes[16], ipbytes[16];
-    pjmedia_port *port;
-    pjmedia_rtcp_stat stat;
-    pj_time_val now;
-
-
-    pj_gettimeofday(&now);
-    pjmedia_stream_get_stat(stream, &stat);
-    pjmedia_stream_get_port(stream, &port);
-
-    puts("Stream statistics:");
-
-    /* Print duration */
-    PJ_TIME_VAL_SUB(now, stat.start);
-    sprintf(duration, " Duration: %02ld:%02ld:%02ld.%03ld",
-	    now.sec / 3600,
-	    (now.sec % 3600) / 60,
-	    (now.sec % 60),
-	    now.msec);
-
-
-    printf(" Info: audio %dHz, %dms/frame, %sB/s (%sB/s +IP hdr)\n",
-	PJMEDIA_PIA_SRATE(&port->info),
-	PJMEDIA_PIA_PTIME(&port->info),
-	good_number(bps, (codec_param->info.avg_bps+7)/8),
-	good_number(ipbps, ((codec_param->info.avg_bps+7)/8) + 
-			   (40 * 1000 /
-			    codec_param->setting.frm_per_pkt /
-			    codec_param->info.frm_ptime)));
-
-    if (stat.rx.update_cnt == 0)
-	strcpy(last_update, "never");
-    else {
-	pj_gettimeofday(&now);
-	PJ_TIME_VAL_SUB(now, stat.rx.update);
-	sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		now.sec / 3600,
-		(now.sec % 3600) / 60,
-		now.sec % 60,
-		now.msec);
-    }
-
-    printf(" RX stat last update: %s\n"
-	   "    total %s packets %sB received (%sB +IP hdr)%s\n"
-	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
-	   "          (msec)    min     avg     max     last    dev\n"
-	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
-	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
-	   last_update,
-	   good_number(packets, stat.rx.pkt),
-	   good_number(bytes, stat.rx.bytes),
-	   good_number(ipbytes, stat.rx.bytes + stat.rx.pkt * 32),
-	   "",
-	   stat.rx.loss,
-	   stat.rx.loss * 100.0 / (stat.rx.pkt + stat.rx.loss),
-	   stat.rx.dup, 
-	   stat.rx.dup * 100.0 / (stat.rx.pkt + stat.rx.loss),
-	   stat.rx.reorder, 
-	   stat.rx.reorder * 100.0 / (stat.rx.pkt + stat.rx.loss),
-	   "",
-	   stat.rx.loss_period.min / 1000.0, 
-	   stat.rx.loss_period.mean / 1000.0, 
-	   stat.rx.loss_period.max / 1000.0,
-	   stat.rx.loss_period.last / 1000.0,
-	   pj_math_stat_get_stddev(&stat.rx.loss_period) / 1000.0,
-	   "",
-	   stat.rx.jitter.min / 1000.0,
-	   stat.rx.jitter.mean / 1000.0,
-	   stat.rx.jitter.max / 1000.0,
-	   stat.rx.jitter.last / 1000.0,
-	   pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0,
-	   ""
-	   );
-
-
-    if (stat.tx.update_cnt == 0)
-	strcpy(last_update, "never");
-    else {
-	pj_gettimeofday(&now);
-	PJ_TIME_VAL_SUB(now, stat.tx.update);
-	sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		now.sec / 3600,
-		(now.sec % 3600) / 60,
-		now.sec % 60,
-		now.msec);
-    }
-
-    printf(" TX stat last update: %s\n"
-	   "    total %s packets %sB sent (%sB +IP hdr)%s\n"
-	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
-	   "          (msec)    min     avg     max     last    dev\n"
-	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
-	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
-	   last_update,
-	   good_number(packets, stat.tx.pkt),
-	   good_number(bytes, stat.tx.bytes),
-	   good_number(ipbytes, stat.tx.bytes + stat.tx.pkt * 32),
-	   "",
-	   stat.tx.loss,
-	   stat.tx.loss * 100.0 / (stat.tx.pkt + stat.tx.loss),
-	   stat.tx.dup, 
-	   stat.tx.dup * 100.0 / (stat.tx.pkt + stat.tx.loss),
-	   stat.tx.reorder, 
-	   stat.tx.reorder * 100.0 / (stat.tx.pkt + stat.tx.loss),
-	   "",
-	   stat.tx.loss_period.min / 1000.0, 
-	   stat.tx.loss_period.mean / 1000.0, 
-	   stat.tx.loss_period.max / 1000.0,
-	   stat.tx.loss_period.last / 1000.0,
-	   pj_math_stat_get_stddev(&stat.tx.loss_period) / 1000.0,
-	   "",
-	   stat.tx.jitter.min / 1000.0,
-	   stat.tx.jitter.mean / 1000.0,
-	   stat.tx.jitter.max / 1000.0,
-	   stat.tx.jitter.last / 1000.0,
-	   pj_math_stat_get_stddev(&stat.tx.jitter) / 1000.0,
-	   ""
-	   );
-
-
-    printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
-	   stat.rtt.min / 1000.0,
-	   stat.rtt.mean / 1000.0,
-	   stat.rtt.max / 1000.0,
-	   stat.rtt.last / 1000.0,
-	   pj_math_stat_get_stddev(&stat.rtt) / 1000.0,
-	   ""
-	   );
-
-#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
-    /* RTCP XR Reports */
-    do {
-	char loss[16], dup[16];
-	char jitter[80];
-	char toh[80];
-	char plc[16], jba[16], jbr[16];
-	char signal_lvl[16], noise_lvl[16], rerl[16];
-	char r_factor[16], ext_r_factor[16], mos_lq[16], mos_cq[16];
-	pjmedia_rtcp_xr_stat xr_stat;
-
-	if (pjmedia_stream_get_stat_xr(stream, &xr_stat) != PJ_SUCCESS)
-	    break;
-
-	puts("\nExtended reports:");
-
-	/* Statistics Summary */
-	puts(" Statistics Summary");
-
-	if (xr_stat.rx.stat_sum.l)
-	    sprintf(loss, "%d", xr_stat.rx.stat_sum.lost);
-	else
-	    sprintf(loss, "(na)");
-
-	if (xr_stat.rx.stat_sum.d)
-	    sprintf(dup, "%d", xr_stat.rx.stat_sum.dup);
-	else
-	    sprintf(dup, "(na)");
-
-	if (xr_stat.rx.stat_sum.j) {
-	    unsigned jmin, jmax, jmean, jdev;
-
-	    SAMPLES_TO_USEC(jmin, xr_stat.rx.stat_sum.jitter.min, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jmax, xr_stat.rx.stat_sum.jitter.max, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jmean, xr_stat.rx.stat_sum.jitter.mean, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jdev, 
-			   pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.jitter),
-			   port->info.clock_rate);
-	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
-		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
-	} else
-	    sprintf(jitter, "(report not available)");
-
-	if (xr_stat.rx.stat_sum.t) {
-	    sprintf(toh, "%11d %11d %11d %11d", 
-		    xr_stat.rx.stat_sum.toh.min,
-		    xr_stat.rx.stat_sum.toh.mean,
-		    xr_stat.rx.stat_sum.toh.max,
-		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
-	} else
-	    sprintf(toh, "(report not available)");
-
-	if (xr_stat.rx.stat_sum.update.sec == 0)
-	    strcpy(last_update, "never");
-	else {
-	    pj_gettimeofday(&now);
-	    PJ_TIME_VAL_SUB(now, xr_stat.rx.stat_sum.update);
-	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		    now.sec / 3600,
-		    (now.sec % 3600) / 60,
-		    now.sec % 60,
-		    now.msec);
-	}
-
-	printf(" RX last update: %s\n"
-	       "    begin seq=%d, end seq=%d%s\n"
-	       "    pkt loss=%s, dup=%s%s\n"
-	       "          (msec)    min     avg     max     dev\n"
-	       "    jitter     : %s\n"
-	       "    toh        : %s\n",
-	       last_update,
-	       xr_stat.rx.stat_sum.begin_seq, xr_stat.rx.stat_sum.end_seq,
-	       "",
-	       loss, dup,
-	       "",
-	       jitter,
-	       toh
-	       );
-
-	if (xr_stat.tx.stat_sum.l)
-	    sprintf(loss, "%d", xr_stat.tx.stat_sum.lost);
-	else
-	    sprintf(loss, "(na)");
-
-	if (xr_stat.tx.stat_sum.d)
-	    sprintf(dup, "%d", xr_stat.tx.stat_sum.dup);
-	else
-	    sprintf(dup, "(na)");
-
-	if (xr_stat.tx.stat_sum.j) {
-	    unsigned jmin, jmax, jmean, jdev;
-
-	    SAMPLES_TO_USEC(jmin, xr_stat.tx.stat_sum.jitter.min, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jmax, xr_stat.tx.stat_sum.jitter.max, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jmean, xr_stat.tx.stat_sum.jitter.mean, 
-			    port->info.clock_rate);
-	    SAMPLES_TO_USEC(jdev, 
-			   pj_math_stat_get_stddev(&xr_stat.tx.stat_sum.jitter),
-			   port->info.clock_rate);
-	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
-		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
-	} else
-	    sprintf(jitter, "(report not available)");
-
-	if (xr_stat.tx.stat_sum.t) {
-	    sprintf(toh, "%11d %11d %11d %11d", 
-		    xr_stat.tx.stat_sum.toh.min,
-		    xr_stat.tx.stat_sum.toh.mean,
-		    xr_stat.tx.stat_sum.toh.max,
-		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
-	} else
-	    sprintf(toh,    "(report not available)");
-
-	if (xr_stat.tx.stat_sum.update.sec == 0)
-	    strcpy(last_update, "never");
-	else {
-	    pj_gettimeofday(&now);
-	    PJ_TIME_VAL_SUB(now, xr_stat.tx.stat_sum.update);
-	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		    now.sec / 3600,
-		    (now.sec % 3600) / 60,
-		    now.sec % 60,
-		    now.msec);
-	}
-
-	printf(" TX last update: %s\n"
-	       "    begin seq=%d, end seq=%d%s\n"
-	       "    pkt loss=%s, dup=%s%s\n"
-	       "          (msec)    min     avg     max     dev\n"
-	       "    jitter     : %s\n"
-	       "    toh        : %s\n",
-	       last_update,
-	       xr_stat.tx.stat_sum.begin_seq, xr_stat.tx.stat_sum.end_seq,
-	       "",
-	       loss, dup,
-	       "",
-	       jitter,
-	       toh
-	       );
-
-	/* VoIP Metrics */
-	puts(" VoIP Metrics");
-
-	PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.rx.voip_mtc.signal_lvl);
-	PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.rx.voip_mtc.noise_lvl);
-	PRINT_VOIP_MTC_VAL(rerl, xr_stat.rx.voip_mtc.rerl);
-	PRINT_VOIP_MTC_VAL(r_factor, xr_stat.rx.voip_mtc.r_factor);
-	PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.rx.voip_mtc.ext_r_factor);
-	PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.rx.voip_mtc.mos_lq);
-	PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.rx.voip_mtc.mos_cq);
-
-	switch ((xr_stat.rx.voip_mtc.rx_config>>6) & 3) {
-	    case PJMEDIA_RTCP_XR_PLC_DIS:
-		sprintf(plc, "DISABLED");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_ENH:
-		sprintf(plc, "ENHANCED");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_STD:
-		sprintf(plc, "STANDARD");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_UNK:
-	    default:
-		sprintf(plc, "UNKNOWN");
-		break;
-	}
-
-	switch ((xr_stat.rx.voip_mtc.rx_config>>4) & 3) {
-	    case PJMEDIA_RTCP_XR_JB_FIXED:
-		sprintf(jba, "FIXED");
-		break;
-	    case PJMEDIA_RTCP_XR_JB_ADAPTIVE:
-		sprintf(jba, "ADAPTIVE");
-		break;
-	    default:
-		sprintf(jba, "UNKNOWN");
-		break;
-	}
-
-	sprintf(jbr, "%d", xr_stat.rx.voip_mtc.rx_config & 0x0F);
-
-	if (xr_stat.rx.voip_mtc.update.sec == 0)
-	    strcpy(last_update, "never");
-	else {
-	    pj_gettimeofday(&now);
-	    PJ_TIME_VAL_SUB(now, xr_stat.rx.voip_mtc.update);
-	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		    now.sec / 3600,
-		    (now.sec % 3600) / 60,
-		    now.sec % 60,
-		    now.msec);
-	}
-
-	printf(" RX last update: %s\n"
-	       "    packets    : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n"
-	       "    burst      : density=%d (%.2f%%), duration=%d%s\n"
-	       "    gap        : density=%d (%.2f%%), duration=%d%s\n"
-	       "    delay      : round trip=%d%s, end system=%d%s\n"
-	       "    level      : signal=%s%s, noise=%s%s, RERL=%s%s\n"
-	       "    quality    : R factor=%s, ext R factor=%s\n"
-	       "                 MOS LQ=%s, MOS CQ=%s\n"
-	       "    config     : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n"
-	       "    JB delay   : cur=%d%s, max=%d%s, abs max=%d%s\n",
-	       last_update,
-	       /* pakcets */
-	       xr_stat.rx.voip_mtc.loss_rate, xr_stat.rx.voip_mtc.loss_rate*100.0/256,
-	       xr_stat.rx.voip_mtc.discard_rate, xr_stat.rx.voip_mtc.discard_rate*100.0/256,
-	       /* burst */
-	       xr_stat.rx.voip_mtc.burst_den, xr_stat.rx.voip_mtc.burst_den*100.0/256,
-	       xr_stat.rx.voip_mtc.burst_dur, "ms",
-	       /* gap */
-	       xr_stat.rx.voip_mtc.gap_den, xr_stat.rx.voip_mtc.gap_den*100.0/256,
-	       xr_stat.rx.voip_mtc.gap_dur, "ms",
-	       /* delay */
-	       xr_stat.rx.voip_mtc.rnd_trip_delay, "ms",
-	       xr_stat.rx.voip_mtc.end_sys_delay, "ms",
-	       /* level */
-	       signal_lvl, "dB",
-	       noise_lvl, "dB",
-	       rerl, "",
-	       /* quality */
-	       r_factor, ext_r_factor, mos_lq, mos_cq,
-	       /* config */
-	       plc, jba, jbr, xr_stat.rx.voip_mtc.gmin,
-	       /* JB delay */
-	       xr_stat.rx.voip_mtc.jb_nom, "ms",
-	       xr_stat.rx.voip_mtc.jb_max, "ms",
-	       xr_stat.rx.voip_mtc.jb_abs_max, "ms"
-	       );
-
-	PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.tx.voip_mtc.signal_lvl);
-	PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.tx.voip_mtc.noise_lvl);
-	PRINT_VOIP_MTC_VAL(rerl, xr_stat.tx.voip_mtc.rerl);
-	PRINT_VOIP_MTC_VAL(r_factor, xr_stat.tx.voip_mtc.r_factor);
-	PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.tx.voip_mtc.ext_r_factor);
-	PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.tx.voip_mtc.mos_lq);
-	PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.tx.voip_mtc.mos_cq);
-
-	switch ((xr_stat.tx.voip_mtc.rx_config>>6) & 3) {
-	    case PJMEDIA_RTCP_XR_PLC_DIS:
-		sprintf(plc, "DISABLED");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_ENH:
-		sprintf(plc, "ENHANCED");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_STD:
-		sprintf(plc, "STANDARD");
-		break;
-	    case PJMEDIA_RTCP_XR_PLC_UNK:
-	    default:
-		sprintf(plc, "unknown");
-		break;
-	}
-
-	switch ((xr_stat.tx.voip_mtc.rx_config>>4) & 3) {
-	    case PJMEDIA_RTCP_XR_JB_FIXED:
-		sprintf(jba, "FIXED");
-		break;
-	    case PJMEDIA_RTCP_XR_JB_ADAPTIVE:
-		sprintf(jba, "ADAPTIVE");
-		break;
-	    default:
-		sprintf(jba, "unknown");
-		break;
-	}
-
-	sprintf(jbr, "%d", xr_stat.tx.voip_mtc.rx_config & 0x0F);
-
-	if (xr_stat.tx.voip_mtc.update.sec == 0)
-	    strcpy(last_update, "never");
-	else {
-	    pj_gettimeofday(&now);
-	    PJ_TIME_VAL_SUB(now, xr_stat.tx.voip_mtc.update);
-	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
-		    now.sec / 3600,
-		    (now.sec % 3600) / 60,
-		    now.sec % 60,
-		    now.msec);
-	}
-
-	printf(" TX last update: %s\n"
-	       "    packets    : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n"
-	       "    burst      : density=%d (%.2f%%), duration=%d%s\n"
-	       "    gap        : density=%d (%.2f%%), duration=%d%s\n"
-	       "    delay      : round trip=%d%s, end system=%d%s\n"
-	       "    level      : signal=%s%s, noise=%s%s, RERL=%s%s\n"
-	       "    quality    : R factor=%s, ext R factor=%s\n"
-	       "                 MOS LQ=%s, MOS CQ=%s\n"
-	       "    config     : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n"
-	       "    JB delay   : cur=%d%s, max=%d%s, abs max=%d%s\n",
-	       last_update,
-	       /* pakcets */
-	       xr_stat.tx.voip_mtc.loss_rate, xr_stat.tx.voip_mtc.loss_rate*100.0/256,
-	       xr_stat.tx.voip_mtc.discard_rate, xr_stat.tx.voip_mtc.discard_rate*100.0/256,
-	       /* burst */
-	       xr_stat.tx.voip_mtc.burst_den, xr_stat.tx.voip_mtc.burst_den*100.0/256,
-	       xr_stat.tx.voip_mtc.burst_dur, "ms",
-	       /* gap */
-	       xr_stat.tx.voip_mtc.gap_den, xr_stat.tx.voip_mtc.gap_den*100.0/256,
-	       xr_stat.tx.voip_mtc.gap_dur, "ms",
-	       /* delay */
-	       xr_stat.tx.voip_mtc.rnd_trip_delay, "ms",
-	       xr_stat.tx.voip_mtc.end_sys_delay, "ms",
-	       /* level */
-	       signal_lvl, "dB",
-	       noise_lvl, "dB",
-	       rerl, "",
-	       /* quality */
-	       r_factor, ext_r_factor, mos_lq, mos_cq,
-	       /* config */
-	       plc, jba, jbr, xr_stat.tx.voip_mtc.gmin,
-	       /* JB delay */
-	       xr_stat.tx.voip_mtc.jb_nom, "ms",
-	       xr_stat.tx.voip_mtc.jb_max, "ms",
-	       xr_stat.tx.voip_mtc.jb_abs_max, "ms"
-	       );
-
-
-	/* RTT delay (by receiver side) */
-	printf("          (msec)    min     avg     max     last    dev\n");
-	printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
-	       xr_stat.rtt.min / 1000.0,
-	       xr_stat.rtt.mean / 1000.0,
-	       xr_stat.rtt.max / 1000.0,
-	       xr_stat.rtt.last / 1000.0,
-	       pj_math_stat_get_stddev(&xr_stat.rtt) / 1000.0,
-	       ""
-	       );
-    } while (0);
-#endif /* PJMEDIA_HAS_RTCP_XR */
-
-}
-
