/*****************************************************************************
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
- * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_directx.c,v 1.7 2001/07/11 14:26:19 gbazin Exp $
+ * Copyright (C) 2001 VideoLAN
+ * $Id: vout_directx.c,v 1.15 2001/12/07 18:33:07 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
#include <windows.h>
#include <windowsx.h>
-#include <directx.h>
-#include "config.h"
+#if defined( _MSC_VER )
+# include <ddraw.h>
+#else
+# include <directx.h>
+#endif
+
#include "common.h"
+#include "intf_msg.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "video_output.h"
-#include "intf_msg.h"
#include "interface.h"
-#include "main.h"
#include "modules.h"
#include "modules_export.h"
p_vout->p_sys->hbrush = NULL;
p_vout->p_sys->hwnd = NULL;
p_vout->p_sys->i_changes = 0;
+ p_vout->p_sys->b_event_thread_die = 0;
p_vout->p_sys->b_display_enabled = 0;
p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
* DirectXEventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
- intf_WarnMsg( 3, "vout : vout_Create creating DirectXEventThread" );
+ intf_WarnMsg( 3, "vout: vout_Create creating DirectXEventThread" );
if( vlc_thread_create( &p_vout->p_sys->event_thread_id,
"DirectX Events Thread",
(void *) DirectXEventThread, (void *) p_vout) )
* so we send a fake message */
if( p_vout->p_sys->i_event_thread_status == THREAD_READY )
{
- PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'^', 0);
+ PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'q', 0);
vlc_thread_join( p_vout->p_sys->event_thread_id );
}
{
DDSURFACEDESC ddsd;
HRESULT dxresult;
+
int i;
int i_image_width;
int i_image_height;
if( p_vout->b_need_render )
{
- RECT rect_window;
- POINT point_window;
+ RECT rect_window;
+ POINT point_window;
+ DDBLTFX ddbltfx;
/* Nothing yet */
if( p_vout->p_sys->p_surface == NULL )
rect_window.bottom = point_window.y;
/* We want to keep the aspect ratio of the video */
- if( !p_vout->b_scale ) /* kuldge */
+#if 0
+ if( p_vout->b_scale )
{
DirectXKeepAspectRatio( p_vout, &rect_window );
}
+#endif
+
+ /* We ask for the "NOTEARING" option */
+ memset( &ddbltfx, 0, sizeof(DDBLTFX) );
+ ddbltfx.dwSize = sizeof(DDBLTFX);
+ ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
/* Blit video surface to display */
dxresult = IDirectDrawSurface3_Blt(p_vout->p_sys->p_display,
&rect_window,
p_vout->p_sys->p_surface,
NULL,
- 0, NULL );
+ 0, &ddbltfx );
if( dxresult != DD_OK )
{
intf_WarnMsg( 3, "vout: could not Blit the surface" );
i_image_width/2);
#else
/* copy Y, we copy two lines at once */
- memcpy(ddsd.lpSurface + i*2*ddsd.lPitch,
+ memcpy((u8*)ddsd.lpSurface + i*2*ddsd.lPitch,
p_vout->p_rendered_pic->p_y + i*2*i_image_width,
i_image_width);
- memcpy(ddsd.lpSurface + (i*2+1)*ddsd.lPitch,
+ memcpy((u8*)ddsd.lpSurface + (i*2+1)*ddsd.lPitch,
p_vout->p_rendered_pic->p_y + (i*2+1)*i_image_width,
i_image_width);
/* then V */
- memcpy((ddsd.lpSurface + ddsd.dwHeight * ddsd.lPitch)
+ memcpy(((u8*)ddsd.lpSurface + ddsd.dwHeight * ddsd.lPitch)
+ i * ddsd.lPitch/2,
p_vout->p_rendered_pic->p_v + i*i_image_width/2,
i_image_width/2);
/* and U */
- memcpy((ddsd.lpSurface + ddsd.dwHeight * ddsd.lPitch)
+ memcpy(((u8*)ddsd.lpSurface + ddsd.dwHeight * ddsd.lPitch)
+ (ddsd.dwHeight * ddsd.lPitch/4)
+ i * ddsd.lPitch/2,
p_vout->p_rendered_pic->p_u + i*i_image_width/2,