Index: /pjproject/trunk/pjmedia/include/pjmedia/conference.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia/conference.h	(revision 632)
+++ /pjproject/trunk/pjmedia/include/pjmedia/conference.h	(revision 633)
@@ -173,10 +173,14 @@
 
 /**
- * Add stream port to the conference bridge. By default, the new conference
- * port will have both TX and RX enabled, but it is not connected to any
- * other ports.
- *
- * Application SHOULD call #pjmedia_conf_connect_port() to enable audio
- * transmission and receipt to/from this port.
+ * Add media port to the conference bridge.
+ *
+ * By default, the new conference port will have both TX and RX enabled, 
+ * but it is not connected to any other ports. Application SHOULD call 
+ * #pjmedia_conf_connect_port() to  enable audio transmission and receipt 
+ * to/from this port.
+ *
+ * Once the media port is connected to other port(s) in the bridge,
+ * the bridge will continuosly call get_frame() and put_frame() to the
+ * port, allowing media to flow to/from the port.
  *
  * @param conf		The conference bridge.
@@ -198,4 +202,43 @@
 
 
+/**
+ * Create and add a passive media port to the conference bridge. Unlike
+ * "normal" media port that is added with #pjmedia_conf_add_port(), media
+ * port created with this function will not have its get_frame() and
+ * put_frame() called by the bridge; instead, application MUST continuosly
+ * call these functions to the port, to allow media to flow from/to the
+ * port.
+ *
+ * Upon return of this function, application will be given two objects:
+ * the slot number of the port in the bridge, and pointer to the media
+ * port where application MUST start calling get_frame() and put_frame()
+ * to the port.
+ *
+ * @param conf		    The conference bridge.
+ * @param pool		    Pool to allocate buffers etc for this port.
+ * @param name		    Name to be assigned to the port.
+ * @param clock_rate	    Clock rate/sampling rate.
+ * @param channel_count	    Number of channels.
+ * @param samples_per_frame Number of samples per frame.
+ * @param bits_per_sample   Number of bits per sample.
+ * @param options	    Options (should be zero at the moment).
+ * @param p_slot	    Pointer to receive the slot index of the port in
+ *			    the conference bridge.
+ * @param p_port	    Pointer to receive the port instance.
+ *
+ * @return		    PJ_SUCCESS on success, or the appropriate error 
+ *			    code.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_add_passive_port( pjmedia_conf *conf,
+						    pj_pool_t *pool,
+						    const pj_str_t *name,
+						    unsigned clock_rate,
+						    unsigned channel_count,
+						    unsigned samples_per_frame,
+						    unsigned bits_per_sample,
+						    unsigned options,
+						    unsigned *p_slot,
+						    pjmedia_port **p_port );
+
 
 /**
Index: /pjproject/trunk/pjmedia/include/pjmedia/port.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia/port.h	(revision 632)
+++ /pjproject/trunk/pjmedia/include/pjmedia/port.h	(revision 633)
@@ -292,5 +292,4 @@
 {
     PJMEDIA_FRAME_TYPE_NONE,	    /**< No frame.		*/
-    PJMEDIA_FRAME_TYPE_CNG,	    /**< Silence audio frame.	*/
     PJMEDIA_FRAME_TYPE_AUDIO	    /**< Normal audio frame.	*/
 
@@ -333,5 +332,12 @@
 {
     pjmedia_port_info	 info;		    /**< Port information.  */
-    void		*user_data;	    /**< User data.	    */
+
+    /** Port data can be used by the port creator to attach arbitrary
+     *  value to be associated with the port.
+     */
+    struct port_data {
+	void		*pdata;		    /**< Pointer data.	    */
+	long		 ldata;		    /**< Long data.	    */
+    } port_data;
 
     /**
Index: /pjproject/trunk/pjmedia/src/pjmedia/conference.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 633)
@@ -30,4 +30,5 @@
 #include <pj/string.h>
 
+
 /* CONF_DEBUG enables detailed operation of the conference bridge.
  * Beware that it prints large amounts of logs (several lines per frame).
@@ -58,4 +59,6 @@
 #define BYTES_PER_SAMPLE    2
 
+#define SIGNATURE	    PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F')
+#define SIGNATURE_PORT	    PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'P')
 #define NORMAL_LEVEL	    128
 #define SLOT_TYPE	    unsigned
@@ -197,4 +200,6 @@
 static pj_status_t get_frame(pjmedia_port *this_port, 
 			     pjmedia_frame *frame);
+static pj_status_t get_frame_pasv(pjmedia_port *this_port, 
+				  pjmedia_frame *frame);
 static pj_status_t destroy_port(pjmedia_port *this_port);
 
@@ -329,29 +334,29 @@
 }
 
-/*
- * Create port zero for the sound device.
- */
-static pj_status_t create_sound_port( pj_pool_t *pool,
-				      pjmedia_conf *conf )
+
+/*
+ * Add passive port.
+ */
+static pj_status_t create_pasv_port( pjmedia_conf *conf,
+				     pj_pool_t *pool,
+				     const pj_str_t *name,
+				     pjmedia_port *port,
+				     struct conf_port **p_conf_port)
 {
     struct conf_port *conf_port;
-    pj_str_t name = { "Master/sound", 12 };
     unsigned i;
     pj_status_t status;
 
-
-
     /* Create port */
-    status = create_conf_port(pool, conf, NULL, &name, &conf_port);
+    status = create_conf_port(pool, conf, port, name, &conf_port);
     if (status != PJ_SUCCESS)
-	goto on_error;
-
-    /* Sound device has rx buffers. */
+	return status;
+
+    /* Passive port has rx buffers. */
     for (i=0; i<RX_BUF_COUNT; ++i) {
 	conf_port->snd_buf[i] = pj_pool_zalloc(pool, conf->samples_per_frame *
 					      sizeof(conf_port->snd_buf[0][0]));
 	if (conf_port->snd_buf[i] == NULL) {
-	    status = PJ_ENOMEM;
-	    goto on_error;
+	    return PJ_ENOMEM;
 	}
     }
@@ -359,8 +364,24 @@
     conf_port->snd_read_pos = 0;
 
-
-     /* Set to port zero */
-    conf->ports[0] = conf_port;
-    conf->port_cnt++;
+    *p_conf_port = conf_port;
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Create port zero for the sound device.
+ */
+static pj_status_t create_sound_port( pj_pool_t *pool,
+				      pjmedia_conf *conf )
+{
+    struct conf_port *conf_port;
+    pj_str_t name = { "Master/sound", 12 };
+    pj_status_t status;
+
+
+    status = create_pasv_port(conf, pool, &name, NULL, &conf_port);
+    if (status != PJ_SUCCESS)
+	return status;
 
 
@@ -395,10 +416,11 @@
 
 
+     /* Add the port to the bridge */
+    conf->ports[0] = conf_port;
+    conf->port_cnt++;
+
+
     PJ_LOG(5,(THIS_FILE, "Sound device successfully created for port 0"));
     return PJ_SUCCESS;
-
-on_error:
-    return status;
-
 }
 
@@ -416,4 +438,5 @@
 {
     pjmedia_conf *conf;
+    const pj_str_t name = { "Conf", 4 };
     pj_status_t status;
 
@@ -443,23 +466,14 @@
     PJ_ASSERT_RETURN(conf->master_port, PJ_ENOMEM);
     
-    conf->master_port->info.bits_per_sample = bits_per_sample;
-    conf->master_port->info.bytes_per_frame = samples_per_frame *
-					      bits_per_sample / 8;
-    conf->master_port->info.channel_count = channel_count;
-    conf->master_port->info.encoding_name = pj_str("pcm");
-    conf->master_port->info.has_info = 1;
-    conf->master_port->info.name = pj_str("sound-dev");
-    conf->master_port->info.need_info = 0;
-    conf->master_port->info.pt = 0xFF;
-    conf->master_port->info.clock_rate = clock_rate;
-    conf->master_port->info.samples_per_frame = samples_per_frame;
-    conf->master_port->info.signature = 0;
-    conf->master_port->info.type = PJMEDIA_TYPE_AUDIO;
+    pjmedia_port_info_init(&conf->master_port->info, &name, SIGNATURE,
+			   clock_rate, channel_count, bits_per_sample,
+			   samples_per_frame);
+
+    conf->master_port->port_data.pdata = conf;
+    conf->master_port->port_data.ldata = 0;
 
     conf->master_port->get_frame = &get_frame;
     conf->master_port->put_frame = &put_frame;
     conf->master_port->on_destroy = &destroy_port;
-
-    conf->master_port->user_data = conf;
 
 
@@ -545,5 +559,5 @@
 static pj_status_t destroy_port(pjmedia_port *this_port)
 {
-    pjmedia_conf *conf = this_port->user_data;
+    pjmedia_conf *conf = this_port->port_data.pdata;
     return pjmedia_conf_destroy(conf);
 }
@@ -630,4 +644,102 @@
     return PJ_SUCCESS;
 }
+
+
+/*
+ * Add passive port.
+ */
+PJ_DEF(pj_status_t) pjmedia_conf_add_passive_port( pjmedia_conf *conf,
+						   pj_pool_t *pool,
+						   const pj_str_t *name,
+						   unsigned clock_rate,
+						   unsigned channel_count,
+						   unsigned samples_per_frame,
+						   unsigned bits_per_sample,
+						   unsigned options,
+						   unsigned *p_slot,
+						   pjmedia_port **p_port )
+{
+    struct conf_port *conf_port;
+    pjmedia_port *port;
+    unsigned index;
+    pj_str_t tmp;
+    pj_status_t status;
+
+    PJ_ASSERT_RETURN(conf && pool, PJ_EINVAL);
+
+    /* For this version of PJMEDIA, port MUST have the same number of
+     * PCM channels.
+     */
+    if (channel_count != conf->channel_count) {
+	pj_assert(!"Number of channels mismatch");
+	return PJMEDIA_ENCCHANNEL;
+    }
+
+    /* For this version, options must be zero */
+    PJ_ASSERT_RETURN(options == 0, PJ_EINVAL);
+    PJ_UNUSED_ARG(options);
+
+    pj_mutex_lock(conf->mutex);
+
+    if (conf->port_cnt >= conf->max_ports) {
+	pj_assert(!"Too many ports");
+	pj_mutex_unlock(conf->mutex);
+	return PJ_ETOOMANY;
+    }
+
+    /* Find empty port in the conference bridge. */
+    for (index=0; index < conf->max_ports; ++index) {
+	if (conf->ports[index] == NULL)
+	    break;
+    }
+
+    pj_assert(index != conf->max_ports);
+
+    if (name == NULL) {
+	name = &tmp;
+
+	tmp.ptr = pj_pool_alloc(pool, 20);
+	tmp.slen = pj_ansi_sprintf(tmp.ptr, "ConfPort#%d", index);
+    }
+
+    /* Create and initialize the media port structure. */
+    port = pj_pool_zalloc(pool, sizeof(pjmedia_port));
+    PJ_ASSERT_RETURN(port, PJ_ENOMEM);
+    
+    pjmedia_port_info_init(&port->info, name, SIGNATURE_PORT,
+			   clock_rate, channel_count, bits_per_sample,
+			   samples_per_frame);
+
+    port->port_data.pdata = conf;
+    port->port_data.ldata = index;
+
+    port->get_frame = &get_frame_pasv;
+    port->put_frame = &put_frame;
+    port->on_destroy = NULL;
+
+    
+    /* Create conf port structure. */
+    status = create_pasv_port(conf, pool, name, port, &conf_port);
+    if (status != PJ_SUCCESS) {
+	pj_mutex_unlock(conf->mutex);
+	return status;
+    }
+
+
+    /* Put the port. */
+    conf->ports[index] = conf_port;
+    conf->port_cnt++;
+
+    /* Done. */
+    if (p_slot)
+	*p_slot = index;
+    if (p_port)
+	*p_port = port;
+
+    pj_mutex_unlock(conf->mutex);
+
+    return PJ_SUCCESS;
+}
+
 
 
@@ -1363,5 +1475,5 @@
 			     pjmedia_frame *frame)
 {
-    pjmedia_conf *conf = this_port->user_data;
+    pjmedia_conf *conf = this_port->port_data.pdata;
     unsigned ci, cj, i, j;
     
@@ -1419,8 +1531,8 @@
 
 	/* Get frame from this port. 
-	 * For port zero (sound port), get the frame  from the rx_buffer
-	 * instead.
+	 * For port zero (sound port) and passive ports, get the frame  from 
+	 * the rx_buffer instead.
 	 */
-	if (i==0) {
+	if (conf_port->port == NULL) {
 	    pj_int16_t *snd_buf;
 
@@ -1616,4 +1728,15 @@
 
 /*
+ * get_frame() for passive port
+ */
+static pj_status_t get_frame_pasv(pjmedia_port *this_port, 
+				  pjmedia_frame *frame)
+{
+    pj_assert(0);
+    return -1;
+}
+
+
+/*
  * Recorder callback.
  */
@@ -1621,6 +1744,6 @@
 			     const pjmedia_frame *frame)
 {
-    pjmedia_conf *conf = this_port->user_data;
-    struct conf_port *snd_port = conf->ports[0];
+    pjmedia_conf *conf = this_port->port_data.pdata;
+    struct conf_port *port = conf->ports[this_port->port_data.ldata];
     const pj_int16_t *input = frame->buf;
     pj_int16_t *target_snd_buf;
@@ -1632,10 +1755,10 @@
 
     /* Skip if this port is muted/disabled. */
-    if (snd_port->rx_setting != PJMEDIA_PORT_ENABLE) {
+    if (port->rx_setting != PJMEDIA_PORT_ENABLE) {
 	return PJ_SUCCESS;
     }
 
     /* Skip if no port is listening to the microphone */
-    if (snd_port->listener_cnt == 0) {
+    if (port->listener_cnt == 0) {
 	return PJ_SUCCESS;
     }
@@ -1643,5 +1766,5 @@
 
     /* Determine which rx_buffer to fill in */
-    target_snd_buf = snd_port->snd_buf[snd_port->snd_write_pos];
+    target_snd_buf = port->snd_buf[port->snd_write_pos];
     
     /* Copy samples from audio device to target rx_buffer */
@@ -1649,8 +1772,8 @@
 
     /* Switch buffer */
-    snd_port->snd_write_pos = (snd_port->snd_write_pos+1)%RX_BUF_COUNT;
-
-
-    return PJ_SUCCESS;
-}
-
+    port->snd_write_pos = (port->snd_write_pos+1)%RX_BUF_COUNT;
+
+
+    return PJ_SUCCESS;
+}
+
Index: /pjproject/trunk/pjmedia/src/pjmedia/mem_capture.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/mem_capture.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/mem_capture.c	(revision 633)
@@ -58,4 +58,5 @@
 {
     struct mem_rec *rec;
+    const pj_str_t name = { "memrec", 6 };
 
     /* Sanity check */
@@ -72,11 +73,8 @@
 
     /* Create the rec */
-    rec->base.info.name = pj_str("memrec");
-    rec->base.info.signature = SIGNATURE;
-    rec->base.info.type = PJMEDIA_TYPE_AUDIO;
-    rec->base.info.has_info = PJ_TRUE;
-    rec->base.info.need_info = PJ_FALSE;
-    rec->base.info.pt = 0xFF;
-    rec->base.info.encoding_name = pj_str("pcm");
+    pjmedia_port_info_init(&rec->base.info, &name, SIGNATURE,
+			   clock_rate, channel_count, bits_per_sample, 
+			   samples_per_frame);
+
 
     rec->base.put_frame = &rec_put_frame;
@@ -84,9 +82,4 @@
     rec->base.on_destroy = &rec_on_destroy;
 
-    rec->base.info.clock_rate = clock_rate;
-    rec->base.info.channel_count = channel_count;
-    rec->base.info.bits_per_sample = bits_per_sample;
-    rec->base.info.samples_per_frame = samples_per_frame;
-    rec->base.info.bytes_per_frame = samples_per_frame * bits_per_sample / 2;
 
     /* Save the buffer */
Index: /pjproject/trunk/pjmedia/src/pjmedia/mem_player.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/mem_player.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/mem_player.c	(revision 633)
@@ -59,4 +59,5 @@
 {
     struct mem_player *port;
+    pj_str_t name = pj_str("memplayer");
 
     /* Sanity check */
@@ -73,11 +74,6 @@
 
     /* Create the port */
-    port->base.info.name = pj_str("memplayer");
-    port->base.info.signature = SIGNATURE;
-    port->base.info.type = PJMEDIA_TYPE_AUDIO;
-    port->base.info.has_info = PJ_TRUE;
-    port->base.info.need_info = PJ_FALSE;
-    port->base.info.pt = 0xFF;
-    port->base.info.encoding_name = pj_str("pcm");
+    pjmedia_port_info_init(&port->base.info, &name, SIGNATURE, clock_rate,
+			   channel_count, bits_per_sample, samples_per_frame);
 
     port->base.put_frame = &mem_put_frame;
@@ -85,9 +81,4 @@
     port->base.on_destroy = &mem_on_destroy;
 
-    port->base.info.clock_rate = clock_rate;
-    port->base.info.channel_count = channel_count;
-    port->base.info.bits_per_sample = bits_per_sample;
-    port->base.info.samples_per_frame = samples_per_frame;
-    port->base.info.bytes_per_frame = samples_per_frame * bits_per_sample / 2;
 
     /* Save the buffer */
Index: /pjproject/trunk/pjmedia/src/pjmedia/null_port.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/null_port.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/null_port.c	(revision 633)
@@ -24,4 +24,6 @@
 
 
+#define SIGNATURE   PJMEDIA_PORT_SIGNATURE('N', 'U', 'L', 'L')
+
 static pj_status_t null_get_frame(pjmedia_port *this_port, 
 				  pjmedia_frame *frame);
@@ -39,4 +41,5 @@
 {
     pjmedia_port *port;
+    const pj_str_t name = pj_str("null-port");
 
     PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL);
@@ -45,16 +48,6 @@
     PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM);
 
-    port->info.bits_per_sample = bits_per_sample;
-    port->info.bytes_per_frame = samples_per_frame * bits_per_sample / 8;
-    port->info.encoding_name = pj_str("pcm");
-    port->info.has_info = 1;
-    port->info.name = pj_str("null-port");
-    port->info.need_info = 0;
-    port->info.pt = 0xFF;
-    port->info.clock_rate = sampling_rate;
-    port->info.samples_per_frame = samples_per_frame;
-    port->info.channel_count = channel_count;
-    port->info.signature = 0x2411;
-    port->info.type = PJMEDIA_TYPE_AUDIO;
+    pjmedia_port_info_init(&port->info, &name, SIGNATURE, sampling_rate,
+			   channel_count, bits_per_sample, samples_per_frame);
 
     port->get_frame = &null_get_frame;
Index: /pjproject/trunk/pjmedia/src/pjmedia/resample_port.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/resample_port.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/resample_port.c	(revision 633)
@@ -25,4 +25,6 @@
 
 #define BYTES_PER_SAMPLE	2
+#define SIGNATURE		PJMEDIA_PORT_SIGNATURE('R','S','M','P')
+
 
 struct resample_port
@@ -53,4 +55,5 @@
 						  pjmedia_port **p_port  )
 {
+    const pj_str_t name = pj_str("resample");
     struct resample_port *rport;
     unsigned ptime;
@@ -70,17 +73,7 @@
     PJ_ASSERT_RETURN(rport != NULL, PJ_ENOMEM);
 
-    rport->base.info.clock_rate = clock_rate;
-    rport->base.info.samples_per_frame = clock_rate * ptime / 1000;
-    rport->base.info.bytes_per_frame = rport->base.info.samples_per_frame *
-				       BYTES_PER_SAMPLE;
-    rport->base.info.bits_per_sample = BYTES_PER_SAMPLE * 8;
-    rport->base.info.channel_count = dn_port->info.channel_count;
-    rport->base.info.encoding_name = pj_str("pcm");
-    rport->base.info.has_info = 1;
-    rport->base.info.name = pj_str("resample");
-    rport->base.info.need_info = 0;
-    rport->base.info.pt = 0xFF;
-    rport->base.info.signature = PJMEDIA_PORT_SIGNATURE('R','S','M','P');
-    rport->base.info.type = PJMEDIA_TYPE_AUDIO;
+    pjmedia_port_info_init(&rport->base.info, &name, SIGNATURE, clock_rate,
+			   dn_port->info.channel_count, BYTES_PER_SAMPLE * 8, 
+			   clock_rate * ptime / 1000);
 
     rport->dn_port = dn_port;
Index: /pjproject/trunk/pjmedia/src/pjmedia/splitcomb.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/splitcomb.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/splitcomb.c	(revision 633)
@@ -25,4 +25,5 @@
 
 #define SIGNATURE	    PJMEDIA_PORT_SIGNATURE('S', 'p', 'C', 'b')
+#define SIGNATURE_PORT	    PJMEDIA_PORT_SIGNATURE('S', 'p', 'C', 'P')
 #define THIS_FILE	    "splitcomb.c"
 #define TMP_SAMP_TYPE	    pj_int16_t
@@ -129,4 +130,5 @@
 					      pjmedia_port **p_splitcomb)
 {
+    const pj_str_t name = pj_str("splitcomb");
     struct splitcomb *sc;
 
@@ -161,16 +163,6 @@
 
     /* Initialize port */
-    sc->base.info.name = pj_str("splitcomb");
-    sc->base.info.signature = SIGNATURE;
-    sc->base.info.type = PJMEDIA_TYPE_AUDIO;
-    sc->base.info.has_info = PJ_TRUE;
-    sc->base.info.need_info = PJ_FALSE;
-    sc->base.info.pt = 0xFF;
-    sc->base.info.encoding_name = pj_str("pcm");
-    sc->base.info.clock_rate = clock_rate;
-    sc->base.info.channel_count = channel_count;
-    sc->base.info.bits_per_sample = bits_per_sample;
-    sc->base.info.samples_per_frame = samples_per_frame;
-    sc->base.info.bytes_per_frame = samples_per_frame * bits_per_sample / 8;
+    pjmedia_port_info_init(&sc->base.info, &name, SIGNATURE, clock_rate,
+			   channel_count, bits_per_sample, samples_per_frame);
 
     sc->base.put_frame = &put_frame;
@@ -227,4 +219,5 @@
 				      pjmedia_port **p_chport)
 {
+    const pj_str_t name = pj_str("splitcomb-ch");
     struct splitcomb *sc = (struct splitcomb*) splitcomb;
     struct reverse_port *rport;
@@ -251,18 +244,9 @@
     /* Initialize port info... */
     port = &rport->base;
-    port->info.name = pj_str("splitcomb-ch");
-    port->info.signature = 0;
-    port->info.type = PJMEDIA_TYPE_AUDIO;
-    port->info.has_info = PJ_TRUE;
-    port->info.need_info = PJ_FALSE;
-    port->info.pt = 0xFF;
-    port->info.encoding_name = pj_str("pcm");
-    port->info.clock_rate = splitcomb->info.clock_rate;
-    port->info.channel_count = 1;
-    port->info.bits_per_sample = splitcomb->info.bits_per_sample;
-    port->info.samples_per_frame = splitcomb->info.samples_per_frame /
-				   splitcomb->info.channel_count;
-    port->info.bytes_per_frame = port->info.samples_per_frame * 
-				 port->info.bits_per_sample / 8;
+    pjmedia_port_info_init(&port->info, &name, SIGNATURE_PORT, 
+			   splitcomb->info.clock_rate, 1, 
+			   splitcomb->info.bits_per_sample, 
+			   splitcomb->info.samples_per_frame / 
+				   splitcomb->info.channel_count);
 
     /* ... and the callbacks */
Index: /pjproject/trunk/pjmedia/src/pjmedia/stream.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 633)
@@ -144,5 +144,5 @@
 static pj_status_t get_frame( pjmedia_port *port, pjmedia_frame *frame)
 {
-    pjmedia_stream *stream = port->user_data;
+    pjmedia_stream *stream = port->port_data.pdata;
     pjmedia_channel *channel = stream->dec;
     unsigned samples_count, samples_per_frame, samples_required;
@@ -439,5 +439,5 @@
 			      const pjmedia_frame *frame )
 {
-    pjmedia_stream *stream = port->user_data;
+    pjmedia_stream *stream = port->port_data.pdata;
     pjmedia_channel *channel = stream->enc;
     pj_status_t status = 0;
@@ -914,4 +914,5 @@
 {
     pjmedia_stream *stream;
+    pj_str_t name;
     unsigned jb_init, jb_max, jb_min_pre, jb_max_pre;
     pj_status_t status;
@@ -926,19 +927,22 @@
 
     /* Init stream/port name */
-    stream->port.info.name.ptr = pj_pool_alloc(pool, 24);
-    pj_ansi_sprintf(stream->port.info.name.ptr,
-		    "strm%p", stream);
-    stream->port.info.name.slen = pj_ansi_strlen(stream->port.info.name.ptr);
+    name.ptr = pj_pool_alloc(pool, 24);
+    name.slen = pj_ansi_snprintf(name.ptr, 24, "strm%p", stream);
+
+
+    /* Init some port-info. Some parts of the info will be set later
+     * once we have more info about the codec.
+     */
+    pjmedia_port_info_init(&stream->port.info, &name,
+			   PJMEDIA_PORT_SIGNATURE('S', 'T', 'R', 'M'),
+			   info->fmt.clock_rate, info->fmt.channel_cnt,
+			   16, 80);
 
     /* Init port. */
-    stream->port.info.signature = ('S'<<3 | 'T'<<2 | 'R'<<1 | 'M');
-    stream->port.info.type = PJMEDIA_TYPE_AUDIO;
-    stream->port.info.has_info = 1;
-    stream->port.info.need_info = 0;
-    stream->port.info.pt = info->fmt.pt;
+
     pj_strdup(pool, &stream->port.info.encoding_name, &info->fmt.encoding_name);
     stream->port.info.clock_rate = info->fmt.clock_rate;
     stream->port.info.channel_count = info->fmt.channel_cnt;
-    stream->port.user_data = stream;
+    stream->port.port_data.pdata = stream;
     stream->port.put_frame = &put_frame;
     stream->port.get_frame = &get_frame;
Index: /pjproject/trunk/pjmedia/src/pjmedia/wav_player.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/wav_player.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/wav_player.c	(revision 633)
@@ -78,4 +78,5 @@
 static struct file_port *create_file_port(pj_pool_t *pool)
 {
+    const pj_str_t name = pj_str("file");
     struct file_port *port;
 
@@ -84,11 +85,9 @@
 	return NULL;
 
-    port->base.info.name = pj_str("file");
-    port->base.info.signature = SIGNATURE;
-    port->base.info.type = PJMEDIA_TYPE_AUDIO;
-    port->base.info.has_info = PJ_TRUE;
-    port->base.info.need_info = PJ_FALSE;
-    port->base.info.pt = 0xFF;
-    port->base.info.encoding_name = pj_str("pcm");
+    /* Put in default values.
+     * These will be overriden once the file is read.
+     */
+    pjmedia_port_info_init(&port->base.info, &name, SIGNATURE, 
+			   8000, 1, 16, 80);
 
     port->base.put_frame = &file_put_frame;
@@ -96,12 +95,4 @@
     port->base.on_destroy = &file_on_destroy;
 
-
-    /* Put in default values.
-     * These will be overriden once the file is read.
-     */
-    port->base.info.clock_rate = 8000;
-    port->base.info.bits_per_sample = 16;
-    port->base.info.samples_per_frame = 160;
-    port->base.info.bytes_per_frame = 320;
 
     return port;
@@ -151,5 +142,5 @@
 
 		fport->eof = PJ_TRUE;
-		status = (*fport->cb)(&fport->base, fport->base.user_data);
+		status=(*fport->cb)(&fport->base,fport->base.port_data.pdata);
 		if (status != PJ_SUCCESS) {
 		    /* This will crash if file port is destroyed in the 
@@ -425,5 +416,5 @@
     fport = (struct file_port*) port;
 
-    fport->base.user_data = user_data;
+    fport->base.port_data.pdata = user_data;
     fport->cb = cb;
 
Index: /pjproject/trunk/pjmedia/src/pjmedia/wav_writer.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/wav_writer.c	(revision 632)
+++ /pjproject/trunk/pjmedia/src/pjmedia/wav_writer.c	(revision 633)
@@ -70,4 +70,5 @@
     pjmedia_wave_hdr wave_hdr;
     pj_ssize_t size;
+    pj_str_t name;
     pj_status_t status;
 
@@ -87,18 +88,9 @@
 
     /* Initialize port info. */
-    fport->base.info.bits_per_sample = bits_per_sample;
-    fport->base.info.bytes_per_frame = samples_per_frame * bits_per_sample *
-				       channel_count / 8;
-    fport->base.info.channel_count = channel_count;
-    fport->base.info.encoding_name = pj_str("pom");
-    fport->base.info.has_info = 1;
-    pj_strdup2(pool, &fport->base.info.name, filename);
-    fport->base.info.need_info = 0;
-    fport->base.info.pt = 0xFF;
-    fport->base.info.clock_rate = sampling_rate;
-    fport->base.info.samples_per_frame = samples_per_frame;
-    fport->base.info.signature = SIGNATURE;
-    fport->base.info.type = PJMEDIA_TYPE_AUDIO;
-    
+    pj_strdup2(pool, &name, filename);
+    pjmedia_port_info_init(&fport->base.info, &name, SIGNATURE,
+			   sampling_rate, channel_count, bits_per_sample,
+			   samples_per_frame);
+
     fport->base.get_frame = &file_get_frame;
     fport->base.put_frame = &file_put_frame;
@@ -221,5 +213,5 @@
 
     fport->cb_size = pos;
-    fport->base.user_data = user_data;
+    fport->base.port_data.pdata = user_data;
     fport->cb = cb;
 
@@ -294,5 +286,5 @@
 	fport->cb = NULL;
 
-	status = (*cb)(this_port, this_port->user_data);
+	status = (*cb)(this_port, this_port->port_data.pdata);
 	return status;
     }
