Commit f666567f authored by Aymeric Moizard's avatar Aymeric Moizard

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

parents d33ec2d9 8c4c68a1
......@@ -102,6 +102,8 @@ void ms_display_destroy(MSDisplay *d);
#define MS_VIDEO_OUT_GET_SCALE_FACTOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,8,float)
#define MS_VIDEO_OUT_SET_SELFVIEW_POS MS_FILTER_METHOD(MS_VIDEO_OUT_ID,9,float[3])
#define MS_VIDEO_OUT_GET_SELFVIEW_POS MS_FILTER_METHOD(MS_VIDEO_OUT_ID,10,float[3])
#define MS_VIDEO_OUT_SET_BACKGROUND_COLOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,11,int[3])
#define MS_VIDEO_OUT_GET_BACKGROUND_COLOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,12,int[3])
#ifdef __cplusplus
}
......
......@@ -138,6 +138,7 @@ static int sdl_create_window(SdlDisplay *wd, int w, int h){
ms_message("planes= %p %p %p %i %i",wd->lay->pixels[0],wd->lay->pixels[1],wd->lay->pixels[2],
wd->lay->pixels[1]-wd->lay->pixels[0],wd->lay->pixels[2]-wd->lay->pixels[1]);
}
SDL_ShowCursor(0);//Hide the mouse cursor if was displayed
return 0;
}
......@@ -154,8 +155,6 @@ static bool_t sdl_display_init(MSDisplay *obj, MSFilter *f, MSPicture *fbuf, MSP
ms_error("Couldn't initialize SDL: %s", SDL_GetError());
return FALSE;
}
/* Clean up on exit */
atexit(SDL_Quit);
wd->sdl_initialized=TRUE;
ms_mutex_init(&wd->sdl_mutex,NULL);
ms_mutex_lock(&wd->sdl_mutex);
......@@ -254,12 +253,14 @@ static void sdl_display_uninit(MSDisplay *obj){
}
wd->lay=NULL;
wd->sdl_screen=NULL;
ms_free(wd);
#ifdef __linux
/*purge the event queue before leaving*/
for(i=0;SDL_PollEvent(&event) && i<100;++i){
}
#endif
sdl_show_window(FALSE);
SDL_Quit();
}
MSDisplayDesc ms_sdl_display_desc={
......@@ -286,7 +287,6 @@ typedef struct _WinDisplay{
struct SwsContext *sws_selfview;
MSDisplayEvent last_rsz;
uint8_t *rgb;
uint8_t *black;
int last_rect_w;
int last_rect_h;
int rgb_len;
......@@ -382,7 +382,6 @@ static bool_t win_display_init(MSDisplay *obj, MSFilter *f, MSPicture *fbuf, MSP
wd->fb.planes[2]=NULL;
wd->fb.planes[3]=NULL;
if (wd->rgb) ms_free(wd->rgb);
if (wd->black) ms_free(wd->black);
wd->rgb=NULL;
wd->rgb_len=0;
sws_freeContext(wd->sws);
......@@ -397,7 +396,6 @@ static bool_t win_display_init(MSDisplay *obj, MSFilter *f, MSPicture *fbuf, MSP
wd->rgb_len_selfview=0;
sws_freeContext(wd->sws_selfview);
wd->sws_selfview=NULL;
wd->black=NULL;
wd->last_rect_w=0;
wd->last_rect_h=0;
}
......@@ -459,7 +457,6 @@ static bool_t win_display_init(MSDisplay *obj, MSFilter *f, MSPicture *fbuf, MSP
if (wd->fb.planes[0]) ms_free(wd->fb.planes[0]);
if (wd->rgb) ms_free(wd->rgb);
if (wd->black) ms_free(wd->black);
ysize=wd->fb.w*wd->fb.h;
usize=ysize/4;
fbuf->planes[0]=wd->fb.planes[0]=(uint8_t*)ms_malloc0(ysize+2*usize);
......@@ -473,7 +470,6 @@ static bool_t win_display_init(MSDisplay *obj, MSFilter *f, MSPicture *fbuf, MSP
wd->rgb_len=ysize*3;
wd->rgb=(uint8_t*)ms_malloc0(wd->rgb_len);
wd->black = (uint8_t*)ms_malloc0(wd->rgb_len);
wd->last_rect_w=0;
wd->last_rect_h=0;
return TRUE;
......@@ -549,9 +545,11 @@ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
int corner;
float sv_scalefactor;
float sv_pos[3];
int color[3];
HDC dd_hdc;
HBITMAP dd_bmp;
HBRUSH brush;
BOOL dont_draw;
if (wd->window==NULL) return;
......@@ -607,11 +605,15 @@ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
HGDIOBJ old_object = SelectObject(dd_hdc, dd_bmp);
dont_draw = DrawDibBegin(wd->ddh,dd_hdc, 0, 0, &bi, 0, 0, DDF_BUFFER);
//full screen in black
ret=DrawDibDraw(wd->ddh,dd_hdc,0,0,
rect.right,rect.bottom,
&bi,wd->black,
0,0,bi.biWidth,bi.biHeight,dont_draw?DDF_DONTDRAW:0);
/* full screen in background color */
color[0]=color[1]=color[2]=0;
if (wd->filter)
ms_filter_call_method(wd->filter, MS_VIDEO_OUT_GET_BACKGROUND_COLOR, &color);
brush = CreateSolidBrush(RGB(color[0],color[1],color[2]));
FillRect(dd_hdc, &rect, brush);
DeleteObject(brush);
corner = 0;
sv_scalefactor = SCALE_FACTOR;
......@@ -800,7 +802,6 @@ static void win_display_uninit(MSDisplay *obj){
if (wd->sws_selfview) sws_freeContext(wd->sws_selfview);
if (wd->fb.planes[0]) ms_free(wd->fb.planes[0]);
if (wd->rgb) ms_free(wd->rgb);
if (wd->black) ms_free(wd->black);
if (wd->sws) sws_freeContext(wd->sws);
ms_free(wd);
}
......@@ -882,6 +883,7 @@ typedef struct VideoOut
int corner; /*for selfview*/
float scale_factor; /*for selfview*/
float sv_posx,sv_posy;
int background_color[3];
struct SwsContext *sws1;
struct SwsContext *sws2;
......@@ -941,6 +943,7 @@ static void video_out_init(MSFilter *f){
obj->corner=0;
obj->scale_factor=SCALE_FACTOR;
obj->sv_posx=obj->sv_posy=SELVIEW_POS_INACTIVE;
obj->background_color[0]=obj->background_color[1]=obj->background_color[2]=0;
obj->sws1=NULL;
obj->sws2=NULL;
obj->display=NULL;
......@@ -1276,6 +1279,23 @@ static int video_out_get_selfview_pos(MSFilter *f,void *arg){
((float*)arg)[2]=(float)100.0/s->scale_factor;
return 0;
}
static int video_out_set_background_color(MSFilter *f,void *arg){
VideoOut *s=(VideoOut*)f->data;
s->background_color[0]=((int*)arg)[0];
s->background_color[1]=((int*)arg)[1];
s->background_color[2]=((int*)arg)[2];
return 0;
}
static int video_out_get_background_color(MSFilter *f,void *arg){
VideoOut *s=(VideoOut*)f->data;
((int*)arg)[0]=s->background_color[0];
((int*)arg)[1]=s->background_color[1];
((int*)arg)[2]=s->background_color[2];
return 0;
}
static MSFilterMethod methods[]={
{ MS_FILTER_SET_VIDEO_SIZE , video_out_set_vsize },
{ MS_VIDEO_OUT_SET_DISPLAY , video_out_set_display},
......@@ -1289,6 +1309,9 @@ static MSFilterMethod methods[]={
{ MS_VIDEO_OUT_GET_SCALE_FACTOR , video_out_get_scalefactor},
{ MS_VIDEO_OUT_SET_SELFVIEW_POS , video_out_set_selfview_pos},
{ MS_VIDEO_OUT_GET_SELFVIEW_POS , video_out_get_selfview_pos},
{ MS_VIDEO_OUT_SET_BACKGROUND_COLOR , video_out_set_background_color},
{ MS_VIDEO_OUT_GET_BACKGROUND_COLOR , video_out_get_background_color},
{ 0 ,NULL}
};
......
......@@ -172,7 +172,7 @@ VideoStream *video_stream_new(int locport, bool_t use_ipv6){
}
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize){
ms_message("Setting vidoe size %dx%d", vsize.width, vsize.height);
ms_message("Setting video size %dx%d", vsize.width, vsize.height);
stream->sent_vsize=vsize;
}
......
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