Browse Source

Z991239-6077 #comment: 优化视频回显库

80274480 6 tháng trước cách đây
mục cha
commit
211767ecb4

+ 39 - 9
Module/mod_sipphone/video_render.cpp

@@ -75,13 +75,13 @@ static bool get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue
 	videoq_frame frm;
 	frm.data = tmp_frame_preview->data[0];
 
-	static bool blog = true;
-	if (blog) {
-		int ivideo_width = 0;
-		int ivideo_height = 0;
-		int isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
-		blog = false;
-	}
+	//static bool blog = true;
+	//if (blog) {
+	//	int ivideo_width = 0;
+	//	int ivideo_height = 0;
+	//	int isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
+	//	blog = false;
+	//}
 
 	result = local_video_queue->GetVideo(&frm, VIDEOQUEUE_FLAG_HORIZONTAL_FLIP);
 	if (result){
@@ -201,6 +201,36 @@ static int rvc_getrxkimage(IplImage** personimage, IplImage** personmask)
 }
 
 
+static int rvc_setrender_property(IVideoRender* pRender, rvc_video_render_params_t* param, bool blocal)
+{
+	int iret = -1;
+	if (NULL == pRender || NULL == param) {
+		return iret;
+	}
+
+	videorender_param_t tparam = { 0 };
+	if (blocal) {
+		tparam.icx = param->ilocal_view_x;
+		tparam.icy = param->ilocal_view_y;
+		tparam.uwidth = param->ilocal_view_cx;
+		tparam.uheight = param->ilocal_view_cy;
+	}
+	else {
+		tparam.icx = param->iremote_view_x;
+		tparam.icy = param->iremote_view_y;
+		tparam.uwidth = param->iremote_view_cx;
+		tparam.uheight = param->iremote_view_cy;
+	}
+
+	tparam.ivideoformat = VIDEO_FORMAT_RGB24;
+	if (0 == pRender->VideoRenderSetParam(&tparam)) {
+		pRender->HideVideoWindow();
+		iret = 0;
+	}
+
+	return iret;
+}
+
 #ifdef RVC_OS_WIN
 static unsigned int __stdcall rvc_videorender_func(void* arg)
 #else
@@ -454,10 +484,10 @@ static unsigned int __stdcall rvc_optcam_videorender_func(void* arg)
 #else
 static void* rvc_optcam_videorender_func(void* arg)
 #endif
-{
+{	
 	rvc_video_render_t* param = (rvc_video_render_t*)arg;
 	int iremote_video_fresh_time = param->render_param.iremote_fresh_time;
-	
+
 	Clibvideoqueue* local_optvideo_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE);
 	int iwidth = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
 	int iheight = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;

+ 14 - 0
Other/libvideorender/libvideorender.cpp

@@ -422,6 +422,20 @@ int VideoRenderImpl::RenderVideoFrame(video_frame* pframe, RVC_RendererFlip eFli
 
 		SDL_Delay(RVC_DEFAULT_DELAY_TIME);
 	}
+	else if(SDL_MOUSEBUTTONDOWN == event.type)
+	{
+		RenderLog(RENDER_LOG_DEBUG, "Mouse button pressed down.");
+		RenderLog(RENDER_LOG_DEBUG, "  - Mouse position: (%d, %d)", event.button.x, event.button.y);
+		RenderLog(RENDER_LOG_DEBUG, "  - Mouse button: %d.", event.button.button);
+	}
+	else if (SDL_MOUSEBUTTONUP == event.type) {
+		RenderLog(RENDER_LOG_DEBUG, "Mouse button released.");
+		RenderLog(RENDER_LOG_DEBUG, "  - Mouse position: (%d, %d)", event.button.x, event.button.y);
+		RenderLog(RENDER_LOG_DEBUG, "  - Mouse button: %d", event.button.button);
+	}
+	else {
+		//RenderLog(RENDER_LOG_DEBUG, "SDL_WaitEvent type is %d.", event.type);
+	}
 
 	iret = 0;