Commit 69c174d7 authored by Gildas Bazin's avatar Gildas Bazin

* DirectX video output plugin now uses triple buffering for YUV overlay. This
  improves the video quality a lot (no tearing) without affecting performance.
  (I knew double buffering sucked but I just discovered why triple buffering
   is better: you don't have to wait for the vsync to flip the buffers).

* Fixed the DirectX video output for non-overlay modes. It was only working
  in RGB16 before.

* Fixed the mouse autohidding feature in the DirectX plugin
 (at least partially).

* Fixed the spu decoder to take the pitch of the destination picture into
  account when rendering the subtitles (Implemented only for the YUV modes).
parent 4b22a291
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vout_directx.h: Windows DirectX video output header file
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_directx.h,v 1.4 2002/04/02 06:31:23 gbazin Exp $
* $Id: vout_directx.h,v 1.5 2002/04/23 22:07:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -62,12 +62,11 @@ typedef struct vout_sys_s
int i_rgb_colorkey; /* colorkey in RGB used by the overlay */
int i_colorkey; /* colorkey used by the overlay */
boolean_t b_cursor;
volatile u16 i_changes; /* changes made to the video display */
u16 i_changes; /* changes made to the video display */
boolean_t b_cursor_autohidden;
mtime_t i_lastmoved;
/* Mouse */
volatile boolean_t b_cursor_hidden;
volatile mtime_t i_lastmoved;
vlc_thread_t event_thread_id; /* event thread */
vlc_mutex_t event_thread_lock; /* lock for the event thread */
......@@ -101,3 +100,8 @@ typedef struct picture_sys_s
*****************************************************************************/
void DirectXEventThread ( vout_thread_t *p_vout );
void DirectXUpdateOverlay( vout_thread_t *p_vout );
/*****************************************************************************
* Constants
*****************************************************************************/
#define WM_VLC_HIDE_MOUSE WM_APP
......@@ -2,7 +2,7 @@
* vout_events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_events.c,v 1.13 2002/04/02 06:31:23 gbazin Exp $
* $Id: vout_events.c,v 1.14 2002/04/23 22:07:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -66,7 +66,8 @@ static long FAR PASCAL DirectXEventProc ( HWND hwnd, UINT message,
*****************************************************************************/
void DirectXEventThread( vout_thread_t *p_vout )
{
MSG msg;
MSG msg;
POINT old_mouse_pos;
/* Initialisation */
......@@ -99,28 +100,39 @@ void DirectXEventThread( vout_thread_t *p_vout )
switch( msg.message )
{
case WM_NCMOUSEMOVE:
case WM_MOUSEMOVE:
if( p_vout->p_sys->b_cursor )
if( (abs(GET_X_LPARAM(msg.lParam) - old_mouse_pos.x) > 2 ||
(abs(GET_Y_LPARAM(msg.lParam) - old_mouse_pos.y)) > 2 ) )
{
if( p_vout->p_sys->b_cursor_autohidden )
GetCursorPos( &old_mouse_pos );
p_vout->p_sys->i_lastmoved = mdate();
if( p_vout->p_sys->b_cursor_hidden )
{
p_vout->p_sys->b_cursor_autohidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->b_cursor_hidden = 0;
ShowCursor( TRUE );
}
else
{
p_vout->p_sys->i_lastmoved = mdate();
}
}
DispatchMessage(&msg);
break;
case WM_VLC_HIDE_MOUSE:
GetCursorPos( &old_mouse_pos );
ShowCursor( FALSE );
break;
case WM_RBUTTONUP:
intf_WarnMsg( 4, "vout: vout_Manage WM_RBUTTONUP" );
p_main->p_intf->b_menu_change = 1;
break;
case WM_LBUTTONDOWN:
p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE;
break;
case WM_LBUTTONDBLCLK:
p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE;
break;
case WM_KEYDOWN:
/* the key events are first processed here. The next
* message processed by this main message loop will be the
......@@ -138,7 +150,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
break;
case WM_CHAR:
intf_WarnMsg( 3, "vout: vout_Manage WM_CHAR" );
switch( msg.wParam )
{
case 'q':
......@@ -193,10 +204,6 @@ void DirectXEventThread( vout_thread_t *p_vout )
default:
/* Messages we don't handle directly are dispatched to the
* window procedure */
#if 0
intf_WarnMsg( 5, "vout: vout_Manage unhandled message",
msg.message );
#endif
TranslateMessage(&msg);
DispatchMessage(&msg);
break;
......@@ -291,7 +298,7 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
/* fill in the window class structure */
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0; /* no special styles */
wc.style = CS_DBLCLKS; /* style: dbl click */
wc.lpfnWndProc = (WNDPROC)DirectXEventProc; /* event handler */
wc.cbClsExtra = 0; /* no extra class data */
wc.cbWndExtra = 0; /* no extra window data */
......@@ -499,12 +506,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
GetClientRect( hwnd, &rect_window );
p_vout->p_sys->i_window_width = rect_window.right;
p_vout->p_sys->i_window_height = rect_window.bottom;
#if 0
intf_WarnMsg( 3, "vout: WinProc WM_WINDOWPOSCHANGED %i,%i,%i,%i",
p_vout->p_sys->i_window_x, p_vout->p_sys->i_window_y,
p_vout->p_sys->i_window_width,
p_vout->p_sys->i_window_height );
#endif
DirectXUpdateRects( p_vout );
if( p_vout->p_sys->b_using_overlay &&
......@@ -518,14 +519,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
}
break;
case WM_ACTIVATE:
intf_WarnMsg( 4, "vout: WinProc WM_ACTIVATE" );
break;
case WM_CREATE:
intf_WarnMsg( 4, "vout: WinProc WM_CREATE" );
break;
/* the user wants to close the window */
case WM_CLOSE:
intf_WarnMsg( 4, "vout: WinProc WM_CLOSE" );
......@@ -552,12 +545,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
}
break;
#if 0
case WM_PAINT:
intf_WarnMsg( 4, "vout: WinProc WM_PAINT" );
break;
#endif
case WM_ERASEBKGND:
p_vout = (vout_thread_t *)GetWindowLong( hwnd, GWL_USERDATA );
if( !p_vout->p_sys->b_using_overlay )
......@@ -580,11 +567,9 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
}
break;
#if 0
default:
intf_WarnMsg( 4, "vout: WinProc WM Default %i", message );
//intf_WarnMsg( 4, "vout: WinProc WM Default %i", message );
break;
#endif
}
return DefWindowProc(hwnd, message, wParam, lParam);
......
......@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.16 2002/04/23 20:58:23 sam Exp $
* $Id: spu_decoder.c,v 1.17 2002/04/23 22:07:05 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -832,13 +832,13 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
case FOURCC_IYUV:
case FOURCC_YV12:
p_dest = p_pic->p->p_pixels + p_spu->i_x + p_spu->i_width
+ p_vout->output.i_width * ( p_spu->i_y + p_spu->i_height );
p_dest = p_pic->Y_PIXELS + p_spu->i_x + p_spu->i_width
+ p_pic->Y_PITCH * ( p_spu->i_y + p_spu->i_height );
/* Draw until we reach the bottom of the subtitle */
for( i_y = p_spu->i_height * p_vout->output.i_width ;
for( i_y = p_spu->i_height * p_pic->Y_PITCH ;
i_y ;
i_y -= p_vout->output.i_width )
i_y -= p_pic->Y_PITCH )
{
/* Draw until we reach the end of the line */
for( i_x = p_spu->i_width ; i_x ; )
......
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