Index: .hgsubstate
===================================================================
--- .hgsubstate	(revision 185)
+++ .hgsubstate	(revision 186)
@@ -1,3 +1,3 @@
 a1bd05cf1becfa567d269e68ab312ed4154d4ab2 libs/hlibpp
 3c961ba9aba9bb9031527dc9037e0132354698e8 libs/miniini
-391f0d359a4586f08cf1af3c18ab3c84928d6f4c mediastreamer2
+929207d6eeaee115a3fc5a861f9c97a2787250d1 mediastreamer2
Index: phapi/phms_audiostream.c
===================================================================
--- phapi/phms_audiostream.c	(revision 177)
+++ phapi/phms_audiostream.c	(revision 186)
@@ -61,7 +61,4 @@
 #include "phms_audiostream.h"
 
-void rtp_session_rtcp_parse(RtpSession *session, mblk_t *mp);
-
-
 #ifndef USE_PHMS_AUDIOSTREAM
 int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char *remip,int remport,
@@ -85,5 +82,5 @@
 const char* JITTER_BUFFER_ENV = "PH_JITTER_BUFFER_MS";
 
-void audio_stream_change_decoder(AudioStream *stream, int payload);
+void rtp_session_rtcp_parse(RtpSession *session, mblk_t *mp);
 
 
@@ -107,5 +104,4 @@
 
 /* this code is not part of the library itself, it is part of the mediastream program */
-void audio_stream_free(AudioStream *stream);
 void phms_audio_stream_free(AudioStream *stream)
 {
@@ -135,5 +131,5 @@
 	if (stream->volrecv!=NULL) ms_filter_destroy(stream->volrecv);
 	if (stream->soundread!=NULL) ms_filter_destroy(stream->soundread);
-	if (stream->dtmfgen2!=NULL) ms_filter_destroy(stream->dtmfgen2);
+	//if (stream->dtmfgen2!=NULL) ms_filter_destroy(stream->dtmfgen2);
 	if (stream->soundwrite!=NULL) ms_filter_destroy(stream->soundwrite);
 	if (stream->encoder!=NULL) ms_filter_destroy(stream->encoder);
@@ -334,6 +330,6 @@
 		FILTER_LINK(stream->volrecv,0,stream->soundwrite,0);
 #endif		
-		FILTER_LINK(stream->ec,1,stream->dtmfgen2,0);
-		FILTER_LINK(stream->dtmfgen2, 0,stream->encoder,0);
+		//FILTER_LINK(stream->ec,1,stream->dtmfgen2,0);
+		//FILTER_LINK(stream->dtmfgen2, 0,stream->encoder,0);
 		FILTER_LINK(stream->dtmfgen,0,stream->ec,0);
 
@@ -348,9 +344,9 @@
 #else
 		FILTER_LINK(stream->soundread,0,stream->volsend,0);
-		FILTER_LINK(stream->volsend,0,stream->dtmfgen2,0);
+//		FILTER_LINK(stream->volsend,0,stream->dtmfgen2,0);
 		FILTER_LINK(stream->dtmfgen,0,stream->volrecv,0);
 		FILTER_LINK(stream->volrecv,0,stream->soundwrite,0);
 #endif		
-		FILTER_LINK(stream->dtmfgen2,0,stream->encoder,0);
+//		FILTER_LINK(stream->dtmfgen2,0,stream->encoder,0);
 	}
 	FILTER_LINK(stream->encoder,0,stream->rtpsend,0);
@@ -377,6 +373,6 @@
 		FILTER_UNLINK(stream->volrecv,0,stream->soundwrite,0);
 #endif			
-		FILTER_UNLINK(stream->ec,1,stream->dtmfgen2,0);
-		FILTER_UNLINK(stream->dtmfgen2, 0,stream->encoder,0);
+//		FILTER_UNLINK(stream->ec,1,stream->dtmfgen2,0);
+//		FILTER_UNLINK(stream->dtmfgen2, 0,stream->encoder,0);
 		FILTER_UNLINK(stream->dtmfgen,0,stream->ec,0);
 	}else{
@@ -390,9 +386,9 @@
 #else
 		FILTER_UNLINK(stream->soundread,0,stream->volsend,0);
-		FILTER_UNLINK(stream->volsend,0,stream->dtmfgen2,0);
+//		FILTER_UNLINK(stream->volsend,0,stream->dtmfgen2,0);
 		FILTER_UNLINK(stream->dtmfgen,0,stream->volrecv,0);
 		FILTER_UNLINK(stream->volrecv,0,stream->soundwrite,0);
 #endif			
-		FILTER_UNLINK(stream->dtmfgen2,0,stream->encoder,0);
+//		FILTER_UNLINK(stream->dtmfgen2,0,stream->encoder,0);
 	}
 
@@ -477,5 +473,5 @@
 		if (outfile!=NULL) audio_stream_record(stream,outfile);
 	}
-	stream->dtmfgen2=ms_filter_new(MS_DTMF_GEN_ID);
+//	stream->dtmfgen2=ms_filter_new(MS_DTMF_GEN_ID);
 	//	ms_filter_call_method(stream->dtmfgen2, MS_FILTER_SET_DTMF_DURATION, &dtmf_dur);
 
@@ -540,5 +536,5 @@
 	ms_filter_call_method(stream->decoder,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate);
 	ms_filter_call_method(stream->dtmfgen,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate);
-	ms_filter_call_method(stream->dtmfgen2,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate);
+//	ms_filter_call_method(stream->dtmfgen2,MS_FILTER_SET_SAMPLE_RATE,&pt->clock_rate);
 
 	if (pt->send_fmtp!=NULL) ms_filter_call_method(stream->encoder,MS_FILTER_ADD_FMTP, (void*)pt->send_fmtp);
@@ -709,6 +705,6 @@
 		FILTER_UNLINK(stream->volrecv,0,stream->soundwrite,0);
 #endif
-		FILTER_UNLINK(stream->ec,1,stream->dtmfgen2,0);
-		FILTER_UNLINK(stream->dtmfgen2, 0,stream->encoder,0);
+//		FILTER_UNLINK(stream->ec,1,stream->dtmfgen2,0);
+//		FILTER_UNLINK(stream->dtmfgen2, 0,stream->encoder,0);
 		FILTER_UNLINK(stream->dtmfgen,0,stream->ec,0);
 	}else{
@@ -722,9 +718,9 @@
 #else
 		FILTER_UNLINK(stream->soundread,0,stream->volsend,0);
-		FILTER_UNLINK(stream->volsend,0,stream->dtmfgen2,0);
+//		FILTER_UNLINK(stream->volsend,0,stream->dtmfgen2,0);
 		FILTER_UNLINK(stream->dtmfgen,0,stream->volrecv,0);
 		FILTER_UNLINK(stream->volrecv,0,stream->soundwrite,0);
 #endif
-		FILTER_UNLINK(stream->dtmfgen2,0,stream->encoder,0);
+//		FILTER_UNLINK(stream->dtmfgen2,0,stream->encoder,0);
 	}
 
@@ -743,5 +739,5 @@
 	if (stream->decoder!=NULL) ms_filter_destroy(stream->decoder);
 	if (stream->dtmfgen!=NULL) ms_filter_destroy(stream->dtmfgen);
-	if (stream->dtmfgen2!=NULL) ms_filter_destroy(stream->dtmfgen2);
+//	if (stream->dtmfgen2!=NULL) ms_filter_destroy(stream->dtmfgen2);
 	if (stream->ec!=NULL)	ms_filter_destroy(stream->ec);
 	if (stream->ticker!=NULL) ms_ticker_destroy(stream->ticker);
@@ -760,9 +756,5 @@
 	if (!stream)
 		return -1;
-	if (!mode || mode > DTMF_BOTH)
-	{
-		mode = DTMF_BOTH;
-	}
-	//	stream->sent_dtmfs=mode;
+
 	return(audio_stream_send_dtmf(stream, dtmf));
 }
@@ -886,6 +878,6 @@
 #endif		
 		FILTER_LINK(pas->dtmfgen,0, pas->ec,0);
-		FILTER_LINK(pas->ec,1, pas->dtmfgen2,0);
-		FILTER_LINK(pas->dtmfgen2, 0, pas->encoder, 0);
+//		FILTER_LINK(pas->ec,1, pas->dtmfgen2,0);
+//		FILTER_LINK(pas->dtmfgen2, 0, pas->encoder, 0);
 	}
 	else
@@ -897,8 +889,8 @@
 		FILTER_LINK(pas->upsample,0, pas->soundwrite,0);
 #else
-		FILTER_LINK(pas->soundread, 0, pas->dtmfgen2, 0);
+//		FILTER_LINK(pas->soundread, 0, pas->dtmfgen2, 0);
 		FILTER_LINK(pas->dtmfgen,0, pas->soundwrite,0);
 #endif		
-		FILTER_LINK(pas->dtmfgen2, 0, pas->encoder,0);
+//		FILTER_LINK(pas->dtmfgen2, 0, pas->encoder,0);
 	}
 	if(flags & PH_MSTREAM_FLAG_SUSPENDED)
@@ -925,6 +917,6 @@
 #endif		
 		FILTER_UNLINK(pas->dtmfgen,0, pas->ec,0);
-		FILTER_UNLINK(pas->ec,1, pas->dtmfgen2,0);
-		FILTER_UNLINK(pas->dtmfgen2, 0, pas->encoder, 0);
+//		FILTER_UNLINK(pas->ec,1, pas->dtmfgen2,0);
+//		FILTER_UNLINK(pas->dtmfgen2, 0, pas->encoder, 0);
 	}
 	else
@@ -936,8 +928,8 @@
 		FILTER_UNLINK(pas->upsample,0, pas->soundwrite,0);
 #else
-		FILTER_UNLINK(pas->soundread, 0, pas->dtmfgen2, 0);
+//		FILTER_UNLINK(pas->soundread, 0, pas->dtmfgen2, 0);
 		FILTER_UNLINK(pas->dtmfgen,0, pas->soundwrite,0);
 #endif		
-		FILTER_UNLINK(pas->dtmfgen2, 0, pas->encoder,0);
+//		FILTER_UNLINK(pas->dtmfgen2, 0, pas->encoder,0);
 	}
 }
@@ -1015,6 +1007,6 @@
 #endif		
 		FILTER_LINK(pcs->conf, 0, pcs->ec, 0);
-		FILTER_LINK(pcs->ec, 1, pas1->dtmfgen2, 0);
-		FILTER_LINK(pas1->dtmfgen2, 0, pcs->conf, 0);
+//		FILTER_LINK(pcs->ec, 1, pas1->dtmfgen2, 0);
+//		FILTER_LINK(pas1->dtmfgen2, 0, pcs->conf, 0);
 	}
 	else
@@ -1026,8 +1018,8 @@
 		FILTER_LINK(pas1->upsample, 0, pas1->soundwrite, 0);
 #else
-		FILTER_LINK(pas1->soundread, 0,   pas1->dtmfgen2, 0);
+//		FILTER_LINK(pas1->soundread, 0,   pas1->dtmfgen2, 0);
 		FILTER_LINK(pcs->conf, 0, pas1->soundwrite, 0);
 #endif		
-		FILTER_LINK(pas1->dtmfgen2, 0, pcs->conf, 0);
+//		FILTER_LINK(pas1->dtmfgen2, 0, pcs->conf, 0);
 	}
 
@@ -1109,6 +1101,6 @@
 #endif			
 			FILTER_UNLINK(pcs->conf, 0,  pcs->ec, 0);
-			FILTER_UNLINK(pcs->ec, 1, pas1->dtmfgen2, 0);
-			FILTER_UNLINK(pas1->dtmfgen2, 0,pcs->conf, 0);
+//			FILTER_UNLINK(pcs->ec, 1, pas1->dtmfgen2, 0);
+//			FILTER_UNLINK(pas1->dtmfgen2, 0,pcs->conf, 0);
 		}
 		else
@@ -1120,8 +1112,8 @@
 			FILTER_UNLINK(pas1->upsample, 0,  pas1->soundwrite, 0);
 #else
-			FILTER_UNLINK(pas1->soundread, 0, pas1->dtmfgen2, 1);
+//			FILTER_UNLINK(pas1->soundread, 0, pas1->dtmfgen2, 1);
 			FILTER_UNLINK(pcs->conf, 0, pas1->soundwrite, 0);
 #endif			
-			FILTER_UNLINK(pas1->dtmfgen2, 0,pcs->conf, 0);
+//			FILTER_UNLINK(pas1->dtmfgen2, 0,pcs->conf, 0);
 		}
 
Index: phapi/phms_videostream.c
===================================================================
--- phapi/phms_videostream.c	(revision 179)
+++ phapi/phms_videostream.c	(revision 186)
@@ -51,6 +51,4 @@
 #define USE_NEW_CAPTURE 1
 
-void video_stream_change_decoder(VideoStream *stream, int payload);
-
 static void get_default_display_vsize(MSVideoSize *vsize)
 {
@@ -326,5 +324,5 @@
 	tmp=1;
 	ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&disp_size);
-	ms_filter_call_method(stream->output,MS_VIDEO_OUT_AUTO_FIT,&tmp);
+	//ms_filter_call_method(stream->output,MS_VIDEO_OUT_AUTO_FIT,&tmp);
 	ms_filter_call_method(stream->output,MS_FILTER_SET_PIX_FMT,&format);
 	
@@ -610,5 +608,5 @@
 	tmp=1;
 	ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&disp_size);
-	ms_filter_call_method(stream->output,MS_VIDEO_OUT_AUTO_FIT,&tmp);
+	//ms_filter_call_method(stream->output,MS_VIDEO_OUT_AUTO_FIT,&tmp);
 	ms_filter_call_method(stream->output,MS_FILTER_SET_PIX_FMT,&format);
 
@@ -1056,15 +1054,17 @@
 phStream * phms_video_start_preview(const char *deviceid, VideoStreamRenderCallback cb)
 {
-	MSVideoSize size;
 	phStream * phstream = (phStream *)osip_malloc(sizeof(phStream));
 	MSWebCam *cam  = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),deviceid);
+	VideoStream * videoStream;
+
 	if(cam == NULL)
 		return NULL;
-	
-	get_default_display_vsize(&size);
-	
-	phstream->stream = video_preview_start(cam,size);
-	video_stream_set_render_callback(phstream->stream,cb,NULL);
-	
+
+	videoStream = video_preview_new();
+	phstream->stream = videoStream;
+	video_stream_use_preview_video_window(videoStream,0);
+	video_stream_set_render_callback(videoStream,cb,NULL);
+	video_preview_start(videoStream,cam);
+
 	return phstream;
 }
