Index: /pjproject/trunk/pjsip/include/pjsua2/call.hpp
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua2/call.hpp	(revision 5644)
+++ /pjproject/trunk/pjsip/include/pjsua2/call.hpp	(revision 5645)
@@ -602,7 +602,12 @@
     
     /**
-     * Optional codec param.
-     */
-    CodecParam          codecParam;
+     * Optional audio codec param.
+     */
+    CodecParam          audCodecParam;
+
+    /**
+     * Optional video codec param.
+     */
+    VidCodecParam       vidCodecParam;
 
 public:
Index: /pjproject/trunk/pjsip/include/pjsua2/media.hpp
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua2/media.hpp	(revision 5644)
+++ /pjproject/trunk/pjsip/include/pjsua2/media.hpp	(revision 5645)
@@ -1955,9 +1955,4 @@
 
 /**
- * Codec parameters, corresponds to pjmedia_codec_param.
- */
-typedef void *CodecParam;
-
-/**
  * Structure of codec specific parameters which contains name=value pairs.
  * The codec specific parameters are to be used with SDP according to
@@ -1974,6 +1969,58 @@
 
 /**
- * Detailed codec attributes used in configuring a codec and in querying
- * the capability of codec factories. 
+ * Audio codec parameters info.
+ */
+struct CodecParamInfo
+{
+    unsigned	clockRate;		/**< Sampling rate in Hz	    */
+    unsigned	channelCnt;		/**< Channel count.		    */
+    unsigned 	avgBps;			/**< Average bandwidth in bits/sec  */
+    unsigned	maxBps;			/**< Maximum bandwidth in bits/sec  */
+    unsigned    maxRxFrameSize;		/**< Maximum frame size             */
+    unsigned 	frameLen;		/**< Decoder frame ptime in msec.   */
+    unsigned  	pcmBitsPerSample;	/**< Bits/sample in the PCM side    */
+    unsigned  	pt;			/**< Payload type.		    */
+    pjmedia_format_id fmtId;		/**< Source format, it's format of
+					     encoder input and decoder
+					     output.			    */
+};
+
+/**
+ * Audio codec parameters setting.
+ */
+struct CodecParamSetting
+{
+    unsigned  	frmPerPkt;	    /**< Number of frames per packet.	*/
+    bool	vad;		    /**< Voice Activity Detector.	*/
+    bool	cng;		    /**< Comfort Noise Generator.	*/
+    bool	penh;		    /**< Perceptual Enhancement		*/
+    bool	plc;		    /**< Packet loss concealment	*/
+    bool	reserved;	    /**< Reserved, must be zero.	*/
+    CodecFmtpVector encFmtp;	    /**< Encoder's fmtp params.		*/
+    CodecFmtpVector decFmtp;	    /**< Decoder's fmtp params.		*/
+};
+
+/**
+ * Detailed codec attributes used in configuring an audio codec and in querying
+ * the capability of audio codec factories.
+ *
+ * Please note that codec parameter also contains SDP specific setting,
+ * #setting::decFmtp and #setting::encFmtp, which may need to be set 
+ * appropriately based on the effective setting. 
+ * See each codec documentation for more detail.
+ */
+struct CodecParam
+{
+    struct CodecParamInfo info;
+    struct CodecParamSetting setting;
+
+    void fromPj(const pjmedia_codec_param &param);
+
+    pjmedia_codec_param toPj() const;
+};
+
+/**
+ * Detailed codec attributes used in configuring a video codec and in querying
+ * the capability of video codec factories. 
  *
  * Please note that codec parameter also contains SDP specific setting,
@@ -2003,12 +2050,4 @@
 
     pjmedia_vid_codec_param toPj() const;
-
-private:
-    void setCodecFmtp(const pjmedia_codec_fmtp &in_fmtp, 
-		      CodecFmtpVector &out_fmtp);
-
-    void getCodecFmtp(const CodecFmtpVector &in_fmtp,
-		      pjmedia_codec_fmtp &out_fmtp) const;
-
 };
 
Index: /pjproject/trunk/pjsip/src/pjsua2/call.cpp
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua2/call.cpp	(revision 5644)
+++ /pjproject/trunk/pjsip/src/pjsua2/call.cpp	(revision 5645)
@@ -297,5 +297,5 @@
         codecName = pj2Str(info.info.aud.fmt.encoding_name);
         codecClockRate = info.info.aud.fmt.clock_rate;
-        codecParam = info.info.aud.param;
+        audCodecParam.fromPj(*info.info.aud.param);
     } else if (type == PJMEDIA_TYPE_VIDEO) {
         proto = info.info.vid.proto;
@@ -308,6 +308,6 @@
         rxPt = info.info.vid.rx_pt;
         codecName = pj2Str(info.info.vid.codec_info.encoding_name);
-        codecClockRate = info.info.vid.codec_info.clock_rate;
-        codecParam = info.info.vid.codec_param;
+        codecClockRate = info.info.vid.codec_info.clock_rate;        
+	vidCodecParam.fromPj(*info.info.vid.codec_param);
     }
 }
Index: /pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp	(revision 5644)
+++ /pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp	(revision 5645)
@@ -1883,10 +1883,12 @@
 CodecParam Endpoint::codecGetParam(const string &codec_id) const throw(Error)
 {
-    pjmedia_codec_param *pj_param = NULL;
+    CodecParam param;
+    pjmedia_codec_param pj_param;
     pj_str_t codec_str = str2Pj(codec_id);
 
-    PJSUA2_CHECK_EXPR( pjsua_codec_get_param(&codec_str, pj_param) );
-
-    return pj_param;
+    PJSUA2_CHECK_EXPR( pjsua_codec_get_param(&codec_str, &pj_param) );
+
+    param.fromPj(pj_param);
+    return param;
 }
 
@@ -1895,7 +1897,7 @@
 {
     pj_str_t codec_str = str2Pj(codec_id);
-    pjmedia_codec_param *pj_param = (pjmedia_codec_param*)param;
-
-    PJSUA2_CHECK_EXPR( pjsua_codec_set_param(&codec_str, pj_param) );
+    pjmedia_codec_param pj_param = param.toPj();
+
+    PJSUA2_CHECK_EXPR( pjsua_codec_set_param(&codec_str, &pj_param) );
 }
 
Index: /pjproject/trunk/pjsip/src/pjsua2/media.cpp
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua2/media.cpp	(revision 5644)
+++ /pjproject/trunk/pjsip/src/pjsua2/media.cpp	(revision 5645)
@@ -1516,4 +1516,41 @@
 
 ///////////////////////////////////////////////////////////////////////////////
+
+/** 
+ * Utility class for converting CodecFmtpVector to and from pjmedia_codec_fmtp. 
+ */
+class CodecFmtpUtil
+{
+public:
+    static void fromPj(const pjmedia_codec_fmtp &in_fmtp,
+		       CodecFmtpVector &out_fmtp)
+    {
+        unsigned i = 0;
+        for (; i<in_fmtp.cnt; ++i) {
+	    CodecFmtp fmtp;
+	    fmtp.name = pj2Str(in_fmtp.param[i].name);
+	    fmtp.val = pj2Str(in_fmtp.param[i].val);
+	
+            out_fmtp.push_back(fmtp);
+       }
+    }
+
+    static void toPj(const CodecFmtpVector &in_fmtp,
+		     pjmedia_codec_fmtp &out_fmtp)
+    {
+        CodecFmtpVector::const_iterator i;
+        out_fmtp.cnt = 0;
+        for (i = in_fmtp.begin(); i != in_fmtp.end(); ++i) {
+	    if (out_fmtp.cnt >= PJMEDIA_CODEC_MAX_FMTP_CNT) {
+	        break;
+    	    }
+	    out_fmtp.param[out_fmtp.cnt].name = str2Pj((*i).name);
+	    out_fmtp.param[out_fmtp.cnt].val = str2Pj((*i).val);
+	    ++out_fmtp.cnt;
+        }
+    }
+};
+
+///////////////////////////////////////////////////////////////////////////////
 void CodecInfo::fromPj(const pjsua_codec_info &codec_info)
 {
@@ -1523,4 +1560,57 @@
 }
 
+///////////////////////////////////////////////////////////////////////////////
+void CodecParam::fromPj(const pjmedia_codec_param &param)
+{
+    /* info part. */
+    info.clockRate = param.info.clock_rate;
+    info.channelCnt = param.info.channel_cnt;
+    info.avgBps = param.info.avg_bps;
+    info.maxBps = param.info.max_bps;
+    info.maxRxFrameSize = param.info.max_rx_frame_size;
+    info.frameLen = param.info.frm_ptime;
+    info.pcmBitsPerSample = param.info.pcm_bits_per_sample;
+    info.pt = param.info.pt;
+    info.fmtId = param.info.fmt_id;
+
+    /* setting part. */
+    setting.frmPerPkt = param.setting.frm_per_pkt;
+    setting.vad = param.setting.vad;
+    setting.cng = param.setting.cng;
+    setting.penh = param.setting.penh;
+    setting.plc = param.setting.plc;
+    setting.reserved = param.setting.reserved;
+    CodecFmtpUtil::fromPj(param.setting.enc_fmtp, setting.encFmtp);
+    CodecFmtpUtil::fromPj(param.setting.dec_fmtp, setting.decFmtp);
+}
+
+pjmedia_codec_param CodecParam::toPj() const
+{
+    pjmedia_codec_param param;
+
+    /* info part. */
+    param.info.clock_rate = info.clockRate;
+    param.info.channel_cnt = info.channelCnt;
+    param.info.avg_bps = info.avgBps;
+    param.info.max_bps= info.maxBps;
+    param.info.max_rx_frame_size = info.maxRxFrameSize;
+    param.info.frm_ptime = info.frameLen;
+    param.info.pcm_bits_per_sample = info.pcmBitsPerSample;
+    param.info.pt = info.pt;
+    param.info.fmt_id = info.fmtId;
+
+    /* setting part. */
+    param.setting.frm_per_pkt = setting.frmPerPkt;
+    param.setting.vad = setting.vad;
+    param.setting.cng = setting.cng;
+    param.setting.penh = setting.penh;
+    param.setting.plc = setting.plc;
+    param.setting.reserved = setting.reserved;
+    CodecFmtpUtil::toPj(setting.encFmtp, param.setting.enc_fmtp);
+    CodecFmtpUtil::toPj(setting.decFmtp, param.setting.dec_fmtp);
+    return param;
+}
+
+///////////////////////////////////////////////////////////////////////////////
 void VidCodecParam::fromPj(const pjmedia_vid_codec_param &param)
 {
@@ -1531,6 +1621,6 @@
     encFmt.fromPj(param.enc_fmt);
     decFmt.fromPj(param.dec_fmt);
-    setCodecFmtp(param.enc_fmtp, encFmtp);
-    setCodecFmtp(param.dec_fmtp, decFmtp);
+    CodecFmtpUtil::fromPj(param.enc_fmtp, encFmtp);
+    CodecFmtpUtil::fromPj(param.dec_fmtp, decFmtp);
 }
 
@@ -1545,34 +1635,7 @@
     param.enc_fmt = encFmt.toPj();
     param.dec_fmt = decFmt.toPj();
-    getCodecFmtp(encFmtp, param.enc_fmtp);    
-    getCodecFmtp(decFmtp, param.dec_fmtp);
+    CodecFmtpUtil::toPj(encFmtp, param.enc_fmtp);
+    CodecFmtpUtil::toPj(decFmtp, param.dec_fmtp);
     return param;
 }
 
-void VidCodecParam::setCodecFmtp(const pjmedia_codec_fmtp &in_fmtp, 
-				 CodecFmtpVector &out_fmtp)
-{
-    unsigned i = 0;
-    for ( ; i<in_fmtp.cnt; ++i) {
-	CodecFmtp fmtp;
-	fmtp.name = pj2Str(in_fmtp.param[i].name);
-	fmtp.val = pj2Str(in_fmtp.param[i].val);
-
-	out_fmtp.push_back(fmtp);
-    }
-}
-
-void VidCodecParam::getCodecFmtp(const CodecFmtpVector &in_fmtp,
-				 pjmedia_codec_fmtp &out_fmtp) const
-{
-    CodecFmtpVector::const_iterator i;
-    out_fmtp.cnt = 0;    
-    for (i=in_fmtp.begin(); i!=in_fmtp.end();++i) {
-	if (out_fmtp.cnt >= PJMEDIA_CODEC_MAX_FMTP_CNT) {
-	    break;
-	}
-	out_fmtp.param[out_fmtp.cnt].name = str2Pj((*i).name);
-	out_fmtp.param[out_fmtp.cnt].val = str2Pj((*i).val);
-	++out_fmtp.cnt;
-    }
-}
