]> git.sesse.net Git - vlc/blobdiff - plugins/directx/vout_directx.c
* Darwin compilation fix.
[vlc] / plugins / directx / vout_directx.c
index 7cce1a293ca8159938ce7b81807f2002478f8b15..a3829699762c936e35bc1a41f452714e10cd27c0 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * 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"
@@ -68,9 +73,7 @@
 #include "video.h"
 #include "video_output.h"
 
-#include "intf_msg.h"
 #include "interface.h"
-#include "main.h"
 
 #include "modules.h"
 #include "modules_export.h"
@@ -159,6 +162,7 @@ static int vout_Create( vout_thread_t *p_vout )
     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.. */
@@ -196,7 +200,7 @@ static int vout_Create( vout_thread_t *p_vout )
      * 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) )
@@ -297,7 +301,7 @@ static void vout_Destroy( vout_thread_t *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 );
     }
 
@@ -469,6 +473,7 @@ static void vout_Display( vout_thread_t *p_vout )
 {
     DDSURFACEDESC ddsd;
     HRESULT       dxresult;
+
     int           i;
     int           i_image_width;
     int           i_image_height;
@@ -497,8 +502,9 @@ static void vout_Display( vout_thread_t *p_vout )
 
     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 )
@@ -533,17 +539,24 @@ static void vout_Display( vout_thread_t *p_vout )
         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" );
@@ -615,19 +628,19 @@ static void vout_Display( vout_thread_t *p_vout )
                    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,