Commit d33ec2d9 authored by Aymeric Moizard's avatar Aymeric Moizard
Browse files

Merge branch 'master' of git.linphone.org:mediastreamer2

parents 28a0023b f7003dab
...@@ -42,7 +42,7 @@ typedef struct _MSDisplayDesc{ ...@@ -42,7 +42,7 @@ typedef struct _MSDisplayDesc{
bool_t (*init)(struct _MSDisplay *, struct _MSFilter *f, MSPicture *frame_buffer, MSPicture *selfview_buffer); bool_t (*init)(struct _MSDisplay *, struct _MSFilter *f, MSPicture *frame_buffer, MSPicture *selfview_buffer);
void (*lock)(struct _MSDisplay *);/*lock before writing to the framebuffer*/ void (*lock)(struct _MSDisplay *);/*lock before writing to the framebuffer*/
void (*unlock)(struct _MSDisplay *);/*unlock after writing to the framebuffer*/ void (*unlock)(struct _MSDisplay *);/*unlock after writing to the framebuffer*/
void (*update)(struct _MSDisplay *); /*display the picture to the screen*/ void (*update)(struct _MSDisplay *, int new_image, int new_selfview); /*display the picture to the screen*/
void (*uninit)(struct _MSDisplay *); void (*uninit)(struct _MSDisplay *);
bool_t (*pollevent)(struct _MSDisplay *, MSDisplayEvent *ev); bool_t (*pollevent)(struct _MSDisplay *, MSDisplayEvent *ev);
long default_window_id; long default_window_id;
...@@ -59,7 +59,8 @@ typedef struct _MSDisplay{ ...@@ -59,7 +59,8 @@ typedef struct _MSDisplay{
#define ms_display_init(d,f,fbuf,fbuf_selfview) (d)->desc->init(d,f,fbuf,fbuf_selfview) #define ms_display_init(d,f,fbuf,fbuf_selfview) (d)->desc->init(d,f,fbuf,fbuf_selfview)
#define ms_display_lock(d) if ((d)->desc->lock) (d)->desc->lock(d) #define ms_display_lock(d) if ((d)->desc->lock) (d)->desc->lock(d)
#define ms_display_unlock(d) if ((d)->desc->unlock) (d)->desc->unlock(d) #define ms_display_unlock(d) if ((d)->desc->unlock) (d)->desc->unlock(d)
#define ms_display_update(d) if ((d)->desc->update) (d)->desc->update(d) #define ms_display_update(d, A, B) if ((d)->desc->update) (d)->desc->update(d, A, B)
bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev); bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev);
extern MSDisplayDesc ms_sdl_display_desc; extern MSDisplayDesc ms_sdl_display_desc;
......
...@@ -206,7 +206,7 @@ static void sdl_display_unlock(MSDisplay *obj){ ...@@ -206,7 +206,7 @@ static void sdl_display_unlock(MSDisplay *obj){
ms_mutex_unlock(&wd->sdl_mutex); ms_mutex_unlock(&wd->sdl_mutex);
} }
static void sdl_display_update(MSDisplay *obj){ static void sdl_display_update(MSDisplay *obj, int new_image, int new_selfview){
SdlDisplay *wd = (SdlDisplay*)obj->data; SdlDisplay *wd = (SdlDisplay*)obj->data;
SDL_Rect rect; SDL_Rect rect;
rect.x=0; rect.x=0;
...@@ -536,7 +536,7 @@ static void reduce(int *num, int *denom) ...@@ -536,7 +536,7 @@ static void reduce(int *num, int *denom)
*denom /= divisor; *denom /= divisor;
} }
static void win_display_update(MSDisplay *obj){ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
WinDisplay *wd=(WinDisplay*)obj->data; WinDisplay *wd=(WinDisplay*)obj->data;
HDC hdc; HDC hdc;
BITMAPINFOHEADER bi; BITMAPINFOHEADER bi;
...@@ -560,7 +560,8 @@ static void win_display_update(MSDisplay *obj){ ...@@ -560,7 +560,8 @@ static void win_display_update(MSDisplay *obj){
ms_error("Could not get window dc"); ms_error("Could not get window dc");
return; return;
} }
yuv420p_to_rgb(wd, &wd->fb, wd->rgb); if (new_image>0)
yuv420p_to_rgb(wd, &wd->fb, wd->rgb);
memset(&bi,0,sizeof(bi)); memset(&bi,0,sizeof(bi));
bi.biSize=sizeof(bi); bi.biSize=sizeof(bi);
GetClientRect(wd->window,&rect); GetClientRect(wd->window,&rect);
...@@ -661,7 +662,8 @@ static void win_display_update(MSDisplay *obj){ ...@@ -661,7 +662,8 @@ static void win_display_update(MSDisplay *obj){
{ {
int x_sv; int x_sv;
int y_sv; int y_sv;
yuv420p_to_rgb_selfview(wd, &wd->fb_selfview, wd->rgb_selfview); if (new_selfview>0)
yuv420p_to_rgb_selfview(wd, &wd->fb_selfview, wd->rgb_selfview);
//HPEN hpenDot; //HPEN hpenDot;
//hpenDot = CreatePen(PS_SOLID, 1, RGB(10, 10, 10)); //hpenDot = CreatePen(PS_SOLID, 1, RGB(10, 10, 10));
...@@ -714,7 +716,8 @@ static void win_display_update(MSDisplay *obj){ ...@@ -714,7 +716,8 @@ static void win_display_update(MSDisplay *obj){
ratioh=wd->fb_selfview.h; ratioh=wd->fb_selfview.h;
reduce(&ratiow, &ratioh); reduce(&ratiow, &ratioh);
yuv420p_to_rgb_selfview(wd, &wd->fb_selfview, wd->rgb_selfview); if (new_selfview>0)
yuv420p_to_rgb_selfview(wd, &wd->fb_selfview, wd->rgb_selfview);
if (w_selfview >= w/sv_scalefactor) if (w_selfview >= w/sv_scalefactor)
{ {
w_selfview = w_selfview/ratiow*ratiow; w_selfview = w_selfview/ratiow*ratiow;
...@@ -1029,6 +1032,8 @@ static void video_out_preprocess(MSFilter *f){ ...@@ -1029,6 +1032,8 @@ static void video_out_preprocess(MSFilter *f){
static void video_out_process(MSFilter *f){ static void video_out_process(MSFilter *f){
VideoOut *obj=(VideoOut*)f->data; VideoOut *obj=(VideoOut*)f->data;
mblk_t *inm; mblk_t *inm;
int update=0;
int update_selfview=0;
ms_filter_lock(f); ms_filter_lock(f);
if (!obj->ready) video_out_prepare(f); if (!obj->ready) video_out_prepare(f);
...@@ -1063,6 +1068,7 @@ static void video_out_process(MSFilter *f){ ...@@ -1063,6 +1068,7 @@ static void video_out_process(MSFilter *f){
} }
if (!mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->fbuf_selfview); if (!mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->fbuf_selfview);
ms_display_unlock(obj->display); ms_display_unlock(obj->display);
update_selfview=1;
} }
}else{ }else{
MSPicture src; MSPicture src;
...@@ -1084,6 +1090,7 @@ static void video_out_process(MSFilter *f){ ...@@ -1084,6 +1090,7 @@ static void video_out_process(MSFilter *f){
ms_error("Error in sws_scale()."); ms_error("Error in sws_scale().");
} }
if (!mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->local_pic); if (!mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->local_pic);
update=1;
} }
} }
} }
...@@ -1128,6 +1135,7 @@ static void video_out_process(MSFilter *f){ ...@@ -1128,6 +1135,7 @@ static void video_out_process(MSFilter *f){
if (obj->mirror && !mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->fbuf); if (obj->mirror && !mblk_get_precious_flag(inm)) yuv_buf_mirror(&obj->fbuf);
ms_display_unlock(obj->display); ms_display_unlock(obj->display);
} }
update=1;
ms_queue_flush(f->inputs[0]); ms_queue_flush(f->inputs[0]);
} }
...@@ -1149,7 +1157,7 @@ static void video_out_process(MSFilter *f){ ...@@ -1149,7 +1157,7 @@ static void video_out_process(MSFilter *f){
ms_display_unlock(obj->display); ms_display_unlock(obj->display);
} }
ms_display_update(obj->display); ms_display_update(obj->display, update, update_selfview);
ms_filter_unlock(f); ms_filter_unlock(f);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment