- sdl resising rulze, still buggy

parent be1eb4bb
......@@ -75,6 +75,7 @@ typedef struct vout_sys_s
/* local prototype */
void intf_SDL_Keymap( intf_thread_t * p_intf );
void intf_SDL_Resize( intf_thread_t * p_intf, int width, int height );
void intf_SDL_Fullscreen(intf_thread_t * p_intf);
void intf_SDL_YUVSwitch(intf_thread_t * p_intf);
......@@ -157,6 +158,8 @@ void intf_SDLManage( intf_thread_t *p_intf )
i_key = event.key.keysym.sym; /* forward it */
switch (event.type) {
case SDL_VIDEORESIZE: /* Resizing of window */
intf_SDL_Resize( p_intf, event.resize.w, event.resize.h );
case SDL_KEYDOWN: /* if a key is pressed */
switch(i_key) {
/* switch to fullscreen */
......@@ -185,16 +188,30 @@ void intf_SDLManage( intf_thread_t *p_intf )
}
}
void intf_SDL_Resize( intf_thread_t * p_intf, int width, int height )
{
intf_Msg( "Video display resized (%dx%d)", width, height );
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->i_width = width/* & 0xffffffe*/;
p_intf->p_vout->i_height = height;
p_intf->p_vout->p_sys->b_reopen_display = 1;
p_intf->p_vout->i_changes |= VOUT_YUV_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
void intf_SDL_YUVSwitch(intf_thread_t * p_intf)
{
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->b_need_render = 1 - p_intf->p_vout->b_need_render;
intf_DbgMsg( "need render now : '%d'",p_intf->p_vout->b_need_render);
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
void intf_SDL_Fullscreen(intf_thread_t * p_intf)
{
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->p_sys->b_fullscreen = 1-p_intf->p_vout->p_sys->b_fullscreen;
p_intf->p_vout->p_sys->b_reopen_display = 1;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
......@@ -202,7 +219,7 @@ void intf_SDL_Fullscreen(intf_thread_t * p_intf)
void intf_SDL_Keymap(intf_thread_t * p_intf )
{
//p_intf->p_intf_getKey = intf_getKey;
/* p_intf->p_intf_getKey = intf_getKey; */
intf_AssignKey(p_intf, SDLK_q, INTF_KEY_QUIT, 0);
intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, 0);
/* intf_AssignKey(p_intf,3,'Q'); */
......
......@@ -229,7 +229,7 @@ void vout_SDLDisplay( vout_thread_t *p_vout )
{
/* TODO: support for streams other than 4:2:0 */
/* create the overlay if necessary */
if( !p_vout->p_sys->p_overlay )
if( p_vout->p_sys->p_overlay == NULL )
{
p_vout->p_sys->p_overlay = SDL_CreateYUVOverlay(
p_vout->p_rendered_pic->i_width,
......@@ -296,7 +296,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->i_width,
p_vout->i_height,
0,
SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF );
SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE );
SDL_ShowCursor( 1 );
}
......@@ -305,6 +305,11 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
intf_ErrMsg( "error: can't open DISPLAY default display" );
return( 1 );
}
intf_DbgMsg( "sdl display size : %dx%d - pitch : %d",
p_vout->p_sys->p_display->w,
p_vout->p_sys->p_display->h,
p_vout->p_sys->p_display->pitch);
SDL_WM_SetCaption( VOUT_TITLE , VOUT_TITLE );
SDL_EventState(SDL_KEYUP , SDL_IGNORE); /* ignore keys up */
......
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